openCR.design {openCR} | R Documentation |
Design Data for Open population Models
Description
Internal function used by openCR.fit
.
Usage
openCR.design(capthist, models, type, naive = FALSE, stratumcov = NULL,
sessioncov = NULL, timecov = NULL, agecov = NULL,
dframe = NULL, contrasts = NULL, initialage = 0,
minimumage = 0, maximumage = 1, agebreaks = NULL, CJSp1 = FALSE, ...)
Arguments
capthist |
single-session |
models |
list of formulae for parameters of detection |
type |
character string for type of analysis "CJS", "JSSAfCL" etc. (see |
naive |
logical if TRUE then modelled parameter is for a naive animal (not caught previously) |
timecov |
optional vector or dataframe of values of occasion-specific covariate(s). |
stratumcov |
optional dataframe of values of stratum-specific covariate(s) |
sessioncov |
optional dataframe of values of session-specific covariate(s) |
agecov |
optional dataframe of values of age-specific covariate(s) |
dframe |
optional data frame of design data for detection parameters |
contrasts |
contrast specification as for |
initialage |
numeric or character (name of individual covariate containing initial ages) |
minimumage |
numeric; ages younger than minimum are truncated up |
maximumage |
numeric; ages older than maximum are truncated down |
agebreaks |
numeric vector of age-class limits |
CJSp1 |
logical; if TRUE detection is modelled on first primary session in CJS models |
... |
other arguments passed to the R function |
Details
This is an internal openCR function that you are unlikely ever
to use. ... may be used to pass contrasts.arg
to
model.matrix
.
Each real parameter is notionally different for each unique combination
of individual, secondary session, detector and latent class, i.e., for n
individuals,
S
secondary sessions, K
detectors and m
latent classes there are
potentially n \times S \times K \times m
different
values. Actual models always predict a much reduced set of distinct
values, and the number of rows in the design matrix is reduced
correspondingly; a parameter index array allows these to retrieved for
any combination of individual, session and detector.
openCR.design
is less tolerant than openCR.fit
regarding
the inputs ‘capthist’ and ‘models’. Model formulae are processed by openCR.fit
to a standard form (a named list of formulae) before they are passed to
openCR.design
, and multi-session capthist objects are
automatically ‘reduced’ and ‘joined’ for open-population analysis.
If timecov
is a single vector of values (one for each secondary session)
then it is treated as a covariate named ‘tcov’.
If sessioncov
is a single vector of values (one for each primary session)
then it is treated as a covariate named ‘scov’.
The initialage
and maximumage
arguments are usually passed via the
openCR.fit
‘details’ argument.
agecov
may be used to group ages. It should have length (or number of rows)
equal to maximumage
+ 1. Alternatively, age classes may be defined with the argument agebreaks
; this is preferred from openCR 2.2.6.
Value
A list with the components
designMatrices |
list of reduced design matrices, one for each real parameter |
parameterTable |
index to row of the reduced design matrix for
each real parameter; dim(parameterTable) = c(uniquepar, np),
where uniquepar is the number of unique combinations of paramater
values (uniquepar < |
PIA |
Parameter Index Array - index to row of parameterTable for a given animal, occasion and latent class; dim(PIA) = c(n,S,K,M) |
validlevels |
for J primary sessions, a logical matrix of np rows and J columns, mostly
TRUE, but FALSE for impossible combinations e.g. CJS recapture
probability in session 1 (validlevels["p",1]) unless |
individual |
TRUE if uses individual variate(s) |
agelevels |
levels for age factor (cut numeric ages) if ‘age’ in model |
Note
The component validlevels is TRUE in many cases for which a parameter is redundant or confounded (e.g. validlevels["phi",J-1]); these are sorted out ‘post hoc’ by examining the fitted values, their asymptotic variances and the eigenvalues of the Hessian matrix.
See Also
Examples
## this happens automatically in openCR.fit
ovenCH1 <- join(reduce(ovenCH, by = "all", newtraps=list(1:44)))
openCR.design (ovenCH1, models = list(p = ~1, phi = ~session),
interval = c(1,1,1,1), type = "CJS")