collect.models: Collect MARK models into a list and optionally construct a...

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/collect.models.R

Description

Collects mark models contained in lx of specified type (if any) and returns models in a list with a table of model results if table=TRUE.

Usage

1
2
collect.models(lx = NULL, type = NULL, table = TRUE, adjust = TRUE,
  external = FALSE)

Arguments

lx

if NULL, constructs vector of object names (ls()) from frame of calling function otherwise it uses specifed names in lx

type

either NULL (for all types) or a character vector model type (e.g. type="CJS")

table

if TRUE, a table of model results is also included in the returned list

adjust

if TRUE, adjusts number of parameters (npar) to number of columns in design matrix which modifies AIC

external

if TRUE the mark objects are saved externally rather than in the resulting marklist; the filename for each object is kept in its place

Details

If lx is NULL a vector of object names in the parent frame is constructed for lx. Within lx all mark model objects (i.e., class(x)[1]=="mark") are returned if type is NULL. If type is specified and is valid, then the names of all mark model objects of the specified type (i.e., class(x) = c("mark",type)) in lx are returned. If table=TRUE a table of model selection results is also included in the returned list.

This function was written to be able to easily collect a series of mark models in a list without specifying the names of each model object. This is useful in constructing a return value of a function that runs a series of models for a particular analysis. For an example see dipper.

Value

model.list: a list of mark models and optionally a table of model results.

Note

This function and others that use it or use collect.model.names to collect a series of models or assign a value to a series of models (e.g., adjust.chat) should be used with a degree of caution. It is important to understand the scope of the collection. If the call to this function is made at the R prompt, then it will collect all models (of a particular type if any) within the current .Rdata file. If the call to this function (or one like it) is called from within a function that runs a series of analyses then the collection is limited to the function frame (i.e., only models defined within the function). Thus, it is wise to either use a different .Rdata file for each data set (e.g., one for dipper, another for edwards.eberhardt, etc) or to run everything within functions as illustrated by dipper or edwards.eberhardt. Using a separate .Rdata file is equivalent to having separate .DBF/.FPT files with MARK. It is important to note that functions such as adjust.chat will adjust the value of chat across analyses unless specifically given a list of models to adjust.

Author(s)

Jeff Laake

See Also

merge.mark,remove.mark, collect.model.names,run.models,model.table,dipper

Examples

1
# see examples in dipper, edwards.eberhardt and example.data

RMark documentation built on Nov. 7, 2019, 1:06 a.m.

Related to collect.models in RMark...