Dr. Walter H. Schreiber
2006-Jan-16 16:24 UTC
[R] Standardized beta-coefficients in regression
Hello list, I am used to give a lot of attention to the standardized regression coefficients, which in SPSS are listed automatically. Is there alternative to running the last two lines in the following example to get all the information? ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) summary( lm(ctl ~ trt) ) summary( lm(scale(ctl) ~ scale(trt)) ) Any hints are appreciated. Walter. -- Dr. Walter H. Schreiber Dept. of Psychology University of Koblenz-Landau
Try this, possibly with a better name: f <- function(formula, ...) { print(summary(lm(formula, ...))) formula <- update(formula, scale(.) ~ scale(.)) print(summary(lm(formula, ...))) } f(ctl ~ trt) On 1/16/06, Dr. Walter H. Schreiber <whschreiber at onlinehome.de> wrote:> Hello list, > > I am used to give a lot of attention to the standardized regression > coefficients, which in SPSS are listed automatically. > > Is there alternative to running the last two lines in the following example to > get all the information? > > ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) > trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) > summary( lm(ctl ~ trt) ) > summary( lm(scale(ctl) ~ scale(trt)) ) > > Any hints are appreciated. > > Walter. > > -- > Dr. Walter H. Schreiber > Dept. of Psychology > University of Koblenz-Landau > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
On Mon, 16 Jan 2006, Dr. Walter H. Schreiber wrote:> Hello list, > > I am used to give a lot of attention to the standardized regression > coefficients, which in SPSS are listed automatically.I do wonder why? Most people I have encountered who do that are interpreting them in invalid ways.> Is there alternative to running the last two lines in the following example to > get all the information?Yes, but why do you want one? (You don't need summary, just coef, in the second line, and you also do not need an intercept.) For a single regressor as here, just cor(ctl, trt).> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) > trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) > summary( lm(ctl ~ trt) ) > summary( lm(scale(ctl) ~ scale(trt)) )-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Mon, 16 Jan 2006, Dr. Walter H. Schreiber wrote:> Hello list, > > I am used to give a lot of attention to the standardized regression > coefficients, which in SPSS are listed automatically.>>> Prof Brian Ripley <ripley at stats.ox.ac.uk> >>> replied<<< I do wonder why? Most people I have encountered who do that are interpreting them in invalid ways. and Yes, but why do you want one? (You don't need summary, just coef, in the second line, and you also do not need an intercept.) For a single regressor as here, just cor(ctl, trt).>>>One reason might be that the American Psychological Ass'n requres them for it's regression tables. As to why the APA requires them, I couldn't say, but require them they do. Peter
Unfortunately I found myself in the same position as outlined above, where I was requested to reproduce 'standardized regression coefficients' as reported by SPSS. Below an example that produces something very similar to the results table from an SPSS "Linear Regression" procedure, including the standardized regression coefficients: mylm <- lm(Sepal.Width ~ ., data=iris, x=TRUE, y=TRUE) sd.x <- sd(mylm$x); sd.y <- sd(mylm$y); std.coef <- coef(mylm) * (sd.x / sd.y); coef.table <- as.data.frame(summary(mylm)$coefficients); coef.table <- cbind(coef.table, std.coef); print(coef.table); I do agree with B.R. but unfortunately the life of an applied statistician is complex sometimes :-) -- View this message in context: http://r.789695.n4.nabble.com/Standardized-beta-coefficients-in-regression-tp791616p3842631.html Sent from the R help mailing list archive at Nabble.com.