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

Vincent Dorie vjd4 at nyu.edu
Tue Mar 10 18:23:22 CET 2015


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> wrote:
> 
> Hi all,
> 
> In following on from this post
> <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* ● W: * UoA Web
> Profile <https://unidirectory.auckland.ac.nz/profile/jgal026> and
> *www.birdfeedingnz.weebly.com/* <http://birdfeedingnz.weebly.com/>
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> 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