Learn R Programming

RMark (version 3.0.0)

ABeginnersGuide: A beginners introduction and guide to RMark

Description

The RMark package is a collection of R functions that can be used as an interface to MARK for analysis of capture-recapture data. Some initial ideas are described here but you are strongly encouraged to read use the help files with this package and to read the documentation at http://www.phidot.org/software/mark/rmark/RMarkDocumentation.zip The above link appears the first time you enter library(RMark) in an R session.

Arguments

Author

Jeff Laake

Details

The RMark package contains various functions that import/export capture data, build capture-recapture models, run the FORTRAN program MARK.EXE, and extract and display output. Program MARK has its own user interface; however, model development can be rather tedious and error-prone because the parameter structure and design matrix are created by hand. This interface in R was created to use the formula and design matrix functions in R to ease model development and reduce errors. This R interface has the following advantages: 1) Uses model notation to create design matrices rather than designing them by hand in MARK or in EXCEL, which makes model development faster and more reliable. All-different PIMS are automatically created for each group (if any). 2) Allows models based on group (factor variables) and individual covariates with groups created on the fly. Age, cohort, group and time variables are pre-defined for use in formulas. 3) Both real and beta labels are automatically added for easy output interpretation. 4) Input, output and specific results (eg parameter estimates, AICc etc) are stored in an R object where they can be manipulated as deemed useful (eg plotting, further calculations, simulation etc). 5) Parameter estimates can be displayed in triangular PIM format (if appropriate) for ease of interpretation. 6) Easy setup of batch jobs and the calls to the R functions document the model specifications and allow models to be easily reproduced or re-run if data are changed. 7) Covariate-specific estimates of real parameters can be computed within R without re-running the analysis.

The MARK capture-recapture models that are currently supported are provided in MarkModels.pdf which is installed in the RMark directory of your R library. You can also find a list in MARK under Help/Data Types. ' There is one limitation of this interface. All models in this interface are developed via a design matrix approach rather than coding the model structure via parameter index matrices (PIMS). In most cases, a logit or other link is used by default which has implications for ability of MARK to count the number of identifiable parameters (see dipper for an example). However, beginning with v1.7.6 the sin link is now supported if the formula specifies an identity design matrix for the parameter.

Before you begin, you must have installed MARK (http://www.phidot.org/software/mark/) on your computer or at least have a current copy of MARK.EXE. As long as you selected the default location for the MARK install (c:/Program Files/Mark), the RMark library will be able to find it. If for some reason, you choose to install it in a different location, see the note section in mark for instructions on setting the variable MarkPath to specify the path. In addition to installing MARK, you must have installed the RMark library into the R library directory. Once done with those tasks, run R and enter library(RMark) (or put it in your .First function) to attach the library of functions.

The following is a categorical listing of the functions in the package with a link to the help for each function. To start, read the help for functions import.chdata and mark to learn how to import your data and fit a simple model. The text files for the examples shown in import.chdata are in the subdirectory data within the R Library directory in RMark. Next look at the example data sets and analyses dipper, edwards.eberhardt, and example.data. After you see the structure of the examples and the use of functions to fit a series of analyses, explore the remaining functions under Model Fitting, Batch Analyses, Model Selection and Summary and Display. If your data and models contain individual covariates, read the section on Real Parameter Computation to learn how to compute estimates of real parameters at various covariate values.

Input/Output data & results

import.chdata,read.mark.binary, extract.mark.output

Exporting Models to MARK interface

export.MARK

Model Fitting

mark, process.data, make.design.data, add.design.data, make.mark.model, run.mark.model merge_design.covariates

Batch analyses with functions

run.models, collect.models, create.model.list, mark.wrapper

Summary and display

summary.mark, print.mark, print.marklist, get.real, compute.real, print.summary.mark

Model Selection/Goodness of fit

adjust.chat, adjust.parameter.count, model.table , release.gof, model.average

Real Parameter computation

find.covariates, fill.covariates, compute.real , covariate.predictions

Utility and internal functions

mark.wrapper,collect.model.names, compute.design.data, extract.mark.output, inverse.link, deriv.inverse.link, setup.model, setup.parameters, valid.parameters, cleanup,TransitionMatrix,

For examples, see dipper for CJS and POPAN, see example.data for CJS with multiple grouping variables, see edwards.eberhardt for various closed-capture models, see mstrata for Multistrata, and see Blackduck for known fate. The latter two are examples of the use of mark.wrapper for a shortcut approach to creating a series of models. Other examples have been added for the various other models. In MarkModels.pdf it also lists the name of examples that are provided for each model.

References

MARK: Dr. Gary White, Department of Fishery and Wildlife Biology, Colorado State University, Fort Collins, Colorado, USA http://www.phidot.org/software/mark/