[R-sig-ME] Glmm and repeated measures anova

Andrew J Tyre atyre2 at unlnotes.unl.edu
Thu May 28 18:40:32 CEST 2009


Romy,

I don't think the problem is with your data layout, but rather with the 
formula you provided - it works (after fixing one comma that should be a 
period in the data):

lme(Do~time,random=~1|subj,data=romy) #this works fine

the key difference is the random effect is a VERTICAL BAR not a slash

and in addition if you want an "ANOVA" analysis of time as a categorical 
variable you need:
romy$time = as.factor(romy$time)

I think you're missing some information however by throwing away site:
romy$site = as.factor(rep(1:4,each=12))
romy

   subj time    Do site
1     A    1  9.24    1
2     A    2  9.46    1
3     A    3  9.74    1
4     B    1  9.05    1
...

summary(lme(Do~time,random=~1|site/subj,data=romy))
although there is very little variability associated with site, assuming 
I've got the sites set correctly.

cheers,

Drew Tyre

School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974

phone: +1 402 472 4054 
fax: +1 402 472 2946
email: atyre2 at unl.edu
http://snr.unl.edu/tyre
http://aminpractice.blogspot.com



Romy Wild <rosi.wild at gmx.de> 
Sent by: r-sig-mixed-models-bounces at r-project.org
05/28/2009 10:03 AM

To
<r-sig-mixed-models at r-project.org>
cc

Subject
[R-sig-ME] Glmm and repeated measures anova






Hello,
I´ve got to confess that my R knowledge is very basic and I have a problem
with a data set for what I am supposed to do a repeated measures anova and 
a
glmm. I´ve been all over the help lists and really tried quite a time but
there seems to be a mistake within my arrangement of data so I would be
really really glad if somebody with a bit more experience could look over
this and help me out.
Generaly the study was about a stream restoration. At three different 
point
of times  I made measurements of Dissolved Oxygen, pH,
conductivity,Nitrate,Nitrite,Ammonium, redox potential in 5 cm depth,10 
cm,
15 cm, and free flowing water to see how these values change over time. I
took this data on 4 sites for each date so that for each date I have a set
of data that contains 4 values of Oxygen in 5cm, 10 cm.....and all the 
same
for the other parameters. What I tried to start with was a repeated 
measures
anova to see whether there are differences among the different dates of 
data
collection at all, concerning each of the parameters.
For example for Oxygen I arranged the data like this:

            5.11     25.11       9.3
Site 1
5cm     9.24    9 .46       9.74
10cm   9.05    9.37        9.30
15cm  2.83     8.37        9.73
FW      9.91     9.55        9.85
And so on......

Site2
5cm 9.48 9.04 9.78 
10cm 4.47 8.99 9.53
15cm 4.71 7.74 8.77
FW 10.01 9.37 9.82 
Site3
5cm 5.38 9,28 9.56 
10cm 6.31 8.49 9.11
15cm 6.36 8.91 9.44
FW 9.97 9.55 9.89 
Site4
5cm 9.86 9.00 9.87 
10cm 4.82 8.93 9.13
15cm 4.41 8.69 7.32
FW 10.01 9.62 9.89
I arranged the data like this, so that every detph level has a capital
letter and the numbers from time stand for the different dates:

subj  time   Do 
A       1       9.24
A       2       9.46
A       3       9.74
B       1       9.05
B       2       9.37
B       3       9.30
C       1       2.83
C       2       8.37
C       3      9.73
D       1      9.91
D       2      9.55
D       3      9.85
E       1      9.48
E       2     9.04 
E       3      9.78
F       1      4.47
F       2      8.99
F       3      9.53
G       1     4.71 
G       2     7.74 
G       3     8.77 
H       1     10.01
H       2     9.37 
H       3     9.82 
I       1     5.38 
I       2      9,28
I       3      9.56
J       1      6.31
J       2      8.49
J       3      9.11
K      1      6.36 
K      2      8.91 
K      3      9.44 
L      1       9.97
L      2       9.55
L       3      9.89
M     1      9.86 
M     2      9.00 
M     3      9.87 
N      1      4.82 
N      2      8.93 
N      3      9.13 
O      1      4.41 
O      2      8.69 
O      3      7.32 
P       1      10.01
P       2      9.62
P       3      9.89

I tried to do the repeated measures anova as follows:
lme(Do~time,random=~/subj)
But that did not really work. Generally I´m not that interested in the
different depth levels, I going to analyse that differently anyway . I 
just
wanted to give it a try in the lme function.  But it would be great to 
have
a working repeated measures anova for analysing whether there are
differences between the different dates for all of the parameters.
Concerning the glmm I tried to get into this and read papers and help 
lists
articles but I have the feeling that this definetely exceeds my 
statistical
knowledge and if was hoping if someone could help me get an idea of how to
fit this data set in such a model. The problem starts that i don´t really
see what could be my response variable if not the time factor as there is
nothing from this data set that all the other parameters depend on. But I
don´t know how to fit the time/date factor in such a model.
I know this is probabls something rather trivial but as i said the
experience is lacking and help would take me a big big step closer to
getting this bachelor thesis done so thanks a lot to everybody who is
willing to look at this problem.
Thanks a lot and best regards ,
Romy Wild




                 [[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models




More information about the R-sig-mixed-models mailing list