[R-sig-ME] Random intercept/slopes on two correlated outcomes
Theodore Lytras
thlytras at gmail.com
Wed Feb 1 10:39:58 CET 2017
Dear Thierry,
Thank you, this helps indeed.
However, are you sure that this models the random slopes (age | id) as well?
I tried it on my data, I indeed get very similar results as with the two
separate models, both for the fixed and for the random part.
For the random part, I got:
Random effects:
Groups Name Variance Std.Dev. Corr
id traitY1 0.56144 0.7493
traitY2 0.93665 0.9678 0.98
Residual 0.06432 0.2536
The variances for traitY1 and traitY2 are very close to the random intercept
variances for the two separate models. But where are the variances for the
random slopes??
Also, the 0.98 above, is it the correlation between the outcomes? Or should I
look at the "Correlation of Fixed Effects" part in the summary() output, where
the correlation between traitY1 and traitY2 is reported as 0.925 ??
A minor detail: the first "trait" in your formula, the one after the 0, isn't
it redundant? [ Y ~ 0 + trait + trait * (age+X) + (0+trait|id) ]
Thank you again,
Theodore
Στις Τετάρτη, 1 Φεβρουαρίου 2017 9:49:58 Π.Μ. EET Thierry Onkelinx έγραψε:
> Dear Theodore,
>
> You can do this is you convert the dataset into long format.
>
> untested
>
> library(lme4)
> library(tidyr)
> long <- gather(dat, key = "trait", value = "Y", Y1, Y2)
> lmer(Y ~ 0 + trait + trait * (age + X) + (0 + trait | id), data = long)
>
> Best regards,
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> 2017-02-01 9:37 GMT+01:00 Theodore Lytras <thlytras at gmail.com>:
> > Hi all,
> >
> > I have repeated measures on individuals, and I'm fitting two LMMs with
> > random
> > intercepts and slopes per participant, on two outcomes (Y1, Y2) as
> > follows:
> >
> > library(lme4)
> > m1 <- lmer(Y1 ~ age + X + (age | id), data=dat)
> > m2 <- lmer(Y2 ~ age + X + (age | id), data=dat)
> >
> > Fixed covariates for the two outcomes are the same, and id = participant
> > ID.
> >
> > However, my two continuous outcomes Y1 and Y2 are correlated (highly),
> > thus I
> > would like to jointly model them (including estimating their correlation).
> >
> > What is the appropriate way to do so in this case? Can lme4 do it, or do I
> > have to resort to MCMCglmm or JAGS? Could someone point me in the right
> > direction (for either lme4, MCMCglmm or JAGS), including any helpful
> > papers,
> > guides, etc ??
> >
> > Thank you,
> >
> > Theodore Lytras
> >
> > Epidemiologist, PhD student
> > Hellenic Centre for Disease Control and Prevention
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list