Skip to content

NaN output from mcse on a glmm model

4 messages · Adriaan De Jong, Ben Bolker, David Duffy

#
Dear list members,
I ran the following glmm on the attached data file, guided by Christina Knudson's "An introduction to Model-Fitting with the R package glmm, 11th of December 2018. (Fresh R download and all packages recently updated. I'm aware of the fact that the cluster part of the script I redundant)
Everything appears to work fine, but when I try to extract the Monte Carlo standard errors with mcse I only receive NaN's for each of the parameters in the model.
The example in Christina Knudson's text uses Bernoulli data, while I use count data (Poisson). Is that the cause of the NaN's?
Grateful for any explanation or suggestion. Thanks in advance.
Have a nice weekend,
Adjan

Adriaan "Adjan" de Jong
Senior researcher
Dept. of Wildlife, Fish, and Environmental Studies
Swedish University of Agricultural Sciences

set.seed(2019)
clust<-makeCluster(2)
mm01<-glmm(Arter ~ Status, random=list(~0+Site), varcomps.names=c("Site"), data=ArterVis, family.glmm=poisson.glmm, m=10000, cluster=clust)
stopCluster(clust)
summary(mm01)
coef(mm01)
confint(mm01)
mcse(mm01)
se(mm01)


---
N?r du skickar e-post till SLU s? inneb?r detta att SLU behandlar dina personuppgifter. F?r att l?sa mer om hur detta g?r till, klicka h?r <https://www.slu.se/om-slu/kontakta-slu/personuppgifter/>
E-mailing SLU will result in SLU processing your personal data. For more information on how this is done, click here <https://www.slu.se/en/about-slu/contact-slu/personal-data/>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Arter 2002-2015 Visits Impact Short.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20190201/3c92833f/attachment-0001.txt>
#
I can confirm this on my system. I looked and nothing obviously
fishy pops out about the model or the data. Inside the mcvcov()
function, after calling the C-code guts of the computation, stuff[[4]]
(the "numsum" component of the list passed to the C code) is full of
Inf and NaN values.  If I were you I'd (1) try a couple of very simple
examples, one with bernoulli and one with poisson data, to support
your idea that there's something wrong with the Poisson case; (2) look
around for examples of people using the package, e.g.
<https://scholar.google.ca/scholar?hl=en&as_sdt=0%2C5&q=knudson+glmm&btnG=>,
and see if there are Poisson examples; (3) contact the maintainer ...
On Fri, Feb 1, 2019 at 8:49 AM Adriaan De Jong <Adriaan.de.Jong at slu.se> wrote:
#
I ran it as a single instance ie no makeCluster(), with m=100, and it seems OK

Fixed Effects:
                   Estimate Std. Error z value Pr(>|z|)    
(Intercept)         3.48177    0.02022 172.180   <2e-16 ***
StatusConstruction  0.01733    0.02357   0.735   0.4621    
StatusReady         0.04639    0.02258   2.054   0.0399 *  
StatusTrafic        0.02267    0.02192   1.034   0.3010    

Variance Components for Random Effects (P-values are one-tailed):
     Estimate Std. Error z value Pr(>|z|)/2   
Site  0.06095    0.02419    2.52    0.00587 **

With glmer VC is 0.06088, and with another MCMC package, 0.066, SE=0.028

So maybe the clustering code?

Cheers, David Duffy.
#
Dear Ben, Dear David,
Thanks for your information and suggestions.
I removed the cluster part of the script, but the mcse function continues to produce NaN's only. I'll continue along the steps suggested by Ben and report.
The mcse evaluation is important because I have no a priori information about the required number of iterations. If I cannot find my way around the mcse function problem, I may just rerun the script a couple of times with increasing m to see how things develop. If the estimates remain stable, I may choose to trust the highest level iterations. The fact that David's output for m=100 is very similar to mine with m=10000 is reassuring.
Cheers,
Adjan

-----Original Message-----
From: David Duffy [mailto:David.Duffy at qimrberghofer.edu.au]
Sent: den 2 februari 2019 00:42
To: Ben Bolker <bbolker at gmail.com>; Adriaan De Jong <Adriaan.de.Jong at slu.se>
Cc: R-sig-mixed-models at r-project.org
Subject: RE: [R-sig-ME] NaN output from mcse on a glmm model

I ran it as a single instance ie no makeCluster(), with m=100, and it seems OK

Fixed Effects:
                   Estimate Std. Error z value Pr(>|z|)
(Intercept)         3.48177    0.02022 172.180   <2e-16 ***
StatusConstruction  0.01733    0.02357   0.735   0.4621
StatusReady         0.04639    0.02258   2.054   0.0399 *
StatusTrafic        0.02267    0.02192   1.034   0.3010

Variance Components for Random Effects (P-values are one-tailed):
     Estimate Std. Error z value Pr(>|z|)/2
Site  0.06095    0.02419    2.52    0.00587 **

With glmer VC is 0.06088, and with another MCMC package, 0.066, SE=0.028

So maybe the clustering code?

Cheers, David Duffy.