Re: [R] nested design in lme, need help with specifying model

2007-02-26 Thread Mike Dunbar
Dear Radka

I'm not sure I quite understand your design and quite where the nesting comes 
in.

But a quick suggestion is why are you adding species as random as well as 
fixed? I don't think you can do this or indeed should do it. I think this is 
why you get problems with your fixed effects. If you have 3 species then 
species ought to be fixed. Replicate is more the sort of effect that ought to 
be random, this ought to pick up the fact that prey within one run of the 
experiment won't be independent. But if you only have two replicates per 
treatment (species of prey?), then this will limit your ability to detect 
differences between species of prey, unless your within-replicate variation is 
very low. You can look at this very simply but not quite as powerfully by 
averaging the responses for each replicate and doing a non nested anova.

Re your second analysis, this seems along the right lines. How have you coded 
replicate? This may explain your results. Without more details on the plot you 
did its difficult to help further.

regards

Mike



 Radka Ptacnikova [EMAIL PROTECTED] 25/02/2007 23:32 
Hi,

I wonder if anyone can help me with specifying a right model for my analysis. I 
am a beginner to lme methods and though have spent already many hours studying 
from various books an on-line helps, I was unfortunately not able to find a 
solution to my problem on my own. 

Data structure:
I studied escape behavior of three species of a prey to a predator. The prey 
specimens (many) were in a vessel, together with one predator. Escape responses 
were video-recorded when a prey approached the predator close enough and jumped 
consequently away. Each set was run twice with a fresh predator and a fresh set 
of the prey specimens, leading to two replicates per treatment. Unequal number 
of shots (i.e. prey specimens) were analyzed in each of the two replicates for 
each of the three prey species (range 11-19). The data are therefore unbalanced 
and also variance for treatments/replicates is far from being homogeneous, so 
that a nested anova is not a good choice here. As the number of prey specimens 
was rather high, I assume that each shot represents a different prey 
individual. 

My questions:
1) Do the three prey species significantly differ in their escape response?
2) What was variability between replicates within a species and how much did it 
contribute to overall variability?

Now, to my best understanding, the model should be:

mod1-lme(Escape.parameter~Species, random=~1|Species/Replicate)

as I am interested in Species as fixed effects and want to know variability 
caused by Replicates nested within Species as random effects. However, when 
running this model, I get 

Random effects:
 Formula: ~1 | Species
(Intercept)
StdDev:2.937479

 Formula: ~1 | Replicate %in% Species
(Intercept) Residual
StdDev:4.973931 4.266302

Fixed effects: Max_speed ~ Species 
Value Std.ErrorDF   t-value p-value
(Intercept) 23.792040  4.798143 39  4.958593   0
Spec2 -7.121766  6.747930   0 -1.055400 NaN
Spec3  -9.779830  6.725391  0 -1.454165 NaN

So I get variance within species and within replicates, but what the hell are 
these zero DF's, leading to zero p's and how should I interpret them?


Another model I tried was:
mod2-lme(Escape.parameter~Species, random=~1|Replicate)

Random effects:
 Formula: ~1 | Replicate
 (Intercept) Residual
StdDev: 0.0002733313 5.180472

Fixed effects: Max_speed ~ Species
  Value Std.ErrorDF   t-value   p-value
(Intercept)26.00364  1.561971  41  16.647963   0e+00
SpeciesSpec2  -7.93297  2.056430  41  -3.857641   4e-04
SpeciesSpec3-11.81048  1.962713  41  -6.017425   0e+00

Alright, I get the among species differences, but I am confused here with the 
very low StdDev of Replicate as a random effect, since I know f.ex. from a 
plot, that it is relatively high. Which leads me to thinking, that something is 
wrong here. 

I'd appreciate any hints and suggestions.

Radka






 

Never Miss an Email

__
R-help@stat.math.ethz.ch 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.

-- 
This message (and any attachments) is for the recipient only...{{dropped}}

__
R-help@stat.math.ethz.ch 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.


[R] nested design in lme, need help with specifying model

2007-02-25 Thread Radka Ptacnikova
Hi,

I wonder if anyone can help me with specifying a right model for my analysis. I 
am a beginner to lme methods and though have spent already many hours studying 
from various books an on-line helps, I was unfortunately not able to find a 
solution to my problem on my own. 

Data structure:
I studied escape behavior of three species of a prey to a predator. The prey 
specimens (many) were in a vessel, together with one predator. Escape responses 
were video-recorded when a prey approached the predator close enough and jumped 
consequently away. Each set was run twice with a fresh predator and a fresh set 
of the prey specimens, leading to two replicates per treatment. Unequal number 
of shots (i.e. prey specimens) were analyzed in each of the two replicates for 
each of the three prey species (range 11-19). The data are therefore unbalanced 
and also variance for treatments/replicates is far from being homogeneous, so 
that a nested anova is not a good choice here. As the number of prey specimens 
was rather high, I assume that each shot represents a different prey 
individual. 

My questions:
1) Do the three prey species significantly differ in their escape response?
2) What was variability between replicates within a species and how much did it 
contribute to overall variability?

Now, to my best understanding, the model should be:

mod1-lme(Escape.parameter~Species, random=~1|Species/Replicate)

as I am interested in Species as fixed effects and want to know variability 
caused by Replicates nested within Species as random effects. However, when 
running this model, I get 

Random effects:
 Formula: ~1 | Species
(Intercept)
StdDev:2.937479

 Formula: ~1 | Replicate %in% Species
(Intercept) Residual
StdDev:4.973931 4.266302

Fixed effects: Max_speed ~ Species 
Value Std.ErrorDF   t-value p-value
(Intercept) 23.792040  4.798143 39  4.958593   0
Spec2 -7.121766  6.747930   0 -1.055400 NaN
Spec3  -9.779830  6.725391  0 -1.454165 NaN

So I get variance within species and within replicates, but what the hell are 
these zero DF's, leading to zero p's and how should I interpret them?


Another model I tried was:
mod2-lme(Escape.parameter~Species, random=~1|Replicate)

Random effects:
 Formula: ~1 | Replicate
 (Intercept) Residual
StdDev: 0.0002733313 5.180472

Fixed effects: Max_speed ~ Species
  Value Std.ErrorDF   t-value   p-value
(Intercept)26.00364  1.561971  41  16.647963   0e+00
SpeciesSpec2  -7.93297  2.056430  41  -3.857641   4e-04
SpeciesSpec3-11.81048  1.962713  41  -6.017425   0e+00

Alright, I get the among species differences, but I am confused here with the 
very low StdDev of Replicate as a random effect, since I know f.ex. from a 
plot, that it is relatively high. Which leads me to thinking, that something is 
wrong here. 

I'd appreciate any hints and suggestions.

Radka






 

Never Miss an Email

__
R-help@stat.math.ethz.ch 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.