[R] how does R compute Std. Error's?

Rnewb oneoff1234 at yahoo.com
Thu Mar 11 08:28:54 CET 2010


i am trying to duplicate R's computation of standard errors but having some
trouble.  i loaded some data into R and ran summary(lm(y~x1+x2+x3+0,
data=data)), but i am not sure how the "Std. Error" values are computed.

let y be the nx1 vector of dependent variables and X be the nx3 matrix of
independent variables.  let T(.) denote the transpose of a matrix/vector,
and let I(.) denote the inverse of a square matrix.  then i'm able to
correctly compute the coefficients and residual standard error using the
following formulas:

beta = I(T(X)*X) * y
resid err = sqrt(T(y)*y - 2*T(beta)*y + T(beta)*T(X)*X*beta) / sqrt(n - 3)

i then try to compute the coefficient standard errors via:

coeff err(i) = sqrt(I(T(X)*X)[i,i]) / (resid err)

where .[i,i] means the ith entry on the diagonal of the given matrix. 
however, doing this gives values that are off by a multiplicative factor. 
the factor is the same for all coefficients, but it is not 1, and the value
varies for different data sets.  what is this term?

thanks,
Rnewb
-- 
View this message in context: http://n4.nabble.com/how-does-R-compute-Std-Error-s-tp1588537p1588537.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list