Skip to content

Instantly share code, notes, and snippets.

@otuva
Created April 28, 2024 20:53
Show Gist options
  • Save otuva/7d511853a5a913d2b338e75423184a94 to your computer and use it in GitHub Desktop.
Save otuva/7d511853a5a913d2b338e75423184a94 to your computer and use it in GitHub Desktop.
import statsmodels.api as sm
# Veriler
y = np.array([500.0, 550.0, 556.4, 600.0, 450.0, 425.0, 300.0, 725.0, 315.0, 621.1])
x = np.array([70.00, 72.00, 72.56, 77.00, 66.40, 65.10, 41.20, 82.10, 43.00, 80.00])
# Doğrusal regresyon modeli
x = sm.add_constant(x) # Model için sabit ekleniyor
model = sm.OLS(y, x)
results = model.fit()
# Eğim (slope) için t-test istatistiği
slope_t_stat = results.tvalues[1] # Sabit değil, eğim parametresi için t istatistiği
slope_t_stat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment