sim.genCatSMR.move: Simulate data from the generalized categorical spatial mark...

Description Usage Arguments Value Author(s) Examples

View source: R/sim.genCatSMR.move.R

Description

This function simulates data from a generalized spatial mark resight survey for categorically marked populations where the activity centers move between the marking and sighting process following a bivariate normal Markov transition kernel. Capture histories from the marking and sighting process are produced. If there is only one categorical identity covariate with one value, the function simulates from typical generalized mark resight. 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

1
2
3
4
5
sim.genCatSMR.move(N = 50, lam0.mark = 0.25, lam0.sight = 0.25,
  sigma_d = 0.5, sigma_p = 0.5, K1 = 10, K2 = 10, X1 = X1,
  X2 = X2, buff = 3, obstype = "bernoulli", ncat = ncat,
  pIDcat = pIDcat, gamma = gamma, IDcovs = IDcovs, pMarkID = c(1,
  1), tlocs = 0, pID = 1)

Arguments

N

abundance

lam0.mark

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

lam0.sight

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

sigma_d

the detection function spatial scale parameter assumed to be the same for both capture processes. This could be relaxed.

sigma_p

the spatial scale parameter for activity center relocation between capture processes.

K1

the number of marking occasions

K2

the number of sighting occasions

X1

a matrix with two columns for the X and Y trap locations of the marking process. J1 rows.

X2

a matrix with two columns for the X and Y trap locations of the sighting process. J2 rows.

buff

an integer indicating the distance to buffer the combined trapping array (X1 and X2), to create the state space

obstype

a vector of length two indicating the observation model, "bernoulli" or "poisson", for the marking and sighting process

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. These telemetry locations are around the sighting process activity centers only. Marking process telemetry could be added. In the models with no activity center relocation, it does not matter.

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.

Value

a list with many elements. y.mark is the capture history for the marking process where all individual identities of captured individuals are known or unidentified individuals are excluded. y.mark is the capture history from the marking process. y.sight is the complete sighting history for all captured 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.mark is of dimension n.marked x J1 x K1, where n.marked is the number of individuals captured and marked. y.sight is of dimension n.total x J2 x K2, where n.total is the total number of individuals captured and sighted. y.sight.unmarked is of dimension n_um x J2 x K2, 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. 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 "s1full" and "s2full" 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.

"markedS" contains a history of which of the marked individuals were marked on each occasion.

Author(s)

Ben Augustine

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
N=50
lam0.mark=0.05
lam0.sight=0.25
sigma_d=0.50 #detectoin function sigma
sigma_p=1 #sigma for movement between capture processes
K1=10
K2=10
buff=2
X1<- expand.grid(3:11,3:11)
X2<- expand.grid(3:11+0.5,3:11+0.5)
pMarkID=c(0.8,0.8) #probability of observing marked status of marked and unmarked guys
pID=0.8
obstype=c("bernoulli","poisson")
ncat=3  #number of loci
gamma=IDcovs=vector("list",ncat) #population frequencies of each genotype. Assume equal for now
nlevels=rep(2,ncat) #number of IDcovs per loci
for(i in 1:ncat){
  gamma[[i]]=rep(1/nlevels[i],nlevels[i])
  IDcovs[[i]]=1:nlevels[i]
}
pIDcat=rep(1,ncat)#loci amplification/observation probabilities
tlocs=25
data=sim.genCatSMR.move(N=N,lam0.mark=lam0.mark,lam0.sight=lam0.sight,sigma_d=sigma_d,sigma_p=sigma_p,K1=K1,
                        K2=K2,X1=X1,X2=X2,buff=buff,obstype=obstype,ncat=ncat,
                        pIDcat=pIDcat,gamma=gamma,IDcovs=IDcovs,pMarkID=pMarkID,tlocs=tlocs)

## End(Not run)

benaug/SPIM documentation built on Jan. 23, 2022, 4:29 a.m.