[R-sig-eco] Output for interactions in models that do not include all main effects
Kristen Gorman
kgorman at sfu.ca
Tue Apr 3 23:31:07 CEST 2012
Dear all,
I have R code to run AIC including multi-model inference. I am running into a problem in calling the output from models where both parameters in an interaction are not included as main effects. In R, the interaction will be called depending on the parameter that was used as the only main effect in the model. So, I end up generating 2 different interactions (e.g., Rlipid:RFGinit vs RFGinit:Rlipid) that are actually the same. This becomes a problem in the remaining R code that requires weighted and summed values for the parameter and SE estimates. Thus, I would like to call the interaction consistently across models. See the following code:
--
lm(formula = Slipid ~ Rlipid + RFGinit:Rlipid, data = DataSet)
Residuals:
Min 1Q Median 3Q Max
-74.075 -19.047 7.233 20.445 45.391
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 120.33847 5.30405 22.688 <2e-16 ***
Rlipid 0.30493 0.23615 1.291 0.202
Rlipid:RFGinit -0.02099 0.01773 -1.184 0.241
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 30.88 on 60 degrees of freedom
Multiple R-squared: 0.02721, Adjusted R-squared: -0.005221
F-statistic: 0.839 on 2 and 60 DF, p-value: 0.4372
lm(formula = Slipid ~ RFGinit + Rlipid:RFGinit, data = DataSet)
Residuals:
Min 1Q Median 3Q Max
-76.35 -21.63 7.09 22.46 45.71
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 131.028546 8.717104 15.031 <2e-16 ***
RFGinit -0.933483 0.742083 -1.258 0.213
RFGinit:Rlipid 0.003926 0.009283 0.423 0.674
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 30.9 on 60 degrees of freedom
Multiple R-squared: 0.02586, Adjusted R-squared: -0.00661
F-statistic: 0.7964 on 2 and 60 DF, p-value: 0.4556
--
Is there a way to tell R to call the interaction based on alphabetical order of the 2 interaction terms and not based on the term that was used as a main effect?
Thanks very much for any insight.
Kristen Gorman
More information about the R-sig-ecology
mailing list