fitNmix {quickNmix} | R Documentation |
Fit Asymptotic N-mixture Model
Description
Fit an open population N-mixture model using the asymptotic approximation. The four parameters are mean initial site abundance lambda, mean recruitments gamma, survival probability omega, and probability of detection pdet. Parameters can be made to vary over sites and over times by including parameter covariates. Note that this function is essentially a wrapper for optim acting on the nll function.
Usage
fitNmix(
nit,
K = NULL,
starts = NULL,
l_s_c = NULL,
g_s_c = NULL,
g_t_c = NULL,
o_s_c = NULL,
o_t_c = NULL,
p_s_c = NULL,
p_t_c = NULL,
SMALL_a_CORRECTION = FALSE,
VERBOSE = FALSE,
outfile = NULL,
method = "BFGS",
...
)
Arguments
nit |
Matrix of counts data. Rows represent sites, columns represent sampling occasions. Note that if the data is a vector, then it will be converted to a matrix with a single row. |
K |
Upper bound on summations in the likelihood function. K should be chosen large enough that the negative log likelihood function is stable (unchanging as K increases). If K=NULL, K=5*max(nit) will be used as default. Default: NULL |
starts |
Either NULL for default starting values, or a vector of parameter values: |
l_s_c |
List of lambda site covariates, Default: NULL |
g_s_c |
List of gamma site covariates, Default: NULL |
g_t_c |
List of gamma time covariates, Default: NULL |
o_s_c |
List of omega site covariates, Default: NULL |
o_t_c |
List of omega time covariates, Default: NULL |
p_s_c |
List of pdet site covariates, Default: NULL |
p_t_c |
List of pdet time covariates, Default: NULL |
SMALL_a_CORRECTION |
If TRUE will apply the small a correction when calculating the transition probability matrix, Default: FALSE |
VERBOSE |
If TRUE, will print additional information during model fitting, Default: FALSE |
outfile |
Location of csv file to write/append parameter values, can be used to checkpoint long running model fits. Default: NULL |
method |
Optimization method, passed to optim function, options include: "BFGS", "Nelder-Mead", "CG". Default: "BFGS" |
... |
Additional arguments passed to the optimization function optim. For example: |
Value
Returns the fitted model object.
Examples
if (interactive()) {
nit = matrix(c(1,1,0,1,1), nrow=1) # observations for 1 site, 5 sampling occassions
model1 = fitNmix(nit, K=2) # fit the model with population upper bound K=2
}