Learn R Programming

bayess (version 1.4)

gibbscap1: Gibbs sampler for the two-stage open population capture-recapture model

Description

This function implements a regular Gibbs sampler associated with Chapter 5 for a two-stage capture recapture model with open populations, accounting for the possibility that some individuals vanish between two successive capture experiments.

Usage

gibbscap1(nsimu, n1, c2, c3, N0 = n1/runif(1), r10, r20)

Arguments

nsimu
number of simulated values in the sample
n1
first capture population size
c2
number of individuals recaptured during the second experiment
c3
number of individuals recaptured during the third experiment
N0
starting value for the population size
r10
starting value for the number of individuals who vanished between the first and second experiments
r20
starting value for the number of individuals who vanished between the second and third experiments

Value

  • NGibbs sample of the simulated population size
  • pGibbs sample of the probability of capture
  • qGibbs sample of the probability of leaving the population
  • r1Gibbs sample of the number of individuals who vanished between the first and second experiments
  • r2Gibbs sample of the number of individuals who vanished between the second and third experiments

Examples

Run this code
res=gibbscap1(100,32,21,15,200,10,5)
plot(res$p,type="l",col="steelblue3",xlab="iterations",ylab="p")

Run the code above in your browser using DataLab