Learn R Programming

secr (version 2.5.0)

secr.design.MS: Construct Detection Model Design Matrices and Lookups

Description

Internal functions used by secr.fit.

Usage

secr.design.MS (capthist, models, timecov = NULL, sessioncov = NULL, 
    groups = NULL, dframe = NULL, naive = FALSE, bygroup = FALSE,
    ...)

make.lookup (tempmat)

Arguments

capthist
capthist object
models
list of formulae for parameters of detection
timecov
optional dataframe of values of time (occasion-specific) covariate(s).
sessioncov
optional dataframe of values of session-specific covariate(s).
groups
optional vector of one or more variables with which to form groups. Each element should be the name of a factor variable in the covariates attribute of capthist.
dframe
optional data frame of design data for detection parameters
naive
logical if TRUE then modelled detection probability is for a naive animal (not caught previously); if FALSE then detection probability is contingent on individual's history of detection
bygroup
logical if TRUE then the individual dimension of the parameter matrix is automatically collapsed to one row per group; if FALSE then the full dimensionality is retained (one row per individual)
...
other arguments passed to the Rfunction model.matrix
tempmat
matrix for which row lookup required

Value

  • For secr.design.MS, a list with the components
  • designMatriceslist of reduced design matrices, one for each real detection parameter
  • parameterTableindex to row of the reduced design matrix for each real detection parameter; dim(parameterTable) = c(uniquepar, np), where uniquepar is the number of unique combinations of paramater values (uniquepar < $RnSK$) and np is the number of parameters in the detection model.
  • PIAParameter Index Array - index to row of parameterTable for a given session, animal, occasion and detector; dim(PIA) = c(R,n,S,K)
  • For make.lookup, a list with components
  • lookupmatrix of unique rows
  • indexindices in lookup of the original rows

Details

This is an internal secr 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 session, individual, occasion and detector, i.e., for $R$ sessions, $n$ individuals, $S$ occasions and $K$ detectors there are potentially $R \times n \times S \times K$ 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 session, individual, occasion and detector.

See Also

D.designdata

Examples

Run this code
secr.design.MS (captdata, models = list(g0 = ~b))$designMatrices
secr.design.MS (captdata, models = list(g0 = ~b))$parameterTable

Run the code above in your browser using DataLab