[R-sig-ME] Error in initializePtr() : updateMu: Size mismatch

Voeten, C.C. c@c@voeten @end|ng |rom hum@|e|denun|v@n|
Sat May 2 12:15:40 CEST 2020


Hi Pamela,

I assume, since you mention graphing residuals, that you want to visualize for purposes of model checking? Then I recommend mgcv’s gam.check() function. (You can ignore the part where it checks the value of k, the basis dimension, as that is not relevant for your model.)

Best,
Cesko

From: Pamela Ochungo <pamochungo using gmail.com>
Sent: Saturday, May 2, 2020 12:11 PM
To: Voeten, C.C. <c.c.voeten using hum.leidenuniv.nl>
Cc: r-sig-mixed-models using r-project.org
Subject: Re: [R-sig-ME] Error in initializePtr() : updateMu: Size mismatch

Hi Cesko,

Thanks! I see my mistake now! I have called the summary and it works perfectly well!

How would you visualize the results? Graphing residuals?

Cheers and thanks once again!

Pamela

On Sat, May 2, 2020 at 12:48 PM Voeten, C.C. <c.c.voeten using hum.leidenuniv.nl<mailto:c.c.voeten using hum.leidenuniv.nl>> wrote:
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 using gmail.com<mailto:pamochungo using gmail.com>>
Sent: Friday, May 1, 2020 10:15 PM
To: Voeten, C.C. <c.c.voeten using hum.leidenuniv.nl<mailto:c.c.voeten using hum.leidenuniv.nl>>
Cc: r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using 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 using hum.leidenuniv.nl<mailto:c.c.voeten using 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 using r-project.org<mailto:r-sig-mixed-models-bounces using r-project.org>> On Behalf Of Pamela Ochungo
Sent: Friday, May 1, 2020 9:00 PM
To: mailto:r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using 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]]

_______________________________________________
mailto:R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org> mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list