[R-sig-ME] monitoring convergence in gamm4 (with the new lmer-1.0-4 modular functionality)

Steve Walker steve.walker at utoronto.ca
Wed Sep 25 21:14:07 CEST 2013


Hi again Damian,

Here is an (admittedly ugly) workaround...until this issue gets properly 
fixed:

library(gamm4)
dat <- gamSim(1,n=600,dist="binary",scale=.33)
trace(gamm4, quote(browser()), at = 53)
lr.fit0 <- gamm4(y~s(x0)+s(x1)+s(x2),
                  family=binomial,data=dat,
                  verbose=1L)
devfun <- do.call(mkGlmerDevfun, b)
opt <- optimizeGlmer(devfun, ...)
devfun <- updateGlmerDevfun(devfun, b$reTrms) # remove ...
opt <- optimizeGlmer(devfun, stage = 2, ...)


For anyone who is interested, I think the problem is that `gamm4` calls 
`updateGlmerDevfun` with a `...` argument:

https://github.com/lme4/lme4/issues/135#issuecomment-25114347

Steve

On 2013-09-25 2:31 PM, Steve Walker wrote:
> Hi Damian,
>
> I'm pretty sure you've found a bug, which I've reported here:
>
> https://github.com/lme4/lme4/issues/135
>
> Steve
>
> On 2013-09-25 3:30 AM, damian.collins at dpi.nsw.gov.au wrote:
>> Dear all,
>>
>> Can someone tell me how I can monitor the convergence of a gamm4 run
>> using the new lmer-1.04 modular functions and the iprint or verbose
>> arguments?
>> (I wish to debug a warning message re: "failure to converge in 10,000
>> iterations".)
>>
>> In the past, I successfully used "options(verbose=T)" to turn on
>> monitoring. But now that option appears to have no effect.
>>
>> After examining the documentation/code for gamm4,
>> glFormula/updateGlmerDevfun, lmerControl and Nelder_Mead, I tried
>> (using the example from gamm4 helpfile):
>>
>> lr.fit0 <- gamm4(y~s(x0)+s(x1)+s(x2), family=binomial, data=dat,
>> control=lmerControl(optCtrl=list(iprint=20)))
>>
>> and got an error:
>>
>> Error in updateGlmerDevfun(devfun, b$reTrms, ...) :
>>    unused argument (control = list(optimizer = "Nelder_Mead",
>> restart_edge = TRUE, checkControl = list(check.nobs.vs.rankZ =
>> "warningSmall", check.nobs.vs.nlev = "stop", check.nlev.gtreq.5 =
>> "ignore", check.nlev.gtr.1 = "stop"), optCtrl = list(iprint = 20)))
>> In addition: Warning message:
>> In (function (npt = min(n + 2L, 2L * n), rhobeg = NA, rhoend = NA,  :
>>    unused control arguments ignored
>>
>> Similar attempts, using more or less nesting in the control= option,
>> led to similar error messages.
>>
>> I am using R-3.0.1, mgcv 1.7-26, gamm4 0.2-1, lmer 1.04, Matrix 1.0-12
>> on a Fedora 18 x64 laptop.
>>
>> Transcript copied/pasted below
>>
>> Damian Collins | Biometrician | Primary Industries
>> Industry & Investment NSW | Elizabeth Macarthur Agricultural Institute
>> | Woodbridge Rd, Menangle NSW 2568 | Private Bag 4008, NARELLAN NSW 2567
>> T: 02 4640 6451 | F: 02 4640 6300 | M: 0410 271 144 |  E:
>> damian.collins at industry.nsw.gov.au
>>
>>
>>
>> ----- Transcript (non-essential lines removed ...)  - run on Fedora 18
>> x64 machine  -----
>>
>> R version 3.0.1 (2013-05-16) -- "Good Sport"
>> Copyright (C) 2013 The R Foundation for Statistical Computing
>> Platform: x86_64-redhat-linux-gnu (64-bit)
>> ...
>>>> assignInNamespace(".help.ESS", help, ns=asNamespace("base"))
>>> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient',
>>> show.error.locations=TRUE)
>>> library(gamm4)
>> Loading required package: Matrix
>> Loading required package: lattice
>> Loading required package: lme4
>> Loading required package: mgcv
>> Loading required package: nlme
>>
>> Attaching package: ‘nlme’
>>
>> The following object is masked from ‘package:lme4’:
>>
>>      lmList
>>
>> This is mgcv 1.7-26. For overview type 'help("mgcv-package")'.
>> This is gamm4 0.2-1
>>> dat <- gamSim(1,n=600,dist="binary",scale=.33)
>> Gu & Wahba 4 term additive model
>>> lr.fit0 <- gamm4(y~s(x0)+s(x1)+s(x2),family=binomial,data=dat)
>>> options(verbose=T)
>>> lr.fit0 <- gamm4(y~s(x0)+s(x1)+s(x2),family=binomial,data=dat)
>>> lr.fit0 <- gamm4(y~s(x0)+s(x1)+s(x2),family=binomial,data=dat,control
>> =lmerControl(optCtrl=list(iprint=20)))
>> Error in updateGlmerDevfun(devfun, b$reTrms, ...) :
>>    unused argument (control = list(optimizer = "Nelder_Mead",
>> restart_edge = TRUE, checkControl = list(check.nobs.vs.rankZ =
>> "warningSmall", check.nobs.vs.nlev = "stop", check.nlev.gtreq.5 =
>> "ignore", check.nlev.gtr.1 = "stop"), optCtrl = list(iprint = 20)))
>> In addition: Warning message:
>> In (function (npt = min(n + 2L, 2L * n), rhobeg = NA, rhoend = NA,  :
>>    unused control arguments ignored
>>> packageDescription("lme4",fields=c("Version","Date"))
>> Version: 1.0-4
>> Date: 2013-09-08
>>> packageDescription("Matrix",fields=c("Version","Date"))
>> Version: 1.0-12
>> Date: 2013-03-26
>>> packageDescription("nlme",fields=c("Version","Date"))
>> Version: 3.1-109
>> Date: 2013-03-21
>>> sessionInfo()
>> R version 3.0.1 (2013-05-16)
>> Platform: x86_64-redhat-linux-gnu (64-bit)
>>
>> locale:
>>   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>   [7] LC_PAPER=C                 LC_NAME=C
>>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] gamm4_0.2-1     mgcv_1.7-26     nlme_3.1-109    lme4_1.0-4
>>
>> [5] Matrix_1.0-12   lattice_0.20-15
>>
>> loaded via a namespace (and not attached):
>> [1] compiler_3.0.1 grid_3.0.1     MASS_7.3-26    minqa_1.2.1
>> Rcpp_0.10.4
>> [6] splines_3.0.1  tools_3.0.1
>>
>> This message is intended for the addressee named and may...{{dropped:8}}
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>
> _______________________________________________
> 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