[R] about the unscaled covariances from a summary.lm object

Martin Ivanov tramni at abv.bg
Tue May 29 15:12:19 CEST 2007

I want to clarify something about the unscaled covarinces component of a summary.lm object. So we have the regressor matrix X. If the fitted lm object is lmobj, the inverse of the matrix t(X)%*%X is xx, and the residual variance is sigma^2_e, the variance-covariance matrix of the OLS estimate of the coefficients is given by:
I saw that what the function vcov actually does is simply:
vcov=summary(lmobj)$sigma^2 * summary(lmobj)$cov.unscaled
So the cov.unscaled component should give the matrix xx. I am right?
I tried inverting the matrix t(X)%*%X with solve by issuing:
solve(t(X)%*%X), but I get a matrix quite different from the matrix given by cov.unscaled. Is it just computational instability, or I am missing something important?


More information about the R-help mailing list