Calculation of apparent survival (accounting for recapture probability) from mark-recapture data, with time-dependent phi or p, possibly with covariates. Function `survCHSaj`

allows for different survival parameters for juveniles and adults; juveniles are assumed to become adults after the first interval. `BsurvCJS`

is a Bayesian version.

1 2 3 4 5 6 7 8 9 | ```
survCJS(DH, model=list(phi~1, p~1), data=NULL, freq=1, group, ci = 0.95,
link=c("logit", "probit"))
survCJSaj(DHj, DHa=NULL, model=list(phiJ~1, phiA~1, p~1), data=NULL,
freqj=1, freqa=1, ci = 0.95, link=c("logit", "probit"))
BsurvCJS(DH, model=list(phi~1, p~1), data = NULL, freq=1, priors=NULL,
chains=3, sample=1e4, burnin=1000, thin=1, adapt=1000,
parallel = NULL, seed=NULL, priorOnly=FALSE)
``` |

`DH` |
a 1/0 matrix with detection histories with a row for each animal captured and a column for each capture occasion. |

`model` |
a list of formulae symbolically defining a linear predictor for each parameter in terms of covariates. |

`data` |
a data frame with a row for each survival interval / recapture occasion and columns for each of the covariates used to estimate phi or p. |

`freq` |
a scalar or a vector of length |

`group` |
an optional factor of length |

`DHj, DHa` |
detection history matrices for animals marked as juveniles and adults respectively; DHa should be NULL if no animals were marked as adults. |

`freqj, freqa` |
frequencies of each detection history in DHj and DHa; freqa is ignored if DHa = NULL. |

`ci` |
the required confidence interval. |

`link` |
the link function to use, either logit or probit; see Links. |

`priors` |
a list with elements for prior mean and variance for coefficients; see Details. |

`chains` |
the number of Markov chains to run. |

`sample` |
the number of values per chain to return. The total number of values calculated per chain is |

`burnin` |
the number of values to discard at the beginning of each chain. |

`thin` |
the thinning rate. If set to n > 1, n values are calculated for each value returned. |

`adapt` |
the number of iterations to run in the JAGS adaptive phase. |

`priorOnly` |
if TRUE, the function produces random draws from the appropriate |

`parallel` |
if TRUE or NULL and sufficient cores are available, the MCMC chains are run in parallel; if TRUE and insufficent cores are available, a warning is given. |

`seed` |
a positive integer, the seed for the random number generators. |

`BsurvCJS`

uses a probit link to model apparant survival and detection as a function of covariates; most software uses a logistic (logit) link.
See Links.
Coefficients on the probit scale are about half the size of the equivalent on the logit scale.

Priors for `BsurvCJS`

are listed in the `priors`

argument, which may contain elements:

`muPhi`

and `muP`

: the means for apparant survival and detection coefficients respectively. This may be a vector with one value for each coefficient, including the intercept, or a scalar, which will be used for all. The default is 0.

`sigmaPhi`

and `sigmaP`

: the variance for apparent survival and detection coefficients respectively. This may be (1) a vector with one value for each coefficient, including the intercept, which represents the variance, assuming independence, or (2) a scalar, which will be used for all. The function does not currently allow a variance-covariance matrix. The default is 10, except for intercept-only models, where a default of 1 is used.

When specifying priors, note that numerical covariates are standardized internally before fitting the model. For an intercept-only model, a prior of Normal(0, 1) on the probit scale implies a Uniform(0, 1) or Beta(1, 1) prior on the probability scale.

`survCJS`

and `survCJSaj`

return an object of class `wiqid`

, a list with elements:

`call` |
The call used to produce the results |

`beta ` |
Estimates of the coefficients in the linear predictors for phi and p. |

`beta.vcv ` |
The variance-covariance matrix for the beta estimates. |

`real ` |
Back-transformed estimates of phi and p for each interval / occasion. |

`logLik` |
a vector with elements for log(likelihood), number of parameters, and effective sample size. If parameters |

There are `print`

, `logLik`

, and `nobs`

methods for class `wiqid`

.

`BsurvCJS`

returns an object of class `Bwiqid`

, a data frame with columns for each p and psi value containing the series of MCMC samples, and attributes for details of the MCMC run.

Output of `survCJS`

has been checked against program MARK with the dipper data set: coefficients are not the same as MARK uses models without an intercept, but the real values agree to 3 decimal places.

Mike Meredith

Lebreton, J-D; K P Burnham; J Clobert; D R Anderson. 1992. Modeling survival and testing biological hypotheses using marked animals: a unified approach with case studies. *Ecological Monographs* 62:67-118.

1 2 3 4 5 6 7 8 9 10 11 | ```
data(dippers)
DH <- dippers[1:7] # Extract the detection histories
survCJS(DH) # the phi(.) p(.) model
survCJS(DH, phi ~ .time) # the phi(t) p(.) model
df <- data.frame(flood = c(FALSE, TRUE, TRUE, FALSE, FALSE, FALSE))
survCJS(DH, phi ~ flood, data=df) # the phi(flood) p(.) model
# Including a grouping factor:
survCJS(DH, phi ~ flood*group, data=df, group=dippers$sex)
# See also the examples in the dippers help file.
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.