Incorporating time series into a mixed effects model in R (using lme4) -


i've had search similar questions , come short apologies if there related questions i've missed.

i'm looking @ amount of time spent on feeders (dependent variable) across various conditions each subject visiting feeders 30 times.

subjects exposed feeders of 1 type have different combination of being scented/unscented, having visual patterns/being blank, , having these visual or scented patterns presented in 1 of 2 spatial arrangements.

so far model is:

mod<-lmer(timeonfeeder ~ scent_yes_no + visual_yes_no +      pattern_one_or_two + (1|subject), data=data) 

how can incorporate visit numbers model see if these factors have effect on time spent on feeders on time?

you have variety of choices (this question might marginally better crossvalidated).

  • as @dominix suggests, can allow linear increase or decrease in time on feeder on time. makes sense allow change vary across birds:

    timeonfeeder ~ time + ... + (time|subject) 
  • you could allow arbitrary pattern of change on time (i.e. not linear):

    timeonfeeder ~ factor(time) + ... + (1|subject) 

    this doesn't make sense in case, because have large number of observations, require many parameters (it more sensible if had, say, 3 time points per individual)

  • you allow more complex pattern of change on time via additive model, i.e. modeling change on time cubic spline. example:

    library(mgcv) gamm(timeonfeeder ~ s(time) + ... , random = ~1|subject 

    (1) assumes temporal pattern same across subjects; (2) because gamm() uses lme rather lmer under hood have specify random effect separate argument. (you use gamm4 package, uses lmer under hood.)

  • you might want allow temporal autocorrelation. example,

    lme(timeonfeeder ~ time + ... ,     random = ~ time|subject,     correlation = corar1(form= ~time|subject) , ...) 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -