[R] continuous independent variable in lme

Federico Calboli f.calboli at ucl.ac.uk
Sun Jul 27 14:35:40 CEST 2003


Dear All,

I am writing to ask a clarification on what R, and in particular lme, is
doing.

I have an experiment where fly wing area was measured in 4 selection lines,
measured at 18 and 25 degrees. I am using a lme model because I have three
replicated per line (coded 1:12 so I need not use getGroups to creat an
orederd factor).

The lines are called: "18"; "25"; "l"; "s".  My data looks like:

  temp line replicate   area  
1   25    l    3  92693 
2   25    l    3 100092 
3   25    l    3 100039 
4   25    l    3  97558 
5   25    l    3  95603 
6   25    l    3 100482 
.....

"18" and "25" are controls for the two other lines so I have set the
following contrasts for lines:

   [,1] [,2] [,3]
18    1    0    1
25   -1    0    1
l     0    1   -1
s     0   -1   -1

If I do the following:

mod1<-lme(area ~ line * temp, random = ~1|replicate/temp, mydata)
anova(mod1)

I get:

            numDF denDF  F-value p-value
(Intercept)     1   336 41817.83  <.0001
line            3     8    14.38  0.0014
temp            1     8   338.21  <.0001
line:temp       3     8     0.62  0.6211


I have a significant effect of selection line. Eyeballing the
interction.plot, it is clear the the line called "25" is smaller at both
temperatures than the other lines.

but when I check the contrasts with summary(mod1) I get:

Fixed effects: area ~ line * temp 
                Value Std.Error  DF   t-value p-value
(Intercept) 165417.32  3102.751 336  53.31312  <.0001
line1         2631.71  4387.952   8   0.59976  0.5653
line2        -2603.27  4387.952   8  -0.59328  0.5694
line3        -4667.61  3102.751   8  -1.50435  0.1709
temp         -2614.39   142.160   8 -18.39045  <.0001
line1:temp      96.39   201.045   8   0.47946  0.6444
line2:temp      95.74   201.045   8   0.47623  0.6466
line3:temp     168.55   142.160   8   1.18561  0.2698

There seems to be no difference in my lines, according to the contrasts I set!

I tried to do the same analysis using temperature as an orderd factor:

mod2<-lme(area ~ line * ordered(temp), random = ~1|replicate/ordered(temp),
mydata)
anova(mod2)

                   numDF denDF  F-value p-value
(Intercept)            1   336 41817.83  <.0001
line                   3     8    14.38  0.0014
ordered(temp)          1     8   338.21  <.0001
line:ordered(temp)     3     8     0.62  0.6211
 
the same anova, but the contrasts are :

Fixed effects: area ~ line * ordered(temp) 
                          Value Std.Error  DF   t-value p-value
(Intercept)           109207.89  534.0393 336 204.49409  <.0001
line1                   4704.14  755.2457   8   6.22862  0.0003
line2                   -544.76  755.2457   8  -0.72130  0.4913
line3                  -1043.87  534.0393   8  -1.95467  0.0864
ordered(temp).L       -12940.58  703.6576   8 -18.39045  <.0001
line1:ordered(temp).L    477.12  995.1221   8   0.47946  0.6444
line2:ordered(temp).L    473.91  995.1221   8   0.47623  0.6466
line3:ordered(temp).L    834.26  703.6576   8   1.18561  0.2698

way different from the previous model. This time the "18" and "25" lines
are different!

As I do not want to specify a model thinking I am doing something when I am
not, I would like to ask you why the difference in the results? 

the fact that my continuous variable, temperature, is rapresented by two
integers, 18 or 25, can cause the difference? assuming I were interested in
the interaction between my contrasts and temperature, to asses differences
in the slope between treatments, what should I do?

Again, I ask this in order to properly understand what lme is doing so I
can go back to work and specify the model I want rather than something else
altogether.

Regards,
Federico Calboli





=========================

Federico C.F. Calboli

Department of Biology
University College London
Room 327
Darwin Building
Gower Street
London
WClE 6BT

Tel: (+44) 020 7679 4395 
Fax (+44) 020 7679 7096
f.calboli at ucl.ac.uk




More information about the R-help mailing list