Skip to content

Instantly share code, notes, and snippets.

@jasher4994
Created June 4, 2021 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasher4994/fc5a89e3454bd2d312bbd0b4680cc904 to your computer and use it in GitHub Desktop.
Save jasher4994/fc5a89e3454bd2d312bbd0b4680cc904 to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
import statsmodels.api as sm
from scipy import stats
X = df.loc[:, ['CenntralisedAge', 'CanDrink']] #could add interactions in here
y = df.MRA
X = np.array(X)
y = np.array(y)
X2 = sm.add_constant(X2) #not all problems require a constant
est = sm.OLS(y, X2)
est2 = est.fit()
print(est2.summary())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment