Individual heterogeneity in marked: error when re=T

questions concerning analysis/theory using the R package 'marked'

Individual heterogeneity in marked: error when re=T

Postby jbauder » Sat Nov 11, 2017 5:30 pm

Hello,

I recently started looking into the "marked" package to incorporate individual heterogeneity described by Gimenez and Choquet (2012). I am specifically interested in modeling individual heterogeneity in p (not so much in phi). Laake et al. (2013) states that this can be accomplished using use.admb=T and re=T. I also looked at a vignette on Dr. Laake's github site which provided some example code (which I use below). However, when I use the argument re=T I get the following error.

Code: Select all
> admb.mod=crm(test.proc,test.ddl,hessian=T,
+                    use.admb=TRUE,re=T,compile=TRUE)
Error in crm(test.proc, test.ddl, hessian = T, use.admb = TRUE, re = T,  :
  argument 5 matches multiple formal arguments


I am using marked v. 1.1.13 so could this be due to outdated code? I looked through several recent paper's to see if someone tried to use this feature in the last year or so but did not find any examples. When I remove re=T the crm() function works great. I apologize if I have missed something simple in the help documentation!

Also, I noticed that RMark has a model type "CJSRandom." Is this the Gimenez and Choquet (2012) individual heterogeneity model implemented in MARK?

Here is a subset of my data, code, and the results I get when not using re=T.

Thanks so much,
Javan

Code: Select all
> head(CH)
          ch
1 0000100010 
2 1010000000 
3 1000000000   
4 1000000000   
5 1000000000 
6 1000000000   
> test.proc=process.data(CH,model="cjs",begin.time=2010,
+                        time.intervals=time_intervals,
+                        accumulate = F)
> test.ddl=make.design.data(test.proc)
> admb.mod=crm(test.proc,test.ddl,hessian=T,
+                    use.admb=TRUE,re=T,compile=TRUE)
> admb.mod=crm(test.proc,test.ddl,hessian=T,
+                    use.admb=TRUE,compile=TRUE)
Fitting model
Computing initial parameter estimates
compiling with args: ' -r -s ' ...
compiling with args: ' -r -s ' ...
compile output:
  *** Parse: cjsre.tpl tpl2rem   cjsre xxglobal.tmp xxhtop.tmp header.tmp xxalloc1.tmp xxalloc2.tmp xxalloc3.tmp xxalloc4.tmp xxtopm.tmp xxalloc6.tmp         1 file(s) copied. tfile1 tfile2 tfile3 tfile4         1 file(s) copied.  *** Compile: cjsre.cpp g++ -c -O3 -fpermissive -D_FILE_OFFSET_BITS=64 -I. -I"c:\admb\include" -I"c:\admb\contrib\include" -o cjsre.obj cjsre.cpp  *** Linking: cjsre.obj g++ -static -o cjsre.exe cjsre.obj "c:\admb\lib\libadmb-contrib.a"  Successfully built 'cjsre.exe'.
compile log:
running ADMB program
running compiled executable with args: '   '...
Run output:
Initial statistics: 2 variables; iteration 0; function evaluation 0; phase 1
Function value  8.5008029e+001; maximum gradient component mag -1.3375e+001
Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient
  1 -0.98913 -1.3375e+001 |  2 -3.40120 -9.7059e+000 |
 - final statistics:
2 variables; iteration 8; function evaluation 12
Function value  7.1552e+001; maximum gradient component mag  5.8981e-005
Exit code = 1;  converg criter  1.0000e-004
Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient
  1  1.21764  1.5981e-005 |  2 -3.35324  5.8981e-005 |
Estimating row 1 out of 2 for hessian
Estimating row 2 out of 2 for hessian
Elapsed time in minutes:  0.3133
> admb.mod$results$beta
$Phi
(Intercept)
    1.21764
$p
(Intercept)
   -3.35324
jbauder
 
Posts: 56
Joined: Wed May 25, 2011 12:01 pm

Re: Individual heterogeneity in marked: error when re=T

Postby cooch » Sat Nov 11, 2017 5:42 pm

Thought it worth mentioning that all the models you just mentioned are 'doable' in MARK (Gauss-Hermite quadrature to parse out Gaussian RE, for example, has been there for a few years...).
cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Individual heterogeneity in marked: error when re=T

Postby jbauder » Sat Nov 11, 2017 5:50 pm

Thanks Evan, I was wondering about that but wasn't sure. Are there examples of implementing this approach for a CJS model? I (very quickly!) looked through the MARK book and found the addendum to chapter 14 describing which models have mixture options but didn't see any specific examples...?
jbauder
 
Posts: 56
Joined: Wed May 25, 2011 12:01 pm

Re: Individual heterogeneity in marked: error when re=T

Postby cooch » Sat Nov 11, 2017 6:19 pm

Nothing in terms of specific examples, since there isn't much you need really -- beyond how to get there. Pretty simple. Try the male dipper data. Run a simple phi(t)p(t) model, then, 'PIM | Change Data Type', second from bottom is 'CJS with Random Effects'. Select that, open PIM chart -- there is now a sigma for phi, and a sigma for p, but otherwise, the modelling is the same. Be advised that these models can take a long time to run. Even from something as 'trivial' as the dipper data -- <1 second for a fixed effect CJS fit of phi(t)p(t), >10 minutes for a RE version of same. The convenient thing about the approach based on GH is that its based on an ML approach, so you can use (or abuse, depending on who you ask), ML-based model selection tools (like AIC).
cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Individual heterogeneity in marked: error when re=T

Postby jbauder » Sat Nov 11, 2017 6:49 pm

Awesome, thanks! But actually I was wondering about RMark/marked. :) Maybe Jeff can chime in...?
jbauder
 
Posts: 56
Joined: Wed May 25, 2011 12:01 pm

Re: Individual heterogeneity in marked: error when re=T

Postby jlaake » Sun Nov 12, 2017 2:03 pm

I'll have to look at the problem with marked tomorrow. Evan is quite correct that you can do this with MARK and CJSRandom is implemented in RMark. It simply adds parameters sigmap and sigmaphi. With the random effects module in marked you can also have other random effects like time.
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Individual heterogeneity in marked: error when re=T

Postby cooch » Sun Nov 12, 2017 5:14 pm

jlaake wrote:I'll have to look at the problem with marked tomorrow. Evan is quite correct that you can do this with MARK and CJSRandom is implemented in RMark. It simply adds parameters sigmap and sigmaphi. With the random effects module in marked you can also have other random effects like time.


As is often the case, there are lots of different ways to 'get there from here'. For temporal RE, you can used Burnham's method of moments approach (Appendix D), MCMC (Appendix E), or what Jeff has built into marked.
cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Individual heterogeneity in marked: error when re=T

Postby jlaake » Tue Dec 12, 2017 7:13 pm

This is in reference to the original post. I was approached by someone outside the list about whether the re= problem was fixed. I had completely forgotten to look into this after I said I would. That's a problem with being old and newly retired.

Anyhow, I don't think I ever used an argument "re" for the function "crm". Nor could I find any code in my vignette or example code in my github site that did either.

I re-read that section of the paper and it is somewhat misleading. I believe that argument re=TRUE is in reference to ADMB rather than code in marked. That could have been made more clear in the paper. I don't have any recollection of using "re" as an argument in the "crm" function at any time. However that argument is in functions that crm calls. "crm" uses the formula to decide whether the model contains random effects or not. We use something like ~sex + (1|time) where the values in the parentheses specifies a random effect. I believe this is the same notation as in lme4 package. If you know of a place in the vignette or on my github site where I have an example that shows re=TRUE with the crm function, please let me know. I don't believe I could build the package if it contained errant code like that in the vignette.

Sorry for taking so long to attend to this. --jeff
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Individual heterogeneity in marked: error when re=T

Postby jbauder » Tue Dec 19, 2017 4:38 pm

Hi Jeff,
Thanks for following up on and clarifying this. I do believe that the MEE paper was the only place where I saw mention of using re=T.
Thanks again,
Javan
jbauder
 
Posts: 56
Joined: Wed May 25, 2011 12:01 pm


Return to analysis help

Who is online

Users browsing this forum: No registered users and 5 guests

cron