Uses of this program include:

- Calculate bias in estimated parameters for incorrectly specified models,
- Calculate confidence-interval coverage,
- Compute model goodness-of-fit

The expected numbers of animals exhibiting each capture history are computed using a recursive algorithm. The algorithm follows a population of animals, exposing them to capture and survival until death or the end of the study, while saving a vector of codes (0=not captured, 1=captured) indicating capture history. The process is repeated for each cohort of injected animals in capture occasions after the first.

There are two modes of operation of the program - *Deterministic* and
*Stochastic*.
Under deterministic mode, the number of animals is retained throughout the process
as a fractional number and is multiplied by the parameters to get the final number
of animals with each capture-history. This results in two things: capture-history
frequencies are not integers, and parameter estimates will match input parameters
exactly (almost). In stochastic mode, the number of animals is achieved via
a simulation function (binomial) on the parameters. In this mode, the number of
animals with each capture-history will be integers, and the data (and resulting
estimates) will be different for each program run.

- N(i) = Number of new animals introduced into the population just before time i
- φ(i) = survival rate from time i to i+1,
- θ(i) = tag-retention rate from age or time i to i+1
- p(i) = capture probability for
*unmarked*animals in time i - c(i) = capture probability for
*marked*animals in time i - f(i) = number of new individuals in time i per old individual in time i-1

number of years(K): number new animals N(i): survival rates φ(i): capture rates p(i): recapture rates c(i): tag retention rate θ(i): theta age-specific theta time-specific

Capture-history generation options: Determinsitic(expected values) Stochastic(simulated values)

Recruitment options: In addition to (or instead of) adding new animals using the N(i)'s above, new animals may be added before each sampling occasion using one of the following functions: None binomial normal

# load output from gencaph1 into char variable, 'a' a<-'' a<-unlist(strsplit(unlist(strsplit(a,'\n')),' ')) # split into separate fields a<-matrix(a,ncol=2,byrow=T) # format as a matrix with 2 columns library(RMark) # Load RMark package # create data-frame with 2 fields: ch (capture-histories) and freq (frequencies) data<-data.frame(ch=a[,1],freq=as.numeric(a[,2])) # create RMark processed data object... pd<-process.data(data,model='CJS') # create formula for constant survival/capture probs f1<-list(formula=~1) # run mark model, phi(.)p(.) - constant survival and capture probs m1<-mark(data=pd,model.parameters=list(Phi=f1,p=f1)) # output of phi and p should match Gencaph1 input parameters if # expected values option was selected