openCR.design: Design Data for Open population Models

openCR.designR 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, CJSp1 = FALSE, ...)

Arguments

capthist

single-session capthist object

models

list of formulae for parameters of detection

type

character string for type of analysis "CJS", "JSSAfCL" etc. (see openCR.fit)

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 model.matrix

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

CJSp1

logical; if TRUE detection is modelled on first primary session in CJS models

...

other arguments passed to the R function model.matrix

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 x S x K x 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.

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 < nSKM) and np is the number of parameters in the detection model.

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 CJSp1 = TRUE, or CJS final survival probability (validlevels["phi",J]). Also, validlevels["b",1] is FALSE with type = "JSSA..." because of the constraint that entry parameters sum to one.

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

openCR.fit

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")


openCR documentation built on Sept. 25, 2022, 5:06 p.m.