# Within-individual correlations at different scales

Hi everyone,

I collected behavior data on bighorn sheep for four consecutive summers. Within each summer I collected 3-6 observations of two distinct behaviors on each individual. Individuals where followed for one to the full four years of study, with most being followed for at least three years.

I would like to answer the research question: Is there strong within-individual correlations between the two behaviors at the year level (i.e. correlated individual behavioral plasticity at the year level)? For example, if behavior1 of an individual generally increases between year1 and year2, can we expect a similar increase in behavior2 of the same individual?

From what I understand, within-individual correlations can be estimated with a multivariate brms formula with perfectly paired data by adding `set_rescor(T)`. However, I can not add this term because my measurements of the different behaviors where not necessarily measured at the same time and I have slightly more observations of behavior2 than behavior1. This would also have the additional drawback of evaluating the residual correlations of all observations within individuals whereas I would like to evaluate the correlations at the individual-year level.
I thus had to arrange my data in the long format as suggested in this post) and my current model is the following:

``````bform = bf(behavior1 | subset(outcome2) ~ timeHour + sex + lactation + groupsize + vigMean
+ stepsMean + VegCover + stepsMean*VegCover +
(1|FocalEvent) + (1|p|id) + (1|observer)) +
bf(behavior2 | subset(outcome1) ~ timeHour + poly(YearlyDiff,2) + sex + lactation +
+ groupsize +
(1|FocalEvent) + (1|p|id) + (1|observer)) +
set_rescor(F)
multivar = brm(bform, family=gaussian(), data=multi, iter=10000, cores = 4)
``````

This model estimates among-individual correlations with `(1|p|id)`, but not within-individual correlations ` set_rescor(F)`. I have a hunch that within-individual correlations could be estimated at the individual-year level in brms by specifying a nested random effect of id within year (like `(1|year/id)`) or replacing the id random intercept for a random intercept of an individual-year variable (like `(1|IDyear)`). I could then possibly extract the estimated id-year intercepts of the two behaviors and estimate the correlation between them. I think this is correct because despite the data being unpaired, if I have measurements of behavior1 on an individual in a given year, I necessarily also have measurements of behavior2 on the same individual in the same year. I am very confused as to whether this line of thinking is correct or not. If possible, how exactly could I model within-individual correlations of the behaviors at the year level?

Thank you for you thoughts!

Just a quick comment from me, but wouldnâ€™t it be possible to model both behaviours with a random intercept for ID and a random slope for year for ID (i.e. each individual has an estimate of how they change across years), and then package those random effects into a covariance matrix? Then you would have the correlation between each individualâ€™s personality and plasticity estimates for each behaviour across years.

Also, it seems odd to model behaviour as a Gaussian variable. Not sure what your behaviours are, but usually you are modelling a count or latency etc. The above approach would be suitable for different likelihoods.

1 Like

Sorry for the late answer, but thank you. This has helped very much!