Skip to content

Instantly share code, notes, and snippets.

@konverner
Last active November 10, 2023 21:03
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 konverner/97911821a557df24e79c6fedc8367df3 to your computer and use it in GitHub Desktop.
Save konverner/97911821a557df24e79c6fedc8367df3 to your computer and use it in GitHub Desktop.
OLS method with statsmodels
import numpy as np
import statsmodels.api as sm
X = np.array([[1, 85, 5],
[1, 177, 6],
[1, 100, 9],
[1, 110, 8],
[1, 90, 7.5],
[1, 144, 5.5]])
Y = np.array([1.80, 1.52, 1.93, 2.04, 2.12, 1.58])
est = sm.OLS(Y, sm.add_constant(X))
est = est.fit()
CI = est.conf_int(alpha=0.025, cols=None)
print(est.summary())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment