[R-sig-ME] Temporal correlation structure in mixed model

Worthington, Thomas A thomas.worthington at okstate.edu
Thu Mar 27 17:23:54 CET 2014


Dear All 

I'm trying to run a mixed model on ecology data. The setup is as follows, a group of fish are placed in a flume and attempt to pass a barrier. The dependent variable is the number of approaches to pass the barrier per minute of the trial, with each trial lasting 10 minutes. There  are two configurations of the barrier.  There are 20 trials in total, 10 for each setup. The aim of the study is to see whether the number of approaches in minute 1, minute 2, minute 3 etc.  is different between the two setups. Therefore my model is of the form Approaches ~ Setup + Minute + Setup * Minute, where minute (10 levels) and setup  (2 levels) are both factors.  

I have three potential models and am slightly confused over the model specification, I believe I need to include a correlation structure to deal with temporal autocorrelation but am unclear over whether a random effect is needed instead or both are required. I have included a variance structure to deal with the issue of homogeneity of variance in the data. The three models are as follows         

test1 <- gls(Approaches ~ Setup * Minute, data=data, correlation = corAR1(form =~ Minute|Trial), weights = varIdent(form=~ 1| Minute * Setup), control=list(opt="optim"))

test2 <- lme(Approaches ~ Setup * Minute, data=data, random = ~ Minute | Trial, weights = varIdent(form=~ 1| Minute * Setup), control=list(opt="optim"))

test3 <- lme(Approaches ~ Setup * Minute, data=data, random = ~ Minute | Trial, weights = varIdent(form=~ 1| Minute * Setup), correlation = corAR1(form =~ Minute|Trial), control=list(opt="optim"))

I believe (maybe wrongly) that Test 1 and 2 would be broadly similar, but if some could suggest the most sensible model I would greatly appreciate it 

Best wishes

Tom



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