[R-sig-ME] Bug in afex, pbkrtest or lme4 in parametric bootstrapping?

Tom Wenseleers Tom.Wenseleers at bio.kuleuven.be
Wed Aug 21 21:05:07 CEST 2013


Dear Henrik,
Many thanks for this fast response!
The other error I mentioned apparently was due to me having afex_0.6-77 installed, or loading it after lme4 (I think that masked lme4's refit), with afex_0.5-71 being loaded first it did what you describe.

But when I then try what you suggest
t1 <-
+     mixed(ALATES~ANT_TENDED*MELEZITOSE+NR_START+(1|CLONES)+(1|PLANT)+(1|REPLICATE),
+           type=3, family=poisson,method="LRT",data=data_alates)
I get
Error in mixed(ALATES ~ ANT_TENDED * MELEZITOSE + NR_START + (1 | CLONES) +  : 
  Only methods "KR" or "PB" currently implemented.

Any thoughts?

Cheers,
Tom

-----Original Message-----
From: Henrik Singmann [mailto:henrik.singmann at psychologie.uni-freiburg.de] 
Sent: 21 August 2013 20:19
To: Tom Wenseleers; sorenh at mail.dk; Ben Bolker (bbolker at gmail.com); r-sig-mixed-models at r-project.org
Subject: Re: Bug in afex, pbkrtest or lme4 in parametric bootstrapping?

Hi Tom,

I cannot replicate the exact error message ('unable to find an inherited method for function 'refit' for signature '"glmerMod"') as this is an error message from previous versions of pbkrtest (it still happened with pbkrtest_0.3-5).

However, there seem to be a different issue with the data, when I run I constantly get:
Error: pwrssUpdate did not converge in 30 iterations

(and occasionally a warning: In pwrssUpdate(pp, resp, tolPwrss, GQmat, compDev, fac, verbose) :
Cholmod warning 'not positive definite' at file:../Cholesky/t_cholmod_rowfac.c, line 431)

The error message seems to hint that "the bootstrap samples failed to converge. This is a common situation, as it is just a special case of the general fact that not all glmer models are guaranteed to converge." 
(http://thread.gmane.org/gmane.comp.lang.r.lme4.devel/10440/focus=10441)

That means, you could simply try many times, until you find a solution that converges. For this to work you could try something like:

# calculate the models only and noparametric bootstrap:
t1 <-
mixed(ALATES~ANT_TENDED*MELEZITOSE+NR_START+(1|CLONES)+(1|PLANT)+(1|REPLICATE),
type=3, family=poisson,method="LRT",data=data_alates)

# use PBmodcomp on it's own, until it works:
PBmodcomp(t1[[2]], t1[[3]][[1]], nsim = 10) PBmodcomp(t1[[2]], t1[[3]][[2]], nsim = 10) # and so forth

The order of models in t1 is the same as in the response table (here only using LRTs):
t1
## Effect df.large df.small chisq df p
## 1 (Intercept) 8 7 0.18 1 0.6744
## 2 ANT_TENDED 8 7 2.59 1 0.1074
## 3 MELEZITOSE 8 7 0.78 1 0.3783
## 4 NR_START 8 7 0.89 1 0.3444
## 5 ANT_TENDED:MELEZITOSE 8 7 0.68 1 0.4108

Alternatively, you could wait for Søren and/or Ben to come up with a solution that tries longer or just live with the likelihood ratio test p-values.

Cheers,
Henrik


Tom Wenseleers schrieb:
>
> Dear all,
>
> I was just trying to use parametric bootstrapping to calculate 
> significance levels in a Poisson mixed model using afex/pbkrtest.
> Using the data in attachment and the code
>
> data_alates=read.csv("alates_raw_FINAL3.csv", header=TRUE, fill=TRUE)
>
> mixed(ALATES~ANT_TENDED*MELEZITOSE+NR_START+(1|CLONES)+(1|PLANT)+(1|RE
> PLICATE),type=3,family=poisson,method="PB",args.test
> = list(nsim = 10),data=data_alates)
>
> I get the following error message though:
>
> Fitting 6 lmer() models:
>
> [......]
>
> Obtaining 5 p-values:
>
> [
>
> Error in (function (classes, fdef, mtable) :
>
> unable to find an inherited method for function 'refit' for signature 
> '"glmerMod"'
>
> In addition: Warning message:
>
> In mixed(ALATES ~ ANT_TENDED * MELEZITOSE + NR_START + (1 | CLONES) + :
>
> Numerical variables NOT centered on 0 (i.e., likely bogus results if 
> in interactions): NR_START
>
> Any thoughts perhaps what might be wrong, and what workaround I could 
> perhaps use to make this work?
>
> Cheers,
>
> Tom
>
> PS I was using the following package versions:
>
> sessionInfo()
> R version 3.0.0 (2013-04-03)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>   
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252
>   
> attached base packages:
>   [1] grid      stats4    splines   parallel  stats     graphics  grDevices utils     datasets  methods   base
>   
> other attached packages:
>   [1] lsmeans_1.10-00   plyr_1.8          effects_2.2-4     colorspace_1.2-2  nlme_3.1-109*afex_0.6-77*        stringr_0.6.2     reshape2_1.2.2
>   [9] car_2.0-16        nnet_7.3-6        coin_1.0-22       modeltools_0.2-19 mvtnorm_0.9-9994  survival_2.37-4*pbkrtest_0.3-5.1*   *lme4_1.1-0*        
> [17] Matrix_1.0-12     lattice_0.20-15   glmmADMB_0.7.7    R2admb_0.7.5.3    MASS_7.3-26       devtools_1.2
>   
> loaded via a namespace (and not attached):
> [1] digest_0.6.3    evaluate_0.4.3  httr_0.2        memoise_0.1     minqa_1.2.1     multcomp_1.2-18 RCurl_1.95-4.1  tools_3.0.0     whisker_0.3-2
>

--
Dipl. Psych. Henrik Singmann
PhD Student
Albert-Ludwigs-Universität Freiburg, Germany http://www.psychologie.uni-freiburg.de/Members/singmann



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