mscjs_tmb {marked}R Documentation

Fitting function for Multistate CJS models with TMB

Description

A function for computing MLEs for a Multi-state Cormack-Jolly-Seber open population capture-recapture model for processed dataframe x with user specified formulas in parameters that create list of design matrices dml. This function can be called directly but is most easily called from crm that sets up needed arguments.

Usage

mscjs_tmb(
  x,
  ddl,
  fullddl,
  dml,
  model_data = NULL,
  parameters,
  accumulate = TRUE,
  initial = NULL,
  method,
  hessian = FALSE,
  debug = FALSE,
  chunk_size = 1e+07,
  refit,
  itnmax = NULL,
  control = NULL,
  scale,
  re = FALSE,
  compile = FALSE,
  extra.args = "",
  clean = TRUE,
  getreals = FALSE,
  useHess = FALSE,
  savef = TRUE,
  ...
)

Arguments

x

processed dataframe created by process.data

ddl

list of simplified dataframes for design data; created by call to make.design.data

fullddl

list of complete dataframes for design data; created by call to make.design.data

dml

list of design matrices created by create.dm from formula and design data

model_data

a list of all the relevant data for fitting the model including imat, S.dm,p.dm,Psi.dm,S.fixed,p.fixed,Psi.fixed and time.intervals. It is used to save values and avoid accumulation again if the model was re-rerun with an additional call to cjs when using autoscale or re-starting with initial values. It is stored with returned model object.

parameters

equivalent to model.parameters in crm

accumulate

if TRUE will accumulate capture histories with common value and with a common design matrix all parameters to speed up execution

initial

list of initial values for parameters if desired; if each is a named vector from previous run it will match to columns with same name

method

method to use for optimization; see optim

hessian

if TRUE will compute and return the hessian

debug

if TRUE will print out information for each iteration

chunk_size

specifies amount of memory to use in accumulating capture histories; amount used is 8*chunk_size/1e6 MB (default 80MB)

refit

non-zero entry to refit

itnmax

maximum number of iterations

control

control string for optimization functions

scale

vector of scale values for parameters

re

if TRUE creates random effect model admbcjsre.tpl and runs admb optimizer

compile

if TRUE forces re-compilation of tpl file

extra.args

optional character string that is passed to tmb

clean

if TRUE, deletes the dll and recompiles

getreals

if TRUE, compute real values and std errors for TMB models; may want to set as FALSE until model selection is complete

useHess

if TRUE, the TMB hessian function is used for optimization; using hessian is typically slower with many parameters but can result in a better solution

savef

if TRUE, save the makeAdFun result from TMB to report real values and matrices

...

not currently used

Details

It is easiest to call mscjs_tmb through the function crm. Details are explained there.

Value

The resulting value of the function is a list with the class of crm,cjs such that the generic functions print and coef can be used.

beta

named vector of parameter estimates

lnl

-2*log likelihood

AIC

lnl + 2* number of parameters

convergence

result from optim; if 0 optim thinks it converged

count

optim results of number of function evaluations

reals

dataframe of data and real S and p estimates for each animal-occasion excluding those that occurred before release

vcv

var-cov matrix of betas if hessian=TRUE was set

Author(s)

Jeff Laak

References

Ford, J. H., M. V. Bravington, and J. Robbins. 2012. Incorporating individual variability into mark-recapture models. Methods in Ecology and Evolution 3:1047-1054.


[Package marked version 1.2.8 Index]