I am using statsmodels to create an OLS. I need to estimate confidence intervals (mean confidence interval) for the mean of the predicted value in a certain cohort. I came across this question : Linear regression with `lm()`: prediction interval for aggregated predicted values which gives a solution using R. I couldn't find a good way to retrieve the variance-covariance matrix of predicted values using statsmodels. I'd be grateful if someone came across the same problem or have any other idea on how to aggregate confidence intervals using statsmodels.
Asked
Active
Viewed 165 times
0
-
"the variance-covariance matrix of predicted values" You mean the variance-covariance matrix of the estimated coefficients. – Roland Oct 13 '20 at 11:30
-
I am talking about the variance covariance matrix of predicted values, this will allow me to have an estimate of the variance of the mean of predicted values and construct confidence intervals. – Amine Oct 14 '20 at 11:40
-
Well, I still believe you mean what I said, but good luck. – Roland Oct 14 '20 at 12:32
-
Hello Roland, I finally found an answer to my question, It's not what you said but is still closely related to it, you can find what I was talking about here: http://www.stat.ucla.edu/~nchristo/introeconometrics/introecon_fitted.pdf Thank you for your answer – Amine Oct 15 '20 at 12:48
-
That document uses confusing (wrong) terminology. If your goal is to calculate the confidence interval of predicted values, you need the variance-covariance matrix of the coefficient estimates (see many tutorials and books). – Roland Oct 15 '20 at 14:13