[R] Linear models interaction

Dieter Menne dieter.menne at menne-biomed.de
Fri Feb 26 08:52:08 CET 2010



gauravbhatti wrote:
> 
> My data looks like following:
>                     cera3[i, ] batch lcl29 pdt
> Untreated     3.185867     1     0   0
> Untreated.4   3.185867     0     0   0
> LCL29          4.357552     1     1   0
> LCL29.6       3.446256     0     1   0
> PDT           2.765535     1     0   1
> PDT.5         3.584963     0     0   1
> PDT+LCL29.1   2.867896     1     1   1
> PDT+LCL29.3   2.827819     0     1   1
> 
> As you can see there are three factorls batch , lcl29 and pdt. I am trying
> to fit the model: 
> Y = batch +pdt*lcl29. I get the following coefficients:
>                     Estimate Std. Error    t value     Pr(>|t|)
> (Intercept)  3.1524122  0.2487796 12.6715049 1.242191e-12
> batch1      -0.2267947  0.2291590 -0.9896827 3.314508e-01
> lcl291       0.6350186  0.3122910  2.0334194 5.233525e-02
> pdt1         0.1046388  0.3122910  0.3350684 7.402619e-01
> lcl291:pdt1 -0.6633316  0.4521381 -1.4670995 1.543419e-01
> 
> I know that the coef. of lcl291 i.e 0.635 is difference in means between
> rows with lcl29 present alone and untreated ones. 
> 
> Same is true for the coef of PDT1. However I am not sure about the
> coefficient of  lcl291:pdt1. 
> where does this value come from? How is it calculated?
> ...
> 

Your interpretation is risky, because it strictly is not the difference
between groups, but the slope of a linear regression when batch is numeric.
For a two-level factor, the result is the same, but I strongly recommend
that you use something like

mydata$batch = as.factor(mydata$batch)

and similar for the other factors and redo the fit. Or, better, even give
the factor levels names ("Placebo", "Test") instead of 0,1, that makes for
much nicer plots and tables.

The interaction can be understood as the correction to the simple additive
hypothesis (with a + instead of *) for the second levels of the factors. If
it is very small, the effect of the combination of the levels is
approximately the sum of the individual effects.

Dieter







-- 
View this message in context: http://n4.nabble.com/Linear-models-interaction-tp1569497p1570269.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list