I calculate multiple linear regression in R with

lm(var ~ VAR1+VAR2+VAR3+VAR4)

Do you know how to calculate R-squared change for each variable VAR1, VAR2, VAR3 ? Thank you

  • 1
    $\begingroup$ r.789695.n4.nabble.com/… $\endgroup$
    – Roland
    Aug 2 '13 at 11:16
  • $\begingroup$ Can you clarify what you mean here? Eg, what do you want to do w/ this information when you get it? Are you wondering how to conduct the R-squared change test? Do you want to know the variance in var marginally associated w/ each VAR, or partially associated? etc. $\endgroup$ Aug 2 '13 at 15:30
  • $\begingroup$ I want to get the contribution of each variables VAR1, VAR2, VAR3, etc to explain var. $\endgroup$
    – user28170
    Aug 6 '13 at 15:12

The OP essentially wants to calculate the $R^2$ differences for individual variables. So the models would be:

m0 = lm(var ~ VAR1 + VAR2 + VAR3)
m1 = lm(var ~ VAR2 + VAR3)
m2 = lm(var ~ VAR1 + VAR3)
m3 = lm(var ~ VAR1 + VAR2)

And then you can do

pr2m1 = summary(m0)$r.squared-summary(m1)$r.squared
pr2m2 = summary(m0)$r.squared-summary(m2)$r.squared
pr2m3 = summary(m0)$r.squared-summary(m3)$r.squared

But this probably doesn't do what you think it does (explain exactly how much the individual variables explain via the $R^2$ difference) - at least if there is any multicollinearity (which there usually is).

  • $\begingroup$ summary(m0)$r.squared works for me, not name subscripting... $\endgroup$
    – Spacedman
    Aug 2 '13 at 16:40

Why not computing all the nested models ?

lm(var ~ VAR1)
lm(var ~ VAR1 + VAR2)
lm(var ~VAR1 + VAR2 + VAR3)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.