[R-sig-ME] Is there a way to deal with errors such as this?

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Sun Dec 15 02:20:25 CET 2019


By "this" I mean as demonstrated in the following code.  The file 
testData.txt is attached.

X <- dget("testData.txt")
library(lme4)
fit <- glmer(cbind(Dead,Alive) ~ (0+Trt)/Dose + (Dose | Rep),
              data=X,family=binomial(link="probit"))

The foregoing falls over with the (rather complex) error message:

> Error in pwrssUpdate(pp, resp, tol = tolPwrss, GQmat = GHrule(0L), compDev = compDev,  : 
>   (maxstephalfit) PIRLS step-halvings failed to reduce deviance in pwrssUpdate

I note that mixed_model() from GLMMadaptive seems to be able to deal 
with these data and this model:

library(GLMMadaptive)
fit <- mixed_model(fixed=cbind(Dead,Alive) ~ (0+Trt)/Dose,
                    random=~Dose | Rep,
                    data=X,family=binomial(link="probit"))

The foregoing runs without complaint.

I am applying the glmer() model in the context of doing some fairly 
elaborate simulations (in which "X" gets randomly generated) and the 
error causes the simulations to crash unpleasantly.  So I would *like* a 
magic incantation that I can apply in an automated way to prevent the
error from occurring.

I can of course wrap function calls up in try() and if there is an error
generate a new data set and go again.  However I'm a little apprehensive
that this might bias the results of the simulations in some way.

I could also switch to using mixed_model(), but would prefer to stick 
with the devil I know (i.e. glmer()) for the sake of consistency with 
other work that I have done.  (And who knows?  Maybe in the course of 
the simulations mixed_model() might fall over too, from time to time.)

I'd appreciate any avuncular (or materteral) advice that anyone might be 
inclined to offer.

cheers,

Rolf

-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testData.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20191215/13ee55d5/attachment.txt>


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