2
$\begingroup$

I have behavioural observation data on subjects (individuals) on which I did two kinds of tests. One test measured subjects' latency to feed and the second test measured their aggressive interactions. Now I would like to check whether there is a relationship between a subject's latency to feed and its aggressive interactions. As the data is not independent, I would need a statistical test to keep this into account. I was told to try a GLM with latency to feed as a fixed factor and observation/subjectID as random intercept. I was asked to try using the lmer command in the lme4 package of R. Now I am not sure if this would be a good way to do it, or if it is better to do a repeated measures Anova?

$\endgroup$
1
$\begingroup$

In principle you should be able to do this by 'stacking' an individual's data, e.g. creating data like

indiv treatment covar     response_type value
1     A         27.5      latency       1.1
1     (same)    (same)    aggression    7.5
2     B         31.1      latency       1.4
2     B         (same)    aggression    8.1
...

Then fit a model with indiv as a random effect, e.g.

lmer(value~response_type:(treatment*indiv_cov)+(response_type|indiv),
     data=stacked_data)

Since lme4 fits an unstructured/full variance-covariance matrix by default, the summary() or VarCorr() output will give you the among-individual correlation between latency and aggression.

MCMCglmm can do this sort of model too, even more flexibly (e.g., multi-type models where each outcome has a different distribution family are allowed).

The reshape2 and tidyr packages are useful for stacking your data.

This rpubs document discusses this issue further.

Repeated measures might work, too, but mixed models are more flexible (easier to include additional covariates on different levels, additional blocking factors, individuals with missing values for one response type ...)

$\endgroup$
  • $\begingroup$ I fear the OP describes a situation without treatment intervention. $\endgroup$ – Michael M Sep 1 '15 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.