pID: Produce the posteriors for P(ID_L_i = ID_R_j) from the...

Description Usage Arguments Value Author(s) Examples

View source: R/pID.R

Description

This function produces the posterior that left individual X is right individual Y. For complete identity individuals, left individual X = right individual X with probability 1.

Usage

1
pID(data, ID_Lout, ID_Rout, swapped = FALSE)

Arguments

data

a list produced by sim2side or in the same format

ID_Lout

the M x niter posterior of ID_L

ID_Rout

the M x niter posterior of ID_R

swapped

TRUE if mcmc2side swapped L and R sides before MCMC sampling, FALSE otherwise

Value

a list with elements pIDL and pIDR, which are also lists. Element X of pIDL corresponds to left individual X and contains the right individuals it was matched with on at least one MCMC iteration and the posterior for each match. Similarly for pIDR.

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
## Not run: 
N=50
p01=0.13
p02=0.2
lam01=-log(1-p01)
lam02=-log(1-p02)
sigma=0.50
K=5
buff=2
xlim<- c(1,10)
ylim<- c(1,10)
X<- expand.grid(3:8,3:8) #6x6 trapping array
X=cbind(X,1) #add number of cameras at each trap
X[which(X[,2]%in%c(4,7)),3]=2 #switch the second and fifth row of traps to double cameras
#Simulate some data
data=sim2side(N=N,lam01=lam01,lam02=lam02,sigma=sigma,K=K,X=X,buff=buff)
inits=list(psi=0.5,lam01=lam01,lam02=lam02,sigma=sigma)
store=mcmc.2sideRcpp(data,niter=niter,nburn=nburn,nthin=nthin, M = 100,inits=inits,swap=10,keepACs=TRUE)
b=Sys.time()
pID(data,store$ID_L,store$ID_R)

## End(Not run)

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