I don't think you ever want to do it this way. vcov() gives what is needed. But, if you perform matrix operations represented algebraically as t(x) %*% x, then use crossprod(x) and NOT t(x) %*% x
See the paper at the link below for reasons why @ARTICLE{Rnews:Bates:2004, author = {Douglas Bates}, title = {Least Squares Calculations in {R}}, journal = {R News}, year = 2004, volume = 4, number = 1, pages = {17--20}, month = {June}, url = {http://CRAN.R-project.org/doc/Rnews/}, pdf = {http://CRAN.R-project.org/doc/Rnews/Rnews_2004-1.pdf} } > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of A. Beaujean > Sent: Monday, October 29, 2007 4:25 PM > To: Peter B. Mandeville > Cc: r-help > Subject: Re: [R] covariance matrix of the regression coefficients > > If X is your p-1 variable matrix (with the first column > vector being 1s), i.e., nrow(X)=n and ncol(X)=p > > then > MSE<-summary(lm(Y~X[2]+X[3] + ...X[P-1]))$s^2 > > and your coefficient (co)variance matrix is > MSE*ginv(t(X)%*%X) > > Best, > > Alex > > > On 10/29/07, Peter B. Mandeville <[EMAIL PROTECTED]> wrote: > > > > Greetings, > > > > On page 273, Cohen, Cohen, West, and Aiken (Applied Multiple > > Regression/Correlation Analysis for the Behavioral Sciences, Third > > Edition", state that the covariance matrix of the regression > > coefficients is provided by standard programs for multiple > regression, > > including SAS, SPSS, and SYSTAT. How does one calculate the > matrix in R. Thank you very much. > > > > pbmPeter B. Mandeville cel: 444 860 3204 tel: 52 444 > 826 2346-49 ext > > 532 fax: 52 444 826 2352 P.D. Favor de confirmar la llegada de este > > correo. Gracias. > > _________________________________________________________________ > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > -- > *************** > A. Alexander Beaujean, Ph.D., LSSP > Licensed Psychologist (Provisional, TX) > http://myprofile.cos.com/abeaujean > http://www.baylor.edu/soe/faculty/index.php?id=38476 > > > "General impressions are never to be trusted. Unfortunately > when they are of > long standing they become fixed rules of life, and assume a > prescriptive > right not to be questioned. Consequently those who are not > accustomed to > original inquiry entertain a hatred and a horror of > statistics. They cannot > endure the idea of submitting their sacred impressions to > cold-blooded > verification. But it is the triumph of scientific men to rise > superior to > such superstitions, to devise tests by which the value of > beliefs may be > ascertained, and to feel sufficiently masters of themselves to discard > contemptuously whatever may be found untrue." --Sir Francis > Galton, FRS > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.