Calculating effect size for variables in a multiple regression in R I've been trying to learn about effect size in relation to linear regression and am wondering how to implement it in R. Sure, I have p-values and they indicate how "predictive" the explanatory variable is. However, for each variable in a linear model, I was wondering how to compute a standardized score for how much it impacts the response variable.
Some sample data if you can present a R solution.
x1 = rnorm(10)
x2 = rnorm(10)
y1 = rnorm(10)

mod = lm(y1 ~ x1 + x2)
summary(mod)

 A: I think what you want is the semi-partial correlation squared.  This gives you the proportion of variance in y accounted for by x1 having controlled for x2.  Note that this isn't necessarily the same as the proportion of variance in y accounted for by x1.  That is the regular correlation squared.  They will differ if the variables x1 and x2 are not perfectly uncorrelated.  In addition, the multiple $R^2$ will be equal to the sum of $r_{yx_2}^2$ (i.e., the zero-order correlation squared for one of your variables), plus $r_{yx_1|x_2}$ (i.e., the semi-partial correlation squared controlling for the first variable), plus $r_{yx_1|x_2x_3}$, etc.
The formula for the semi-partial correlation is:
$$
r_{yx_1|x_2} = \frac{r_{yx_1} - r_{yx_2}r_{x_1x_2}}{\sqrt{(1-r_{x_1x_2}^2)}}
$$
Here is a simple R demonstration:  
semi.r = function(y, x, given){  # this function will compute the semi-partial r
  ryx  = cor(y, x)
  ryg  = cor(y, given)
  rxg  = cor(x, given)
  num  = ryx - (ryg*rxg)
  dnm  = sqrt( (1-rxg^2) )
  sp.r = num/dnm
  return(sp.r)
}
set.seed(9503)                   # this makes the example exactly reproducible
x1 = rnorm(10)                   # these variables are uncorrelated in the population
x2 = rnorm(10)                   # but not perfectly uncorrelated in this sample:
cor(x1, x2)                      # [1]  0.1265472
y  = 4 + .5*x1 - .3*x2 + rnorm(10, mean=0, sd=1)
model = lm(y~x1+x2)
summary(model)
# ...
# Coefficients:
#             Estimate Std. Error t value Pr(>|t|)    
# (Intercept)   4.1363     0.4127  10.022 2.11e-05 ***
# x1            0.1754     0.3800   0.461    0.658    
# x2           -0.6181     0.3604  -1.715    0.130    
# ...
sp.x1 = semi.r(y=y, x=x1, given=x2);  sp.x1  # [1]  0.1459061
sp.x1^2                                      # [1]  0.02128858
c.x2 = cor(x2, y);  c.x2                     # [1] -0.5280958
c.x2^2                                       # [1]  0.2788852
c.x2^2 + sp.x1^2                             # [1]  0.3001738
summary(model)$r.squared                     # [1]  0.3001738

A: I've been researching the same question and am surprised to not see a clear universally accepted answer (that I've found so far).
However a few methods I've seen are as follows:

*

*Report partial-Eta squared (η2p).
Can be calculated by the eta_squared() function in the effectsize package in R.
eta_squared(car::Anova(m, type = 3))
Full description found here:
https://www.researchgate.net/post/Which-effect-size-estimate-should-I-use-for-a-linear-regression-with-a-continuous-dep-variable-dichotomous-indep-variable-and-covariates


*Alternatively you could calculate Cohen's F^2

The formula of which is
Cohen's f2 = (R^2included - R^2excluded) / (1 - R^2included)

For nested models R^2 included is the model with your effect of interest and R^2 excluded is your reduced model.
f2 of 0.02-> small,  0.15-> Medium,  0.35 -> large effect sizes
I got this info from:
https://www.researchgate.net/post/Which-effect-size-estimate-should-I-use-for-a-linear-regression-with-a-continuous-dep-variable-dichotomous-indep-variable-and-covariates


*There's also a package for R called yhat that computes a variety of effect sizes with their effect.size() function.
https://rdrr.io/cran/yhat/man/effect.size.html
However I don't know how to interpret the effects it produces yet.

