[R-sig-ME] FW: Trouble looping model using glmmTMB
Bill Poling
Bill.Poling at zelis.com
Mon Apr 30 19:13:53 CEST 2018
Message-ID:CAOJBL42qdVortWMi2xVdqv=4MHUT8zbiOPbU3Y+UxBSjkiAY0Q at mail.<mailto:CAOJBL42qdVortWMi2xVdqv=4MHUT8zbiOPbU3Y+UxBSjkiAY0Q at mail.%0b>gmail.com<http://gmail.com>
Hi, I have been following this string as I try to learn how to bootstrap using R.
I am an R novice and this is my first post.
I believe I am complying with the rules as I understand them.
My question pertains to deriving confidence interval(s) from the bootstrap output.
I ran the bbolker script From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of Ben Bolker, Sent: Sunday, April 08, 2018 2:22 PM on this topic
Therefore I have the 100:
[,1] [,2] [,3] [,4]
[1,] 1.674036 1.103844 -1.558970 0.20640989
[2,] 1.626733 1.116971 -1.683252 0.09869567
[3,] 1.623758 1.173316 -1.669386 0.21515432
[4,] 1.690359 1.141988 -1.729407 0.17972799
[5,] 1.679417 1.146139 -1.425824 0.19958387
etc…..
AND the bootfit model:
bootfit
# Formula: y ~ x + (1 | f)
# Zero inflation: ~1
# Data: bootsamp()
# AIC BIC logLik df.resid
# 13101.717 13130.980 -6545.859 2567
# Random-effects (co)variances:
#
# Conditional model:
# Groups Name Std.Dev.
# f (Intercept) 1.499
#
# Number of obs: 2572 / Conditional model: f, 102
#
# Overdispersion parameter for nbinom2 family (): 1.17
#
# Fixed Effects:
#
# Conditional model:
# (Intercept) x
# 1.578 1.103
#
# Zero-inflation model:
# (Intercept)
# -1.657
I have reviewed the confint help and performed the examples: (mtcars and the glm counts).
However, I am not sure how to apply the confint() function on this bootstrap output.
Please advise.
Thank you.
WHP
William H. Poling, Ph.D., MPH
From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of Viraj Torsekar
Sent: Monday, April 09, 2018 7:40 AM
To: Houslay, Tom <T.Houslay at exeter.ac.uk>
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] Trouble looping model using glmmTMB
Thanks so much for the suggestion Tom. Yes I was analysing calling effort
for males, and movement for both males and females in that manner. But I
was running separate models for each. I'll have a look at these conditional
two-part models.
Viraj
On 9 April 2018 at 15:50, Houslay, Tom <T.Houslay at exeter.ac.uk<mailto:T.Houslay at exeter.ac.uk>> wrote:
> Hi Viraj,
>
>
> This isn't a direct answer to your question so you can feel extremely free
> to ignore it(!), but your question reminded me of an approach I took to
> modelling calling effort in crickets using zero-altered poisson models in
> Jarrod's MCMCglmm package. In that case I had a few more predictor
> variables, but it meant the question could be phrased as two parts: what
> factors affect whether a male called or not, and - given he did call - what
> factors affect how much time he spent calling? It seems that that might be
> another option for you to model the movement with your crickets, although
> obviously it depends whether you think that would give you anything more
> valuable than your current approach (eg, is the decision to move something
> worth modelling separately from how far the cricket travels).
>
>
> Anyway - my paper including this analysis is at http://doi.wiley.com/10<http://doi.wiley.com/10>.
> 1111/1365-2435.12766 in case it's of any interest.
>
>
> Cheers
>
>
> Tom
>
> ----
>
> Message: 1
> Date: Sun, 8 Apr 2018 19:57:53 +0530
> From: Viraj Torsekar <viraj.torsekar at gmail.com<mailto:viraj.torsekar at gmail.com>>
> To: r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org>
> Subject: [R-sig-ME] Trouble looping model using glmmTMB
> Message-ID:
> <CAOJBL42qdVortWMi2xVdqv=4MHUT8zbiOPbU3Y+UxBSjkiAY0Q at mail.
<mailto:CAOJBL42qdVortWMi2xVdqv=4MHUT8zbiOPbU3Y+UxBSjkiAY0Q at mail.%0b>> gmail.com<http://gmail.com>>
> Content-Type: text/plain; charset="utf-8"
>
>
> Hello all,
>
> I'm trying to find out if distance moved by crickets is a function of
> predation risk. My response variable is 'distance moved' and the predictor
> is probability of spatial proximity with predator, ranging from 0 to 1. The
> response variable is zero-inflated (about 77% values are zeroes) and its
> variance is far higher than its mean. Hence, I tried running zero-inflated
> negative binomial mixed models using glmmADMB, which failed (mixed because
> I have multiple values per individual). Following was the error I kept
> encountering: "function maximizer failed" (attaching a text file with
> details of this model by keeping debug=TRUE).
>
> Hence, I shifted to glmmTMB (version: 0.2.0), on Dr. Bolker's advice, and
> it worked! But the problem is, when I try bootstrapping the model using to
> obtain confidence intervals, I keep getting the following error after
> varying number of runs: 'Error in optimHess(par.fixed, obj$fn, obj$gr):
> gradient in optim evaluated to length 1 not 5'. This non-parametric
> bootstrapping routine involves for loops in which the model is run using
> bootstrapped groups (belonging to the grouping variable; individual.id<http://individual.id> in
> my case) and the model coefficients thus obtained constitute the confidence
> intervals. I've tried running 10,000 iterations, but the error pops up
> within 10 to 100 runs.
>
> Does anyone have suggestions regarding what can be changed?
>
> Details of the model run singly and not in the loop:
>
> Family: nbinom2 ( log )
> Formula: movement.whole ~ poc + (1 | female.id<http://female.id>)
> Zero inflation: ~1
> Data: incrisk_females_comm
>
> AIC BIC logLik deviance df.resid
> 1725.1 1745.9 -857.5 1715.1 474
>
> Random effects:
>
> Conditional model:
> Groups Name Variance Std.Dev<http://Std.Dev>.
> female.id<http://female.id> (Intercept) 0.07924 0.2815
> Number of obs: 479, groups: female.id<http://female.id>, 110
>
> Overdispersion parameter for nbinom2 family (): 1.59
>
> Conditional model:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) 4.66384 0.14161 32.93 <2e-16 ***
> poc -0.08815 0.20978 -0.42 0.674
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Zero-inflation model:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) 1.2442 0.1098 11.34 <2e-16 ***
>
> Please do mention if you need further details. Thank you in advance.
>
> Viraj Torsekar,
> PhD Candidate,
> Centre for Ecological Sciences,
> Indian Institute of Science
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------
>
> End of R-sig-mixed-models Digest, Vol 136, Issue 19
> ***************************************************
>
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models at r-project.org<mailto:R-sig-mixed-models at r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models<https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
Confidentiality Notice This message is sent from Zelis. This transmission may contain information which is privileged and confidential and is intended for the personal and confidential use of the named recipient only. Such information may be protected by applicable State and Federal laws from this disclosure or unauthorized use. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any disclosure, review, discussion, copying, or taking any action in reliance on the contents of this transmission is strictly prohibited. If you have received this transmission in error, please contact the sender immediately. Zelis, 2018.
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list