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> 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. 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> To: r-sig-mixed-models at r-project.org Subject: [R-sig-ME] Trouble looping model using glmmTMB Message-ID: <CAOJBL42qdVortWMi2xVdqv=4MHUT8zbiOPbU3Y+UxBSjkiAY0Q at mail. 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 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) 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. female.id (Intercept) 0.07924 0.2815 Number of obs: 479, groups: 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 ***************************************************