[R-sig-ME] Error fitting reduced model in bglmer for LRT

Vincent Dorie vjd4 at nyu.edu
Fri Mar 13 03:12:44 CET 2015


Apparently, something stripped symbols from the code in my email. Replace anything that says " at " with an 'at' sign.

As to tests, there is a section for that on http://glmm.wikidot.com/faq <http://glmm.wikidot.com/faq>. MCMCglmm should solve the separability issues in the data and make it straightforward to derive inferences.

> On Mar 12, 2015, at 7:39 PM, Josie Galbraith <josie.galbraith at gmail.com> wrote:
> 
> Thanks Vince.
> So should I just use the Wald-Z output instead then? Or another method of inference? Any ideas which is best in this situation?
> 
> The code for the temp fix didn't work for me (see below).  But that may not be important if I use another method of inference...
> 
> Cheers,
> Josie
> 
> > assignInNamespace("toString.bmerTDist", function(x, digits = getOption("digits"), ...) {
> +   scaleString <- ""
> +   scale <- crossprod(solve(x at R.scale.inv))
> Error: unexpected symbol in:
> "  scaleString <- ""
>   scale <- crossprod(solve(x at"
> >   
> >   if (nrow(scale) > 2) {
> +     scaleString <- paste("scale = c(", toString(round(scale[1:4], digits)), ", ...)", sep = "")
> +   } else if (nrow(scale) == 2) {
> +     scaleString <- paste("scale = c(", toString(round(scale[1:4], digits)), ")", sep = "")
> +   } else {
> +     scaleString <- paste("scale = ", toString(round(scale[1], digits)), sep = "")
> +   }
> Error in if (nrow(scale) > 2) { : argument is of length zero
> >   
> >   paste("t(df = ", x at df, ", ", scaleString,
> Error: unexpected symbol in "  paste("t(df = ", x at"
> >         ", common.scale = ", x at commonScale,
> Error: unexpected ',' in "        ", common.scale = ","
> >         ")", sep="")
> Error: unexpected ',' in "        ")","
> > }, "blme")
> Error: unexpected '}' in "}"
> > 
> 
> 
> 
> 
> 
> Date: Tue, 10 Mar 2015 13:23:22 -0400
> From: Vincent Dorie <vjd4 at nyu.edu <mailto:vjd4 at nyu.edu>>
> To: r-sig-mixed-models at r-project.org <mailto:r-sig-mixed-models at r-project.org>
> Subject: Re: [R-sig-ME] Error fitting reduced model in bglmer for LRT
> Message-ID: <9FBE19D0-EA83-4F5B-8333-0C52C18390D9 at nyu.edu <mailto:9FBE19D0-EA83-4F5B-8333-0C52C18390D9 at nyu.edu>>
> Content-Type: text/plain; charset=utf-8
> 
> I don't know what exactly anova() does for glmms, but I wouldn't recommend a likelihood ratio test to compare posterior modes unless you can be certain the data swamp the prior.
> 
> The error you experienced is a copy/paste error on my part. You can run the code below to fix it temporarily, until I can get a new release on CRAN.
> 
> assignInNamespace("toString.bmerTDist", function(x, digits = getOption("digits"), ...) {
>   scaleString <- ""
>   scale <- crossprod(solve(x at R.scale.inv))
> 
>   if (nrow(scale) > 2) {
>     scaleString <- paste("scale = c(", toString(round(scale[1:4], digits)), ", ...)", sep = "")
>   } else if (nrow(scale) == 2) {
>     scaleString <- paste("scale = c(", toString(round(scale[1:4], digits)), ")", sep = "")
>   } else {
>     scaleString <- paste("scale = ", toString(round(scale[1], digits)), sep = "")
>   }
> 
>   paste("t(df = ", x at df, ", ", scaleString,
>         ", common.scale = ", x at commonScale,
>         ")", sep="")
> }, "blme")
> 
> Vince
> 
> > On Mar 9, 2015, at 11:47 PM, Josie Galbraith <josie.galbraith at gmail.com <mailto:josie.galbraith at gmail.com>> wrote:
> >
> > Hi all,
> >
> > In following on from this post
> > <https://stat.ethz.ch/pipermail/r-sig-mixed-models/2015q1/023191.html <https://stat.ethz.ch/pipermail/r-sig-mixed-models/2015q1/023191.html>>,
> > regarding using blme and fixed effect priors to address issues of complete
> > separation in my data, I've come up against a problem trying to fit reduced
> > models for testing the model terms using likelihood ratio tests (LRT).
> >
> > Firstly, can I use LRTs (anova()) for testing the fixed effects of bglmer
> > models, as I would for glmer models?
> >
> > If yes, then I need help understanding why I'm getting the following error
> > fitting a reduced bglmer model:
> > "Error in if (nrow(cov) == 2) { : argument is of length zero"
> >
> > This is my full model:
> > SE.les.mod = bglmer (LESION ~ FOOD*SEASON +(1|SITE), data = SEYE.df, family
> > = binomial, fixef.prior = t(1,2.5), cov.prior = NULL)
> >
> > I can fit a model without the interaction term ok:
> > SE.les.add = bglmer (LESION ~ FOOD+SEASON +(1|SITE), data = SEYE.df, family
> > = binomial, fixef.prior = t(1,2.5), cov.prior = NULL)
> >
> > But I get the error message with both of the single fixed effects models:
> > SE.les.FOOD = bglmer (LESION ~ SEASON +(1|SITE), data = SEYE.df, family =
> > binomial, fixef.prior = t(1,2.5), cov.prior = NULL)
> > SE.les.SEAS = bglmer (LESION ~ FOOD +(1|SITE), data = SEYE.df, family =
> > binomial, fixef.prior = t(1,2.5), cov.prior = NULL)
> >
> > Thanks very much,
> > Josie
> >
> >
> >
> > --
> > *Josie Galbraith* MSc (hons)
> >
> > PhD candidate
> > *University of Auckland *
> > Joint Graduate School in Biodiversity and Biosecurity ? School of
> > Biological Sciences ? Tamaki Campus ? Private Bag 92019 ? Auckland 1142* ?
> > P:* 09-373 7599 ext. 83132* ? E:* josie.galbraith at gmail.com <mailto:josie.galbraith at gmail.com>* ? W: * UoA Web
> > Profile <https://unidirectory.auckland.ac.nz/profile/jgal026 <https://unidirectory.auckland.ac.nz/profile/jgal026>> and
> > *www.birdfeedingnz.weebly.com/* <http://www.birdfeedingnz.weebly.com/*> <http://birdfeedingnz.weebly.com/ <http://birdfeedingnz.weebly.com/>>
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org <mailto:R-sig-mixed-models at r-project.org> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models <https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
> 
> 
> 
> -- 
> Josie Galbraith MSc (hons)
> 
> PhD candidate
> University of Auckland 
> Joint Graduate School in Biodiversity and Biosecurity ● School of Biological Sciences ● Tamaki Campus ● Private Bag 92019 ● Auckland 1142 ● P: 09-373 7599 ext. 83132 ● E: josie.galbraith at gmail.com <mailto:josie.galbraith at gmail.com> ● W:  UoA Web Profile <https://unidirectory.auckland.ac.nz/profile/jgal026> and www.birdfeedingnz.weebly.com/ <http://birdfeedingnz.weebly.com/>
> 
> 


	[[alternative HTML version deleted]]



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