vitality.ku {vitality} | R Documentation |
Fitting routine for the 4-parameter vitality model.
Description
This function provides the fitting routine for the 4-parameter vitality model. Intrinsic mortality is characterized by the mean (r) and variability (s) in the vitality loss rate and the standard deviation of initial vitality (u). Extrinsic mortality is characterized by the frequency (k) of lethal random challenges. Model is appropriate to animal mortality data (e.g. Li and Anderson 2009)
Usage
vitality.ku(time, sdata, rc.data=F, se=F, gfit=F, datatype="CUM", ttol=.000001,
init.params=F, lower=c(0,-1,0,0), upper=c(100,100,50,50), pplot=T, tlab="days",
lplot=F, cplot=F, Iplot=F, silent=F, L=0)
Arguments
time |
Vector. Time component of data. Typically this refers to ages. |
sdata |
Required. Survival or mortality data. The default expects cumulative survival fraction. If providing incremental mortality fraction instead, use option: datatype = "INC". The default also expects the data to represent full mortality. Otherwise, use option: rc.data = T to indicate right censored data. |
rc.data |
Optional, Boolean. Specifies Right Censored data. If the data does not represent full mortality, it is probably right censored. The default is rc.data = F. A third option is rc.data = "TF". Use this case to add a near-term zero survival point to data which displays nearly full mortality ( <.01 survival at end). If rc.data = F but the data does not show full mortality, rc.data = "TF" will be invoked automatically. |
se |
Optional, Boolean. Calculates the standard errors for the MLE parameters. Default is FALSE. Set equal to the initial study population to compute standard errors. |
datatype |
Optional. Defaults to |
ttol |
Optional. Stopping criteria tolerance. Default is 1e-6. Specify as ttol = .0001. If one of the likelihood plots (esp. for "k") does not look optimal, try decreasing ttol. If the program crashes, try increasing ttol. |
init.params |
Optional. Please specify the initial
param values. specify |
lower |
vector of lower parameter bounds in order of |
upper |
vector of upper parameter bounds in order of |
pplot |
Optional, Boolean. Plots of cumulative
survival for both data and fitted curves? Default:
|
Iplot |
Boolean. Plot incremental survival? |
lplot |
Boolean. Plot likelihood functions? Provides likelihood function plotting. Defaults to |
cplot |
Boolean. Plot likelihood contour plot? Provides a likelihood contour plot for a range of parameter values (can be slow so default is |
tlab |
Character, label for time axis. Defaults to "days". |
gfit |
Provides a Pearson C type test for goodness of fit. Default is |
silent |
Optional, Boolean. Stops all print and plot
options (still get most warning and all error messages)
Default is |
L |
Number of times of running simulated annealing. Default is 0, use Newton-Ralphson method only. |
Value
vector of final MLE r, s, k, u parameter estimates. standard errors of MLE parameter estimates (if se = <population> is specified).
References
Li, T. and J.J. Anderson. (2009). "The vitality model: A way to understand population survival and demographic heterogeneity." Theoretical Population Biology 76: 118-131.
Examples
data(rainbow_trout_for_k)
time <- rainbow_trout_for_k$days
survival_fraction <- rainbow_trout_for_k$survival
results.modku <- vitality.ku(time = time,
sdata = survival_fraction,
rc.data=TRUE,
se=FALSE,
gfit=FALSE,
datatype="CUM",
ttol=.000001,
init.params=FALSE,
lower=c(0,-1,0,0),upper=c(100,100,50,50),
pplot=TRUE,
tlab="days",
lplot=TRUE,
cplot=TRUE,
Iplot=TRUE,
silent=FALSE,
L=0)