Created
January 30, 2019 17:31
-
-
Save pytholabsbot1/d127ea7d8caaeebe4a2d57f06fb197d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##create a nodel to estimate the relationship b/w x and y | |
##optimization model = OLS estimator | |
def ols(x,y): | |
y_ = y.mean() | |
x_ = x.mean() | |
b1 = np.sum((y-y_)*(x-x_))/np.sum((x-x_)**2) | |
b0 = y_- b1*x_ | |
return(b0,b1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment