Hi,
I think, the correct formula for beta should be
beta.hat=I(T(X)*X)*T(X)*y
and as far as I remember
beta.hat \sim N(beta,sigma^2*I(T(X)*X),
not I(T(X)*X)/sigma^2
Rnewb schrieb:
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
--
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf
Martinistr. 52
20246 Hamburg
T ++49/40/7410-58243
F ++49/40/7410-57790
______________________________________________
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.