[R] normalized regression output
ivo welch
ivo.welch at yale.edu
Tue Apr 6 00:23:00 CEST 2004
Hi: I would like to write a function that takes as its input a formula
and outputs normalized coefficients ( coef(x)*sdv(x)/sdv(y) ). now, a
formula is an object, and I cannot see how to extract the variables for
obtaining sdv's. the intent is to write something like
my.print.lm( formula ) {
model <- lm(formula);
coefs <- (t(summary.lm(model)))[1,];
tvals <- (t(summary.lm(model)))[3,];
for (i in 1:length( formula.contents.length ) ) {
normcoefs[i] <- coefs[i]*sd( formula.coef[i] )
/sd( formula.yvar ); }
# now I can do nice printing
}
my.print.lm ( y~x+z );
or something like it. If this is not easy, please just tell me. I just
do not want to spend a day to reinvent a wheel that is very simple for
an R statistician. help appreciated.
regards,
/iaw
More information about the R-help
mailing list