[R] slightly extended lm class
ivo welch
ivowel at gmail.com
Tue Jan 2 03:00:50 CET 2007
Dear R readers:
I have written a short lme.R function, which adds normalized
coefficients and White heteroskedasticity-adjusted statistics to the
standard output. Otherwise, it behaves like lm. This is of course
trivial for experts, but for me and other amateur users perhaps
helpful.
y= rnorm(15); x= rnorm(15); z= rnorm(15);
m= lme( y ~ x + z); print(summary(m));
produces something like
Call:
lm(formula = ..1)
Residuals:
Min 1Q Median 3Q Max
-26.04 -10.61 1.55 13.84 28.84
Coefficients:
Estimate NormEst Std. Error t value Pr(>|t|) t-htsk Pr(>|th|)
(Intercept) 6.1343 0.0000 5.8886 1.0417 0.3181 1.41 0.183
x 0.6981 0.1109 1.5922 0.4385 0.6688 0.37 0.716
z -0.7720 -0.4735 0.4123 -1.8727 0.0857 -2.06 0.062 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 18.7 on 12 degrees of freedom
Multiple R-Squared: 0.233, Adjusted R-squared: 0.106
F-statistic: 1.83 on 2 and 12 DF, p-value: 0.203
If anyone is interested, it is available at
"http://welch.econ.brown.edu/computers/lme.R". I didn't even get the
formatting on the coefficient matrix right, but this is cosmetic.
maybe other errors in it, too. of course, it would be nice if someone
made something industrial strength out of this---for use by casual
amateurs such as myself.
hope it helps someone.
regards,
/iaw
More information about the R-help
mailing list