Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

setcov

Creates design matrix for covariates in detection function


Description

This function creates a design matrix for the g(0) or scale covariates using the input model formula. It returns a list which contains 2 elements: 1) dim: the dimension (number of columns) of the design matrix, and 2) cov: the constructed design matrix. This function is relatively simple because it uses the built-in function model.matrix which does the majority of the work. This function handles 2 exceptions "~.", the null model with 0 columns and "~1" the intercept only model - a column of 1s. If a model other than the 2 exceptions is provided, it calls model.matrix to construct the columns. If any of the columns of the design matrix are all 0's the column is removed. This occurs when there is no data for a particular factor.

Usage

setcov(dmat, model)

Arguments

dmat

data matrix

model

model formula

Value

a design matrix for the specified data and model

Author(s)

Jeff Laake


mrds

Mark-Recapture Distance Sampling

v2.2.4
GPL (>= 2)
Authors
Jeff Laake <jeff.laake@noaa.gov>, David Borchers <dlb@st-and.ac.uk>, Len Thomas <len.thomas@st-and.ac.uk>, David Miller <dave@ninepointeightone.net> and Jon Bishop
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.