[R] allEffects() with lm

Mikhail Spivakov ensdev.box at gmail.com
Tue Jun 2 19:48:32 CEST 2009


Dear John Fox and everyone, 

I have been using the effects library with glms and have found it very
useful. 
Now I'm trying it with lms and I'm not sure if the results of the
allEffects() are as expected.

I've got a model that looks like this:

mymodel = lm(formula = A ~ B + C + D + B:D + C:D)

Residuals:
     Min       1Q   Median       3Q      Max 
-3.80156 -0.73486 -0.09792  0.63602  4.77747 

Coefficients:
                   Estimate Std. Error t value Pr(>|t|)    
(Intercept)        0.551727   0.014788  37.310  < 2e-16 ***
B                      0.112033   0.014067   7.964 1.82e-15 ***
C                      0.150992   0.010281  14.686  < 2e-16 ***
D                      0.319938   0.018451  17.340  < 2e-16 ***
B:D                   0.042949   0.008208   5.233 1.70e-07 ***
C:D                   0.077968   0.010054   7.755 9.58e-15 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 1.083 on 11555 degrees of freedom
Multiple R-squared: 0.2412,	Adjusted R-squared: 0.2409 
F-statistic: 734.6 on 5 and 11555 DF,  p-value: < 2.2e-16 

When I ran plot(allEffects(mymodel)), I was expecting that the effect
diagrams for the interaction terms will include the effects of the
individual terms as well.  However, this was not the case, since despite the
strong individual terms, with one of the terms set to zero the regression
line for the second one was invariably A=0.

I'm wondering if this is a bug or a "feature" and in the latter case, what
can be done to display effects of the terms in a "combined" way, such that
the contribution of both them on their own and as part of an interaction
term is taken into account.

Many thanks
Mikhail

--
Mikhail Spivakov, PhD
European Bioinformatics Institute
Hinxton 
Cambridgeshire CB10 1SD
UK

spivakov at ebi.ac.uk
-- 
View this message in context: http://www.nabble.com/allEffects%28%29-with-lm-tp23837461p23837461.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list