1
$\begingroup$

How to compute the overall standard error of a linear regression model using Python? Which library should I use? I am looking for something like this, however, I can't see how to get the overall standard error. Any ideas?

$\endgroup$
7
1
$\begingroup$

Let's say you have linear model Y = XB + e, for Y: n*q, X: n*p, B: p*q. Then:

def standard_error(X,Y):
    beta = inv(X.T.dot(X)).dot(X.T).dot(Y)
    return mean((Y-X.dot(beta))**2)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.