Description Usage Arguments Details Value Author(s) Examples
A function that returns the log-likelihood of the model of recruitment, survival and catchability, given capture-recapture data. Model parameters are provided in the function's single argument, which is a vector. Capture-recapture data must be stored in specific-named global variables (see Details).
1 | llRecruit(params)
|
params |
A vector containing six parameter values (see Details). |
The input params
contains the following values:
[tbar] The day when recruitment peaks.
[sigma] The spread in recruitment (days). Approximately 95% of recruitments occur during days [tbar - 2*sigma, tbar + 2*sigma].
[alpha0] Baseline catch rate (per unit effort).
[alpha1] Age-dependence in catch rate.
[beta0] Base-line mortality rate (per day).
[beta1] Age-dependence in mortality rate.
Recruitment is described by a Guassian peak centred on day tbar
with spread characterised by sigma
. Per-capita catch rate is given by: alpha0*exp(alpha1*age)
, where age
is the days since recruitment. Per-capita mortality rate is given by: beta0*exp(beta1*age)
.
Suppose the survey involves the capture of I
animals over J
sampling events. The data must be stored and summarised by the following R-variables:
An integer matrix containing the capture data (I
rows and J
columns). Rows indicate the animal and columns indicate the sampling event.
An integer vector of size I
identifying the sampling event when the animal was first caught. Values lie in the range [1,J
].
An integer vector of size I
identifying the sampling event when the animal was last caught. Values lie in the range [1,J
]. All element satisfy l
>= f
.
A double vector of size J
quantifying the effort applied during each sampling event.
An integer vector of size J
providing the day of each sampling event.
An integer indicating the first possible day of recruitment.
An integer (> T.F
) indicating the last possible day of recruitment.
Note that the vectors f
and l
are determined by the matrix y
but must be calculated by the user.
This function is usually used in conjunction with the optim
function (see Examples).
A double.
Shane A. Richards (shane.richards@csiro.au)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | guess <- c(3.0, 3.0, 0.2, 0.0, 0.03, 0.1) # dummy model parameters
ll <- llRecruit(guess) # calculate log-likelihood of the model
# find the maximum-likelihood parameter estimates
# box constraint method allows control over parameter estimates
# age-dependent capture is turned off by restricting alpha1 (parameter 4)
# tracer flags are turned on to check for convergence
fit <- optim(par = guess, fn = llRecruit,
lower = c(0, 1.0, 0.10, -0.001, 0.0025, 0.001),
upper = c(6, 5.0, 0.35, 0.001, 0.1000, 0.190),
method = "L-BFGS-B",
control = list(fnscale = -1, trace = 1, maxit = 100, REPORT = 20))
fit$par # display maximum-likelihood parameter estimates
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.