setcov: Creates design matrix for covariates in detection function

View source: R/setcov.R

setcovR Documentation

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


DistanceDevelopment/mrds documentation built on Feb. 15, 2024, 9:25 a.m.