Hello,

I'm struggling to figure out how to perform a repeated measures MANOVA, or
an equivalent analysis appropriate for answering the question. I've been
looking both into *(1)* lmer from the lme4 package, and* (2)* an Anova from
the car package applied to an mlm model.

*The problem*The structure of my data is:

   -  I have 4 behaviors for each animal (*response variables*).
   - The animals are split into two groups: one that was marked, and one
   that was not marked (*a between subject factor*).
   - For each animal, I recorded its behavior before and after adding a
   predator cue (*within subjects effect.*)


 I'm interested in the main effect of marking (overall, *does marking
affect behavior*?), the main effect of the cue (*within subjects, does the
behavior differ before and after adding the cue?*), and the interaction
between marking and the cue (*do marked individuals respond to the cue
differently from unmarked individuals?*).

The data frame looks like this, with each individual animal identified by
ID:

ID     Marked     Cue     Behav1     Behav2     Behav3    Behav4
1      Y                 N          #                 #                 #
            #
1      Y                 Y          #                 #                 #
            #
2      N                 N          #                 #                 #
            #
2      N                 Y          #                 #                 #
            #

Above are 2 animals, one that was marked (with and without cue) and one
that was unmarked (with and without cue).

*(1) *Using the lmer approach, I've been fiddling with this code:

library(lme4)
##Test of interaction between marking and cue
m1 <- lmer (cbind (Behav1,Behav2,Behav3,Behav4) ~ Marked*Cue + (Cue | ID),
data=df)
m2<- lmer (cbind (Behav1,Behav2,Behav3,Behav4) ~ Marked + Cue + (Cue | ID),
data=df)
anova(m1,m2,test="LRT")

##Supposing the interaction wasn't significant above, test of marking effect
m3<-lmer (cbind (Behav1,Behav2,Behav3,Behav4) ~ Marked + (Cue | ID),
data=df)
m4<- lmer (cbind (Behav1,Behav2,Behav3,Behav4) ~ (Cue | ID), data=df)
anova(m3,m4,test="LRT")

##Supposing the interaction wasn't significant above, test of cue effect
m5<- lmer (cbind (Behav1,Behav2,Behav3,Behav4) ~ (1 | ID), data=df)
m6<- lmer (cbind (Behav1,Behav2,Behav3,Behav4) ~ (1 + Cue | ID), data=df)
anova(m5,m6,test="LRT")

Is this an appropriate way to approach the problem?

*(2)* Most of the literature I can find online right now refers to fitting
an mlm and running 'car' package Anova on it. I cannot for the life of me
figure out how to get my data formatted properly for that and how to create
an 'idata' matrix to indicate what variables have repeated measures within
subjects. If that is the better approach, any advice (given the dataset
described above) on how get Anova to give test the within and between
subjects effects I'm interested in?

Thanks!

Brad



-- 

Bradley Evan Carlson
PhD Candidate
Intercollege Graduate Degree Program in Ecology
The Pennsylvania State University
University Park, PA 16802

Email: carbrae@gmail.com
http://homes.bio.psu.edu/people/faculty/langkilde/index_files/carlson.htm
https://sites.google.com/site/bradleyecarlson/home

	[[alternative HTML version deleted]]

