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

View source: R/sim.conCatSMR.R

sim.conCatSMRR Documentation

Simulate data from the conventional (no marking process) categorical spatial mark resight model with or without telemetry data

Description

This function simulates data from a conventional spatial mark resight survey for categorically marked populations. If there is only one categorical identity covariate with one value, the function simulates from typical conventional mark resight. 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(N = 50, n.marked = 10, lam0 = 0.25, sigma = 0.5,
  K = 10, X = X, buff = 3, obstype = "bernoulli", ncat = ncat,
  pIDcat = pIDcat, IDcovs = IDcovs, gamma = gamma, 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

The detection function baseline detection rate. Converted to p0, the baseline detection probability if the obstype="bernoulli".

sigma

The detection function spatial scale parameter

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

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.

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.

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=50
n.marked=12
lam0=0.35
sigma=0.50
K=10 #number of occasions
buff=3 #state space buffer
X<- expand.grid(3:11,3:11) #make a trapping array
pMarkID=c(.8,.8)#probability of observing marked status of marked and unmarked individuals
pID=.8 #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]
}
#inspect ID covariates and level probabilities
str(IDcovs) #3 covariates with 2 levels
str(gamma) #each of the two levels are equally probable
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(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.