[R] Effect size in multiple regression

Joshua Wiley jwiley.psych at gmail.com
Sat Mar 26 12:24:23 CET 2011


Hi Michael,

You can just fit your model, and then use anova() to get the Sum of Squares.

## fit and store model
m <- lm(mpg ~ hp * wt * vs, data = mtcars)
## store ANOVA from model
msum <- anova(m)
## divide all Sums of Squares by the sum() of the Sums of Squares
msum[["Sum Sq"]]/sum(msum[["Sum Sq"]])

do note that this will be order dependent.

HTH,

Josh


On Sat, Mar 26, 2011 at 4:03 AM, Michael Haenlein
<haenlein at escpeurope.eu> wrote:
> Dear all,
>
> is there a convenient way to determine the effect size for a regression
> coefficient in a multiple regression model?
> I have a model of the form lm(y ~ A*B*C*D) and would like to determine
> Cohen's f2 (http://en.wikipedia.org/wiki/Effect_size) for each predictor
> without having to do it manually.
>
> Thanks,
>
> Michael
>
>
>
> Michael Haenlein
> Associate Professor of Marketing
> ESCP Europe
> Paris, France
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>


-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list