sim.conCatSMR.df: Simulate data from the conventional (no marking process)...

View source: R/sim.conCatSMR.df.R

sim.conCatSMR.dfR Documentation

Simulate data from the conventional (no marking process) categorical spatial mark resight model with or without telemetry data and with a detection function that varies by one categorical identity covariate. See sim.conCatSMR() for the same function with a single detection function.

Description

This function simulates data from a conventional spatial mark resight survey for categorically marked populations where the detection function parameters vary by the levels of the first categorical identity covariate. Whether marks are preallocated or identified upon capture (natural marks) is determined through "marktype". Imperfect determination of marked status is controlled through "pMarkID" and imperfect individual identification of marked individuals is controlled through "pID". Telemetry data for marked indiviuals is added through "tlocs".

Usage

sim.conCatSMR.df(N = 50, n.marked = 10, lam0 = 0.25, sigma = 0.5,
  K = 10, X = X, buff = 3, obstype = "bernoulli", ncat = ncat,
  pIDcat = pIDcat, gamma = gamma, IDcovs = IDcovs, pMarkID = c(1,
  1), tlocs = 0, pID = 1, marktype = "premarked")

Arguments

N

Abundance

n.marked

The number of marked individuals in the population, distributed randomly across the state space. an error will be produced if fewer than n.marked individuals are captured and marktype=="natural".

lam0

a vector of detection function baseline detection rates the same length as the first list element in IDcovs. Converted to p0, the baseline detection probability if the obstype="bernoulli".

sigma

a vector of detection function spatial scale parameters the same length as the first list element in IDcovs.

K

The number of sampling occasions

X

a matrix with two columns for the X and Y trap locations. J rows.

buff

an integer indicating the distance to buffer the trapping array, X, to create the state space

obstype

a character string indicating the observation model "bernoulli" or "poisson"

ncat

an integer indicating the number of categorical identity covariates

pIDcat

a vector of length ncat containing the probability that the value of each categorical identity covariate is observed upon capture

gamma

a list of the category level probabilities of the same dimension as IDcovs. The category level probabilities for each covariate must sum to 1.

IDcovs

a list of length ncat containing the values each categorical identity covariate can take. The length of each list element determines the number of values each categorical identity covariate can take.

pMarkID

a vector of length 2 containing the probability the marked status is observed upon capture for marked and unmarked individuals, respectively. If these are less than 1, unknown marked status samples are produced.

tlocs

a single integer indicating the number of telemetry locations to simulate for each marked individual.

pID

the probability a marked individual's identity is obtained upon capture. If this is less than one, marked but unknown identity samples are produced.

marktype

a character string indicating whether marks are preallocated or obtained from natural marks, "premarked", or "natural".

Value

a list with many elements. y.sight is the complete sighting history for all individuals. y.sight.marked is the sighting history of the marked, observed marked status, and individually identified samples. y.sight.unmarked is the sighting history of the observed marked status unmarked individual samples. y.sight.unk is the sighting history for the samples for which marked status could not be determined. y.sight.marked.noID is the sighting history of the observed marked status marked, but not individually identified samples. Not all structures will be produced if there is perfect observation of mark status and/or individual identity of marked individuals. y.sight is of dimension N x J x K. y.sight.marked si of dimension n.marked X J x K. y.sight.unmarked is of dimension n_um x J x K, where n_um is the number of unmarked samples observed. The other latent identity sighting histories are similarly structured with one observation per i.

G.x structures housing the observed categorical identity covariates correspond to the y.sight.x structures, linked by the i dimension. "s" contains the simulated activity centers corresponding to y.sight, the complete, perfect identity data. Missing values, if simulated, are indicated with a 0.

IDlist is a list containing ncat and IDcovs, inputs to the simulation function.

IDmarked, IDum, IDunk, and IDmnoID indicate which individual in "s" each ith row of the latent identity sighting histories came from. These could be used to reassemble the latent identity data sets into y.sight.

"locs" contains an n.marked x nlocs x 2 array of telemetry locations, if simulated, for the marked individuals. The i dimension of locs corresponds to the first n.marked i elements of y.sight and the i dimension of y.sight.marked.

Author(s)

Ben Augustine

Examples

## Not run: 
N=100
n.marked=40
lam0=c(0.1,0.3) #Enter same number of detection function parameters as nlevels[i]
sigma=c(0.7,0.5) #same number of lam0 and sigma parameters
K=20 #occasions
buff=3 #state space buffer
X<- expand.grid(3:11,3:11) #trapping array
pMarkID=c(1,1) #probability of observing marked status of marked and unmarked individuals
pID=1 #Probability marked individuals are identified
ncat=3  #number of ID categories
gamma=IDcovs=vector("list",ncat) #population frequencies of each category level. Assume equal here.
nlevels=rep(2,ncat) #number of levels per IDcovs
for(i in 1:ncat){
  gamma[[i]]=rep(1/nlevels[i],nlevels[i])
  IDcovs[[i]]=1:nlevels[i]
}
pIDcat=rep(1,ncat)#category observation probabilities
tlocs=0 #telemetry locs/marked individual
obstype="poisson" #observation model, count or presence/absence?
marktype="premarked" #premarked or natural ID (marked individuals must be captured)?
data=sim.conCatSMR.df(N=N,n.marked=n.marked,lam0=lam0,sigma=sigma,K=K,X=X,buff=buff,obstype=obstype,ncat=ncat,
                         pIDcat=pIDcat,gamma=gamma,IDcovs=IDcovs,pMarkID=pMarkID,tlocs=tlocs,pID=pID,marktype=marktype)

## End(Not run)

benaug/SPIM documentation built on April 28, 2024, 7:27 a.m.