basta(object, ...)## S3 method for class 'If requested, a matrix with convergence coefficients based on potential scale reduction as described by Gelman \emph{et al.':
\item{Convergence (2004)nin = 5001, thinning = 50, recaptTrans = studyStart,
thetaStart = NULL, thetaJumps = NULL, thetaPriors = NULL,
gammaStart = NULL, gammaJumps = NULL, gammaPriors = NULL,
nsim = 1, parallel = FALSE, ncpus = 2, lifeTable = TRUE,
progrPlots = FALSE, updateJumps = TRUE, ...)
data.frame to be used as an input data file for BaSTA. The first column is a vector of individual unique IDs, the second and third columns are birth and death years respectively. Columns 4-(nt-1) represent the observation window of nt yearsdetails)details).simple = no extra parameters added; Makeham = a constant parameter is added to the mortality rate; and bathtub = a Gompertz declining mortality for early ages and a constanfuseddetails).details).details). The default is set to NULL and thus a set othetaStart. As with thetaStart, the defauthetaStart. As with thetaStart, the default is set to NULL and thus default values are assigned (i.e. all eqProp.Hazards is TRUE or when continuous covariates are evaluated under a fusedcovarsStruct is set to prop.hazgammaJumps.TRUE, package parallel is TRUE and package TRUE, a cohort life table is calculated using function MakeLifeTable.TRUE, small plots are displayed showing the percent progress achieved for each MCMC simulation.Convergence value below).NULL.NULL.summary, list with Kullback-Leibler discrepancy matrices between pair of parameters for categorical covariates (McCulloch 1989, Burnham and Anderson 2001) and McCulloch's (1989) calibration measure. If only one simulation was ran or if no convergence is reached, then the returned value is NULL.summary, this is a vector indicating the number of iterations for each MCMC, the burn in sequence, the thinning interval, and the number of simulations that were run.model, the shape and the covariate structure that were specified by the user.summary or summary.basta, a matrix with the jumps and priors used in the model.plot or plot.basta median and 95% predictive intervals for the estimated survival probability.plot or plot.basta median and 95% predictive intervals for the estimated mortality rates.lifeTable, a cohort life table calculated from the estimated ages at death.minAge is larger than 0 and if requested, matrix with lambda parameter estimates for early changes in distribution of ages at death.object the function CensusToCaptHist can be used to build the capture-recapture matrix, while the covariate (design) matrix can be constructed with the MakeCovMat function.basta uses parametric mortality functions to estimate age-specific mortality (survival) from capture-recapture/recovery data. The mortality rate function describes how the risk of mortality changes with age, and is defined as $\mu(x | \theta)$, where $x$ corresponds to age and $\theta$ is a vector of parameters to be estimated.
The model argument allows the user to choose between four basic mortality rate functions:
(a) Exponential (EX
$$\mu_b(x | b) = b$$ with $b > 0$.
(b) Gompertz (GO
$$\mu_b(x | b) = exp(b_0 + b_1 x)$$ with $-\infty < b_0, b_1 < \infty$.
(c) Weibull (WE
$$\mu_b(x | b) = b_0 b_1^(b_0) x^(b_0 -1)$$ with $b_0, b_1 > 0$.
(d) logistic (LO
$$\mu_b(x | b) = exp(b_0 + b_1 x) / (1 + b_2 exp(b_0)/b_1 (exp(b_1 x)-1))$$ with $b_0, b_1, b_2 > 0$.
The shape argument allows the user to extend these models in order to explore more complex mortality shapes. The default value is simpleMakehambathtub
$$\mu_0(x | \theta) = exp(a_0 - a_1 x) + c + \mu_b(x | b)$$. with $-\infty < a_0 < \infty$, $a_1 > 0$ and $c > - (exp(a_0 - a_1 x_m) + \mu_b(x_m | b))$, where $x_m$ is the age at which $\mu_0(x | \theta)$ reaches the mininum vale.
To incorporate covariates into the inference process, the mortality model is further extended by including a proportional hazards structure, of the form:
$$\mu(x | \theta, \Gamma, Z_a, Z_c) = \mu_0(x | \theta, Z_a) exp(\Gamma Z_c)$$
where $\mu_0(x | \theta, Z_a)$ represents the mortality section as defined above, while the second term $exp(\Gamma Z_c)$ corresponds to the proportional hazards function. $Z_a$ and $Z_c$ are covariate (design) matrices for categorical and continuous covariates, respectively.
When covariates are included in the dataset, the basta function provides three different ways in which these can be evaluated by using argument covarsStruct:
1. fused
2. prop.haz
3. all.in.mortshape set to simplemodel will be forced to be GOshape will be set to simple
The burnin argument represents the number of steps at the begining of the MCMC run that is be discarded. This sequence commonly corresponds to the non-converged section of the MCMC sequence. Convergence and model selection measures are calculated from the remaining thinned parameter chains if multiple simulations are run, and all if all of them run to completion.
The thinning argument specifies the number of steps to be skipped in order to reduce serial autocorrelation. The thinned sequence, which only includes steps after burn in, is then used to calculate convergence statistics and model for selection.
The number of parameters in thetaStart is a vector or matrix that defines the initial values for each $\theta$ parameter of the mortality function. The number of parameters will depend on the model chosen with model (see above). If the number of parameters specified does not match the number of parameters inherent to the model and shape selected, the function returns an error. If no thetaStart argument is specified (i.e. default is NULL), the model randomly generates a set of initial parameters.
As described above, the number of parameters for the gammaStart argument (i.e. section b), namely the proportional hazards section, will be a function of the number of continuous covariates if argument covarsStruct is fusedcovarsStruct is prop.haz
Colchero, F. and J.S. Clark (2012) Bayesian inference on age-specific survival from capture-recapture data for censored and truncated data. Journal of Animal Ecology. 81, 139-149.
Colchero, F., O.R. Jones and M. Rebke. (2012) BaSTA: an R package for Bayesian estimation of age-specific survival from incomplete mark-recapture/recovery data with covariates. Method in Ecology and Evolution. 3, 466-470.
Cox, D. R., and Oakes D. (1984) Analysis of Survival Data. Chapman and Hall, London.
Gelman, A., Carlin, J.B., Stern, H.S. and Rubin, D.B. (2004) Bayesian data analysis. 2nd edn. Chapman & Hall/CRC, Boca Raton, Florida, USA.
Gompertz, B. (1825) On the nature of the function expressive of the law of human mortality, and on a new mode of determining the value of life contingencies. Philosophical Transactions of the Royal Society of London, 115, 513-583.
King, R. and Brooks, S.P. (2002) Bayesian model discrimination for multiple strata capture-recapture data. Biometrika, 89, 785-806.
McCulloch, R.E. (1989) Local model influence. Journal of the American Statistical Association, 84, 473-478.
Pinder III, J.E., Wiener, J.G. and Smith, M.H. (1978) The Weibull distribution: a new method of summarizing survivorship data. Ecology, 59, 175-179.
Spiegelhalter, D.J., Best, N.G., Carlin, B.P. and van der Linde, A. (2002) Bayesian measures of model complexity and fit. Journal of the Royal Statistical Society: Series B, 64, 583-639.
summary.basta, print.basta, plot.basta to visualise summary outputs for objects of class bastaCensusToCaptHist and MakeCovMat for raw data formatting.## Load data:
data("sim1", package = "BaSTA")
## Check data consistency:
new.dat <- DataCheck(sim1, studyStart = 51,
studyEnd = 70, autofix = rep(1,7))
## Run short version of BaSTA on the data:
out <- basta(sim1, studyStart = 51, studyEnd = 70,
niter = 200, burnin = 11, thinning = 10,
progrPlots = TRUE)
## Print results:
summary(out, digits = 3)
## Plot traces for survival parameters:
plot(out)
## Plot traces for proportional hazards parameter:
plot(out, trace.name = "gamma")
## Plot survival and mortality curves:
plot(out, plot.trace = FALSE)Run the code above in your browser using DataLab