[R] Interpreting coefficients in linear models with interaction terms

David Winsemius dwinsemius at comcast.net
Sun Jan 13 02:38:50 CET 2013


On Jan 12, 2013, at 5:00 PM, peter dalgaard wrote:

>
> On Jan 12, 2013, at 23:33 , Rolf Turner wrote:
>
>>
>> We don't do people's homework for them.
>>
>> But since you seem to have put in at least a little bit of your
>> own effort .....  It is perfectly possible for there to be an  
>> interaction
>> without there being main effects.
>>
>> Consider two factors A and B each with two levels.  Let mu_11 be
>> the population mean when A is at level 1 and B is at level 1, and so
>> on.
>>
>> Suppose mu_11 = 1, mu_12 = -1, mu_21 = -1, and mu_22 = 1.
>>
>> Then there are no main effects; A averages to 0, as does B.
>>
>> But there is an elephant-ful of interaction.
>
> Also note that coefficients for main effects in the present of  
> interactions have a different interpretation, depending on the  
> coding of contrasts. In the summary table you cite, the value 7.101  
> is actually the effect of Sex within TestNumber1 and the interaction  
> terms are the differences between that effect and those of Sex  
> within the other two groups. Only if the latter terms are set to  
> zero, the coefficient for Sex becomes the Sex effect for all groups.  
> (All assuming that you haven't been messing with options("contrasts"))

I will step over the line (or ellipse) that defines my professional  
credentials and say that one should never attempt the maneuver  
described in the subject line. Instead one should construct and  
compare the effect estimates. With R that is most compactly done with  
'predict' methods.

-- 
David.

> Best,
> Peter D.
>
>
>>
>>   cheers,
>>
>>       Rolf Turner
>>
>>   cheers,
>>
>>       Rolf Turner
>>
>> On 01/13/2013 10:56 AM, theundergrad wrote:
>>> Hi,
>>>
>>> I am trying to interpret the coefficients in the model:  
>>> RateOfMotorPlay ~
>>> TestNumber + Sex + TestNumber * Sex where there are thee different  
>>> tests and
>>> Sex is (obviously) binary. My results are: Residuals:
>>>   Min     1Q Median     3Q    Max
>>> -86.90 -26.28  -7.68  22.52 123.74
>>>
>>> Coefficients:
>>>                 Estimate Std. Error t value Pr(>|t|)
>>> (Intercept)        29.430      6.248   4.710 4.80e-06 ***
>>> TestNumber2        56.231      8.837   6.364 1.47e-09 ***
>>> TestNumber3        75.972     10.061   7.551 1.82e-12 ***
>>> SexM                7.101      9.845   0.721    0.472
>>> TestNumber2:SexM  -16.483     13.854  -1.190    0.236
>>> TestNumber3:SexM  -24.571     15.343  -1.601    0.111
>>> ---
>>> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>>>
>>> Residual standard error: 40.97 on 188 degrees of freedom
>>> Multiple R-squared: 0.3288,	Adjusted R-squared: 0.3109
>>> F-statistic: 18.42 on 5 and 188 DF,  p-value: 7.231e-15
>>>
>>> I am looking for one number that will represent the significance  
>>> of the
>>> interaction term. I was thinking of doing an F test comparing this  
>>> model to
>>> one without the interaction. When I do this, I get a highly  
>>> significant
>>> result. I am not exactly sure how to interpret this. In  
>>> particular, it seems
>>> strange to me to have a significant interaction term without both
>>> independent variables being significant. Any advice would be highly
>>> appreciated.
>>
>> ______________________________________________
>> 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.
>
> -- 
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
>
> ______________________________________________
> 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.

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list