Hi Pamela,
Re gam(): it looks like you merely didn't call summary() on your fitted
model object?
Re separate models: whether or not this is appropriate depends entirely on
your data and what you want to do with them. If you want to compare the
different dependent variables to one another, or if you want to assume that
there is correlation between them, then you need a multivariate model. But
if the different dependent variables represent wholly separate measures and
they are uncorrelated (or your substantive question permits you to leave
such correlation out of the analysis), then I see no problem with running
separate models instead.
Best,
Cesko
From: Pamela Ochungo <pamochungo at gmail.com>
Sent: Friday, May 1, 2020 10:15 PM
To: Voeten, C.C. <c.c.voeten at hum.leidenuniv.nl>
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] Error in initializePtr() : updateMu: Size mismatch
Hi Cesko,
Thanks for your reply! I have tried the second option, function gam() from
mgcv. However I get an unexpected result as below:
Family: Multivariate normal
Link function:
Formula:
transpopbees ~ Varroa + s(Site, bs = "re") + s(Colony,
bs = "re")
transbrood ~ Varroa + s(Site, bs = "re") + s(Colony, bs = "re")
transhoney ~ Varroa + s(Site, bs = "re") + s(Colony, bs = "re")
transpollen ~ Varroa + s(Site, bs = "re") + s(Colony, bs = "re")
transeggs ~ Varroa + s(Site, bs = "re") + s(Colony, bs = "re")
Estimated degrees of freedom:
0.0001 0.7631 0.0000 0.0003 1.7061 0.0003 1.7192
0.0002 0.0000 0.0003 total = 29.19
REML score: 547.659
How do I interpret this? I was rather hoping to get a result showing model
coefficients and p-values for each dependent variable.
Question: Is it acceptable to carry out LMM (lmer) for each of the 5
dependent variables separately against Varroa?
Cheers
Pamela
On Fri, May 1, 2020 at 10:25 PM Voeten, C.C. <mailto:
c.c.voeten at hum.leidenuniv.nl> wrote:
Hi Pamela,
lmer/glmer do not support models with multiple dependent variables via the
cbind() syntax. An alternative approach is to convert your data to long
format and run the model in the following way:
value ~ 0+variable/Varroa + (0+variable|Site) + (0+variable|Colony)
with 'variable' the column containing "transpopbees", "transbrood", ...,
and 'value' the column containing their values.
Alternatively, function gam() from package mgcv can fit your model. You
would then use something like:
gam(list(transpopbees ~ Varroa + s(Site,bs='re') + s(Colony,bs='re'),
transbrood ~ Varroa + s(Site,bs='re') + s(Colony,bs='re'),
.....),family=mvn(5),data=pollencolony)
Hope this helps,
Cesko
-----Original Message-----
From: R-sig-mixed-models <mailto:r-sig-mixed-models-bounces at r-project.org>
On Behalf Of Pamela Ochungo
Sent: Friday, May 1, 2020 9:00 PM
To: mailto:r-sig-mixed-models at r-project.org
Subject: [R-sig-ME] Error in initializePtr() : updateMu: Size mismatch
Hallo,
I want to run a linear mixed model featuring 5 response variables and only
one predictor variable. I also have two random effects in the model. I am
using this code:
lm1 <- lmer(cbind(transpopbees, transbrood, transhoney, transpollen,
transeggs) ~ Varroa+(1|Site)+(1|Colony),data=pollencolony)
However I get this error message:
Error in initializePtr() : updateMu: Size mismatch
What does this mean and what am I doing wrong?
Thanks
[[alternative HTML version deleted]]