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?


1 Answer 1


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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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