**Question:**

Code gives warning when running T-test

Code:

```
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as sc
import statsmodels.api as sc
import statsmodels.api as sm
from scipy import stats
from scipy.stats import ttest_ind
#DATA
x = np.array([0, 0, 0, 0, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8, 8, 8, 8])
YY_y = np.array([1, 2, 2, 1, 3, 4, 4, 3, 5, 6, 6, 5, 7, 8, 8, 7, 9, 10, 10, 9])
Z_y = np.array([1, 2, 2, 3, 3, 4, 5, 6, 5, 8, 9, 5, 9, 10, 8, 9, 10, 12, 11, 10])
YY_model = sm.OLS(YY_y, sm.add_constant(x)).fit()
Z_model = sm.OLS(Z_y, sm.add_constant(x)).fit()
# Extract coefficients
YY_intercept, YY_slope = YY_model.params
Z_intercept, Z_slope = Z_model.params
# Fit linear regression lines
YY_slope, YY_intercept = np.polyfit(x, YY_y, 1)
Z_slope, Z_intercept = np.polyfit(x, Z_y, 1)
# Perform independent samples t-test on slopes
t_stat_slope, p_value_slope = ttest_ind(YY_slope, Z_slope)
# Perform independent samples t-test on intercepts
t_stat_intercept, p_value_intercept = ttest_ind(YY_intercept, Z_intercept)
# Print results
print(f"T-statistic for Slope: {t_stat_slope}, P-value for Slope: {p_value_slope}")
print(f"T-statistic for Intercept: {t_stat_intercept}, P-value for Intercept: {p_value_intercept}")
```

Outcome:

```
/home/runner/regressie/.pythonlibs/lib/python3.10/site-packages/scipy/stats/_stats_py.py:7030: RuntimeWarning: invalid value encountered in scalar divide
svar = ((n1 - 1) * v1 + (n2 - 1) * v2) / df
T-statistic for Slope: nan, P-value for Slope: nan
T-statistic for Intercept: nan, P-value for Intercept: nan
```