Title: | Fitting Routines for the Vitality Family of Mortality Models |
---|---|
Description: | Provides fitting routines for four versions of the Vitality family of mortality models. |
Authors: | Gregor Passolt, James J. Anderson, Ting Li, David H. Salinger, David J. Sharrow |
Maintainer: | David J. Sharrow <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.3 |
Built: | 2024-11-19 06:46:37 UTC |
Source: | CRAN |
Sample survival data for daphnia. Columns include "days" and "lx" (cumulative survival proportion by day).
data frame
http://cbr.washington.edu/analysis/vitality
Anderson, J.J. (2000). "A vitality-based model relating stressors and environmental properties to organism survival." Ecological Monographs 70(3):445-470 (Figure 5)
Function to deal with NAs, right truncated data, and datatype (i.e. cumulative survival or incremental mortality).
dataPrep(time, sdata, datatype, rc.data, returnMatrix = FALSE)
dataPrep(time, sdata, datatype, rc.data, returnMatrix = FALSE)
time |
A vector of observation dates |
sdata |
A vector of survival data of the same length
as |
datatype |
either |
rc.data |
Boolean. Is data right-censored? |
returnMatrix |
Boolean. False returns a data frame, true returns a matrix. (as in the original), if "matrix" returns a matrix instead, with the "rc.data" column being 0 for FALSE, 1 for TRUE, or 2 for TF |
This function is designed for use in the primary vitality model fitting functions in this package. See package documentation.
Returns a data.frame or matrix with columns time, sfract, x1, x2, Ni (incremental survival fraction), rc.data.
This function is used in the calculation of the fitted intrinsic (mu.vd1.4p
) and total (mu.vd.4p
) mortality rate in the 4-parameter model.
ft.4p(xx, r, s, u)
ft.4p(xx, r, s, u)
xx |
age |
r |
r value |
s |
s value |
u |
u value |
density
This function is used in the calculation of the fitted intrinsic (mu.vd1.6p
) and total (mu.vd.6p
) mortality rate in the 6-parameter model.
ft.6p(xx, r, s)
ft.6p(xx, r, s)
xx |
age |
r |
r value |
s |
s value |
density
For use in the primary vitality model fitting functions in this package. See package documentation.
indexFinder(x, val)
indexFinder(x, val)
x |
Vector to search |
val |
Threshold |
Gives the index of the first value of x that is <= val. returns -1 if no value satisfies the condition
Gives the log likelihood of 2-process 6 parameter vitality model.
logLikelihood.4p(par, xx1, xx2, NNi)
logLikelihood.4p(par, xx1, xx2, NNi)
par |
vector of parameter(r, s, lambda, beta) |
xx1 |
xx1 vector |
xx2 |
xx2 vector |
NNi |
survival fractions |
For use in vitality.4p
.
log likelihood
Gives the log likelihood of 6-parameter vitality model.
logLikelihood.6p(par, xx1, xx2, NNi)
logLikelihood.6p(par, xx1, xx2, NNi)
par |
vector of parameters (r, s, lambda, beta, alpha, gamma) |
xx1 |
xx1 vector |
xx2 |
xx2 vector |
NNi |
survival fractions |
For use in vitality.6p
.
log likelihood
Gives the log likelihood of 3-parameter vitality model.
logLikelihood.k(par, xx1, xx2, NNi)
logLikelihood.k(par, xx1, xx2, NNi)
par |
vector of parameters (r, s, k) |
xx1 |
xx1 vector |
xx2 |
xx2 vector |
NNi |
survival fractions |
For use in vitality.k
.
log likelihood
Gives the log likelihood of 4-parameter vitality model.
logLikelihood.ku(par, xx1, xx2, NNi)
logLikelihood.ku(par, xx1, xx2, NNi)
par |
vector of parameters (r, s, k, u) |
xx1 |
xx1 vector |
xx2 |
xx2 vector |
NNi |
survival fractions |
For use in vitality.ku
.
log likelihood
Gives the total age-specific mortality rates for a given set of the four parameters. See mu.vd1.4p
for calculation of intrinsic age-specific mortality rates. See mu.vd2.4p
for calculation of extrinsic age-specific mortality rates.
mu.vd.4p(t, r, s, lambda, beta)
mu.vd.4p(t, r, s, lambda, beta)
t |
age |
r |
r value |
s |
s value |
lambda |
lambda value |
beta |
beta value |
Total age-specific mortality rates
Gives the total age-specific mortality rates for a given set of the six parameters. See mu.vd1.6p
for calculation of intrinsic age-specific mortality rates. See mu.vd2.6p
for calculation of extrinsic age-specific mortality rates.
mu.vd.6p(t, r, s, lambda, beta, gamma, alpha)
mu.vd.6p(t, r, s, lambda, beta, gamma, alpha)
t |
age |
r |
r value |
s |
s value |
lambda |
lambda value |
beta |
beta value |
gamma |
gamma value |
alpha |
alpha value |
Total age-specific mortality rates
Gives the intrinsic age-specific mortality rates for a given set of r
and s
, the intrinsic parameters.
mu.vd1.4p(x, r, s)
mu.vd1.4p(x, r, s)
x |
age |
r |
r value |
s |
s value |
Intrinsic age-specific mortality rates
Gives the intrinsic age-specific mortality rates for a given set of r
and s
, the intrinsic parameters.
mu.vd1.6p(x, r, s)
mu.vd1.6p(x, r, s)
x |
age |
r |
r value |
s |
s value |
Vector of intrinsic age-specific mortality rates at age x
Gives the extrinsic age-specific mortality rates for a given set of r
and the extrinsic parameters.
mu.vd2.4p(x, r, lambda, beta)
mu.vd2.4p(x, r, lambda, beta)
x |
age |
r |
r value |
lambda |
lambda value |
beta |
beta value |
Extrinsic age-specific mortality rates
Gives the extrinsic age-specific mortality rates for a given set of r
and the extrinsic parameters.
mu.vd2.6p(x, r, lambda, beta, gamma, alpha)
mu.vd2.6p(x, r, lambda, beta, gamma, alpha)
x |
age |
r |
r value |
lambda |
lambda value |
beta |
beta value |
gamma |
gamma value |
alpha |
alpha value |
Vector of extrinsic age-specific mortality rates at ages x
mu.vd.6p
, mu.vd1.6p
, mu.vd3.6p
, mu.vd4.6p
Gives the extrinsic age-specific mortality rates for a given set of r
and the adult extrinsic parameters.
mu.vd3.6p(x, r, lambda, beta)
mu.vd3.6p(x, r, lambda, beta)
x |
age |
r |
r value |
lambda |
lambda value |
beta |
beta value |
Vector of adult extrinsic age-specific mortality rates at ages x
mu.vd.6p
, mu.vd1.6p
, mu.vd2.6p
, mu.vd4.6p
Gives the childhood extrinsic age-specific mortality rates for a given set of the childhood extrinsic parameters.
mu.vd4.6p(x, gamma, alpha)
mu.vd4.6p(x, gamma, alpha)
x |
age |
gamma |
gamma value |
alpha |
alpha value |
Vector of childhood extrinsic age-specific mortality rates at ages x
mu.vd.6p
, mu.vd1.6p
, mu.vd2.6p
, mu.vd3.6p
This function plots the estimated results from the 4 parameter vitality model. It is used within the function vitality.4p
.
plotting.4p(r.final, s.final, lambda.final, beta.final, mlv, time, sfract, x1, x2, Ni, pplot, Iplot, Mplot, tlab, rc.data)
plotting.4p(r.final, s.final, lambda.final, beta.final, mlv, time, sfract, x1, x2, Ni, pplot, Iplot, Mplot, tlab, rc.data)
r.final |
r estimate |
s.final |
s estimate |
lambda.final |
lambda estimate |
beta.final |
beta estimate |
mlv |
TODO mlv |
time |
time vector |
sfract |
survival fraction |
x1 |
Time 1 |
x2 |
Time 2 |
Ni |
Initial population |
pplot |
Boolean. Plot cumulative survival fraction? |
Iplot |
Boolean. Plot incremental survival? |
Mplot |
Boolean. Plot mortality rate? Note: plotted mortality data is derived from survival data and is approximate |
tlab |
Character, label for time axis |
rc.data |
Boolean, right-censored data? |
See vitality.4p
for further description of function arguments.
Only one of Iplot
or Mplot
should be set to TRUE
at once.
vitality.4p
, mu.vd.4p
, mu.vd1.4p
, mu.vd2.4p
This function plots the estimated results from the 6 parameter vitality model. It is used within the function vitality.6p
.
plotting.6p(r.final, s.final, lambda.final, beta.final, gamma.final, alpha.final, mlv, time, sfract, x1, x2, Ni, pplot, Iplot, Mplot, tlab, rc.data)
plotting.6p(r.final, s.final, lambda.final, beta.final, gamma.final, alpha.final, mlv, time, sfract, x1, x2, Ni, pplot, Iplot, Mplot, tlab, rc.data)
r.final |
r estimate |
s.final |
s estimate |
lambda.final |
lambda estimate |
beta.final |
beta estimate |
gamma.final |
gamma estimate |
alpha.final |
alpha estimate |
mlv |
TODO mlv |
time |
time vector giving the ages at which calculate the estimated value |
sfract |
observed survival fraction |
x1 |
Time 1 |
x2 |
Time 2 |
Ni |
Initial population |
pplot |
Boolean. Plot cumulative survival fraction? |
Iplot |
Boolean. Plot incremental survival? |
Mplot |
Boolean. Plot mortality rate? Note: plotted mortality data is derived from survival data and is approximate |
tlab |
Character, label for time axis |
rc.data |
Boolean, right-censored data? |
See vitality.6p
for further description of function arguments.
Only one of Iplot
or Mplot
should be set to TRUE
at once.
vitality.6p
, mu.vd.6p
, mu.vd1.6p
, mu.vd2.6p
, mu.vd3.6p
, mu.vd4.6p
This function plots the estimated results from the 3 parameter vitality model. It is used within the function vitality.k
.
plotting.k(r.final,s.final,k.final,mlv,time,sfract,x1,x2,Ni, pplot,tlab,lplot,cplot,Iplot,gfit,rc.data)
plotting.k(r.final,s.final,k.final,mlv,time,sfract,x1,x2,Ni, pplot,tlab,lplot,cplot,Iplot,gfit,rc.data)
r.final |
r estimate |
s.final |
s estimate |
k.final |
k estimate |
mlv |
TODO mlv |
time |
time vector giving the ages at which calculate the estimated value |
sfract |
observed survival fraction |
x1 |
Time 1 |
x2 |
Time 2 |
Ni |
Initial population |
pplot |
Boolean. Plot cumulative survival fraction? |
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 r and s 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 |
rc.data |
Boolean, right-censored data? |
See vitality.k
for further description of function arguments.
This function plots the estimated results from the 4 parameter vitality model. It is used within the function vitality.ku
.
plotting.ku(r.final,s.final,k.final,u.final,mlv,time,sfract,x1,x2,Ni, pplot,tlab,lplot,cplot,Iplot,gfit)
plotting.ku(r.final,s.final,k.final,u.final,mlv,time,sfract,x1,x2,Ni, pplot,tlab,lplot,cplot,Iplot,gfit)
r.final |
r estimate |
s.final |
s estimate |
k.final |
k estimate |
u.final |
u estimate |
mlv |
TODO mlv |
time |
time vector giving the ages at which calculate the estimated value |
sfract |
observed survival fraction |
x1 |
Time 1 |
x2 |
Time 2 |
Ni |
Initial population |
pplot |
Boolean. Plot cumulative survival fraction? |
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 r and s 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 |
See vitality.ku
for further description of function arguments.
Sample survival data for rainbow trout. Columns include "days" and "survival" (cumulative survival proportion by day).
matrix
http://cbr.washington.edu/analysis/vitality
Gives the standard errors for the 4 parameter model. Primarily used within vitality.4p
.
stdErr.4p(r, s, k, u, x1, x2, Ni, pop)
stdErr.4p(r, s, k, u, x1, x2, Ni, pop)
r |
r value |
s |
s value |
k |
lambda value |
u |
beta value |
x1 |
age 1 (corresponding 1:(t-1) and 2:t) |
x2 |
age 2 |
Ni |
survival fraction |
pop |
initial population (total population of the study) |
standard error for r, s, lambda, beta
if k <= 0, cannot find standard error for k
Gives the standard errors for the 6 parameter model. Primarily used within vitality.6p
.
stdErr.6p(r, s, k, u, g, a, x1, x2, Ni, pop)
stdErr.6p(r, s, k, u, g, a, x1, x2, Ni, pop)
r |
r value |
s |
s value |
k |
lambda value |
u |
beta value |
g |
gamma value |
a |
alpha value |
x1 |
age 1 (corresponding 1:(t-1)) |
x2 |
age 2 (corresponding 2:t |
Ni |
age-specific survival fractions |
pop |
initial population (total population of the study) |
standard error for r, s, lambda, beta, gamma, and alpha.
if k <= 0, cannot find standard error for k
Gives the standard errors for the 3 parameter model. Primarily used within vitality.k
.
stdErr.k(r, s, k, x1, x2, Ni, pop)
stdErr.k(r, s, k, x1, x2, Ni, pop)
r |
r value |
s |
s value |
k |
k value |
x1 |
age 1 (corresponding 1:(t-1)) |
x2 |
age 2 (corresponding 2:t |
Ni |
age-specific survival fractions |
pop |
initial population (total population of the study) |
standard error for r, s, k.
k is restricted to be >0.
Gives the standard errors for the 4 parameter model. Primarily used within vitality.ku
.
stdErr.ku(r, s, k, u, x1, x2, Ni, pop)
stdErr.ku(r, s, k, u, x1, x2, Ni, pop)
r |
r value |
s |
s value |
k |
k value |
u |
u value |
x1 |
age 1 (corresponding 1:(t-1)) |
x2 |
age 2 (corresponding 2:t |
Ni |
age-specific survival fractions |
pop |
initial population (total population of the study) |
standard error for r, s, k, u.
k is restricted to be >0.
Gives the cumulative survival proportions at xx
from all processes for a given set of parameter values.
SurvFn.4p(xx, r, s, lambda, beta)
SurvFn.4p(xx, r, s, lambda, beta)
xx |
vector of ages |
r |
r value |
s |
s value |
lambda |
lambda value |
beta |
beta value |
Used within vitality.4p
for estimating model parameters based on the observed cumulative survival function.
vector of cumulative survival proportions at xx
from all processes
vitality.4p
, survProbInc.4p
, SurvFn.in.4p
, SurvFn.ex.4p
Gives the cumulative survival proportions at xx
from all processes for a given set of parameter values.
SurvFn.6p(xx, r, s, lambda, beta, gamma, alpha)
SurvFn.6p(xx, r, s, lambda, beta, gamma, alpha)
xx |
vector of ages |
r |
r value |
s |
s value |
lambda |
lambda value |
beta |
beta value |
gamma |
gamma value |
alpha |
alpha value |
Used within vitality.6p
for estimating model parameters based on the observed cumulative survival function.
vector of cumulative survival proportions at xx
from all processes
vitality.6p
, survProbInc.6p
, SurvFn.in.6p
, SurvFn.ex.6p
Gives the cumulative survival proportions at xx
from extrinsic process for a given set of parameter values.
SurvFn.ex.4p(xx, r, s, lambda, beta)
SurvFn.ex.4p(xx, r, s, lambda, beta)
xx |
vector of ages |
r |
r value |
s |
s value |
lambda |
lambda value |
beta |
beta value |
Used within vitality.4p
for estimating model parameters based on the observed cumulative survival function.
vector of cumulative survival proportions at xx
from extrinsic process
vitality.4p
, survProbInc.4p
, SurvFn.4p
, SurvFn.in.4p
Gives the cumulative survival proportions at xx
from the extrinsic processes for a given set of parameter values.
SurvFn.ex.6p(xx, r, s, lambda, beta, gamma, alpha)
SurvFn.ex.6p(xx, r, s, lambda, beta, gamma, alpha)
xx |
vector of ages |
r |
r value |
s |
s value |
lambda |
lambda value |
beta |
beta value |
gamma |
gamma value |
alpha |
alpha value |
Used within vitality.6p
for estimating model parameters based on the observed cumulative survival function.
vector cumulative survival proportions at xx
from extrinsic processes
vitality.6p
, survProbInc.6p
, SurvFn.6p
Gives the intrinsic cumulative survival distribution at xx
.
SurvFn.h.4p(xx, r, s, u)
SurvFn.h.4p(xx, r, s, u)
xx |
vector of ages |
r |
r value |
s |
s value |
u |
u value |
For use in vitality.4p
.
intrinsic cumulative survival distribution
Gives the intrinsic cumulative survival distribution at xx
.
SurvFn.h.6p(xx, r, s)
SurvFn.h.6p(xx, r, s)
xx |
vector of ages |
r |
r value |
s |
s value |
For use in vitality.6p
.
intrinsic cumulative survival distribution
Gives the cumulative survival proportions at xx
from intrinsic process for a given set of parameter values.
SurvFn.in.4p(xx, r, s)
SurvFn.in.4p(xx, r, s)
xx |
vector of ages |
r |
r value |
s |
s value |
Used within vitality.4p
for estimating model parameters based on the observed cumulative survival function.
vector of cumulative survival proportions at xx
from intrinsic process
vitality.4p
, survProbInc.4p
, SurvFn.4p
, , SurvFn.ex.4p
Gives the cumulative survival proportions at xx
from the intrinsic process for a given set of parameter values.
SurvFn.in.6p(xx, r, s)
SurvFn.in.6p(xx, r, s)
xx |
vector of ages |
r |
r value |
s |
s value |
Used within vitality.6p
for estimating model parameters based on the observed cumulative survival function.
vector of cumulative survival proportions at xx
from intrinsic process
vitality.6p
, survProbInc.6p
, SurvFn.6p
Gives the cumulative survival proportions at xx
for a given set of parameter values.
SurvFn.k(xx, r, s, k)
SurvFn.k(xx, r, s, k)
xx |
vector of ages |
r |
r value |
s |
s value |
k |
k value |
Used within vitality.k
for estimating model parameters based on the observed cumulative survival function.
cumulative survival proportions at xx
Gives the cumulative survival proportions at xx
for a given set of parameter values.
SurvFn.ku(xx, r, s, k, u)
SurvFn.ku(xx, r, s, k, u)
xx |
vector of ages |
r |
r value |
s |
s value |
k |
k value |
u |
u value |
Used within vitality.ku
for estimating model parameters based on the observed cumulative survival function.
cumulative survival proportions at xx
Calculates the incremental survival probabilities (between xx1 and xx2) for 2-process 4-parameter model.
survProbInc.4p(r, s, lambda, beta, xx1, xx2)
survProbInc.4p(r, s, lambda, beta, xx1, xx2)
r |
r value |
s |
s value |
lambda |
lambda value |
beta |
beta value |
xx1 |
xx1 vector |
xx2 |
xx2 vector |
For use in vitality.4p
.
incremental survival probabilities
Calculates the incremental survival probabilities (between xx1 and xx2) for 2-process 6-parameter model.
survProbInc.6p(r, s, lambda, beta, gamma, alpha, xx1, xx2)
survProbInc.6p(r, s, lambda, beta, gamma, alpha, xx1, xx2)
r |
r value |
s |
s value |
lambda |
lambda value |
beta |
beta value |
gamma |
gamma value |
alpha |
alpha value |
xx1 |
xx1 vector |
xx2 |
xx2 vector |
For use in vitality.6p
.
incremental survival probabilities
Calculates the incremental survival probabilities (between xx1 and xx2) for 3-parameter model.
survProbInc.k(r, s, k, xx1, xx2)
survProbInc.k(r, s, k, xx1, xx2)
r |
r value |
s |
s value |
k |
k value |
xx1 |
xx1 vector |
xx2 |
xx2 vector |
For use in vitality.k
.
incremental survival probabilities
Calculates the incremental survival probabilities (between xx1 and xx2) for 4-parameter model.
survProbInc.ku(r, s, k, u, xx1, xx2)
survProbInc.ku(r, s, k, u, xx1, xx2)
r |
r value |
s |
s value |
k |
k value |
u |
u value |
xx1 |
xx1 vector |
xx2 |
xx2 vector |
For use in vitality.ku
.
incremental survival probabilities
Period life table for Swedish females in the year 2000. Columns follow standard life-table naming conventions.
A data.frame
object
Human Mortality Database
This function is used in the calculation of the fitted intrinsic (mu.vd1.4p
) and total (mu.vd.4p
) mortality rate in the 4-parameter model.
vft.4p(xx, r, s, u)
vft.4p(xx, r, s, u)
xx |
vector of ages |
r |
r value |
s |
s value |
u |
u value |
vector of densities
This function is used in the calculation of the fitted intrinsic (mu.vd1.6p
) and total (mu.vd.6p
) mortality rate in the 6-parameter model.
vft.6p(xx, r, s)
vft.6p(xx, r, s)
xx |
vector of ages |
r |
r value |
s |
s value |
vector of densities
This package provides support for fitting the vitality family of mortality models that characterize mortality in terms of the loss vitality, an abstract measure of survival capacity. Mortality occurs by two processes. Intrinsic mortality occurs when vitality is depleted by stochastic losses. Extrinsic mortality occurs when a random external challenge exceeds the available vitality. The package contains four model versions:
vitality.k
is a 3-parameter model. Intrinsic mortality is characterized by the mean (r) and variability (s) in vitality loss rate. Extrinsic mortality is characterized by the frequency (k) of lethal random challenges. Model is appropriate to animal mortality data (e.g. Anderson 2000).
vitality.ku
is a 4-parameter 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).
vitality.4p
is a 4-parameter model. Intrinsic mortality is characterized by the mean (r) and variability (s) in the vitality loss rate. Extrinsic mortality is characterized by random challenges of frequency (lambda) and random magnitude (beta) exceeding the remaining average vitality. Model is appropriate to adult human mortality data (e.g. Li and Anderson 2013).
vitality.6p
is a 6-parameter model. Intrinsic mortality is characterized by the mean (r) and variability (s) in the vitality loss rate. Adult extrinsic mortality is characterized by random challenges of frequency (lambda) and random magnitude (beta) exceeding the remaining average vitality. Child extrinsic mortality is characterized by childhood challenges of frequency (gamma) exceeding childhood vitality development rate (alpha). Model is appropriate to full lifespan of human mortality data (e.g. Anderson and Li 2015).
Model parameters are estimated on survival or mortality rate data using maximum log likelihood methods based on Salinger et al. (2003).
Version 1.1 adds the versions vitality.k
, vitality.ku
and vitality.6p
to the original code for the vitality.4p
model previously designated vitality.2ps.
Version 1.2 makes previously invisible functions to produce the survival and mortality rate functions from a given set of parameters (e.g. SurvFn.4p
, SurvFn.6p
, mu.vd.4p
, mu.vd.6p
) usable. The child mortality rate formula in mu.vd.6p
, mu.vd2.6p
, and mu.vd4.6p
has been updated to improve fit.
Support for package development was provided by the National Institute of Ageing Grant 1R21AG046760-01, the Bonneville Power Administration, and the University of Washington Center for Statistics and the Social Sciences and Center for Studies in Demography and Ecology.
Anderson, J.J. (2000). "A vitality-based model relating stressors and environmental properties to organism survival." Ecological Monographs 70(3):445-470.
Anderson, J.J. and Li, T. (2015). "A two-process mortality model with extensions to juvenile mortality, populations and evolution." Population Association of America Annual Meeting 2015 http://paa2015.princeton.edu/abstracts/153144
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.
Li, T. and J.J. Anderson (2013). "Shaping human mortality patterns through intrinsic and extrinsiv vitality processes." Demographic Research 28(12): 341-372.
Salinger, D.H., J.J. Anderson, and O.S. Hamel. (2003). "A parameter estimation routine for the vitality-based survival model." Ecological Modelling 166 (3): 287-29
# vitality.k data(daphnia) time <- daphnia$days survival_fraction <- daphnia$lx results.modk <- vitality.k(time = time, sdata = survival_fraction, rc.data=TRUE, se=FALSE, gfit=FALSE, datatype="CUM", ttol=.000001, init.params=FALSE, lower=c(0,-1,0), upper=c(100,50,50), pplot=TRUE, tlab="days", lplot=TRUE, cplot=TRUE, Iplot=TRUE, silent=TRUE) # vitality.ku 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=TRUE, L=0) # vitality.4p data(swedish_females) swe <- swedish_females initial_age <- 20 # Could be adjusted time <- initial_age:max(swedish_females$age) survival_fraction <- swe$lx / swe$lx[1] survival_fraction <- survival_fraction[time] # when first element <1 data is adjusted sample_size <- swe$Lx[initial_age] #sample size results.4par <- vitality.4p(time = time, sdata = survival_fraction, #init.params=FALSE, init.params=c(0.012, 0.01, 0.1, 0.1), lower = c(0, 0, 0, 0), upper = c(100,50,1,50), rc.data = TRUE, se = sample_size, datatype = "CUM", ttol = 1e-06, pplot = TRUE, Iplot = TRUE, Mplot = TRUE, tlab = "years", silent = FALSE) # vitality.6p data(swedish_females) swe <- swedish_females initial_age <- 0 time <- swedish_females$age survival_fraction <- swe$lx / swe$lx[1] sample_size <- swe$Lx[1] #sample size results.6par <- vitality.6p(time = time, sdata = survival_fraction, #init.params=FALSE, init.params=c(0.012, 0.01, 0.1, 0.1, 0.1, 1), lower = c(0, 0, 0, 0, 0, 0), upper = c(100,50,1,50,50,50), rc.data = TRUE, se=FALSE, #se = sample_size, datatype = "CUM", ttol = 1e-06, pplot = TRUE, Iplot = TRUE, Mplot = TRUE, tlab = "years", silent = FALSE)
# vitality.k data(daphnia) time <- daphnia$days survival_fraction <- daphnia$lx results.modk <- vitality.k(time = time, sdata = survival_fraction, rc.data=TRUE, se=FALSE, gfit=FALSE, datatype="CUM", ttol=.000001, init.params=FALSE, lower=c(0,-1,0), upper=c(100,50,50), pplot=TRUE, tlab="days", lplot=TRUE, cplot=TRUE, Iplot=TRUE, silent=TRUE) # vitality.ku 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=TRUE, L=0) # vitality.4p data(swedish_females) swe <- swedish_females initial_age <- 20 # Could be adjusted time <- initial_age:max(swedish_females$age) survival_fraction <- swe$lx / swe$lx[1] survival_fraction <- survival_fraction[time] # when first element <1 data is adjusted sample_size <- swe$Lx[initial_age] #sample size results.4par <- vitality.4p(time = time, sdata = survival_fraction, #init.params=FALSE, init.params=c(0.012, 0.01, 0.1, 0.1), lower = c(0, 0, 0, 0), upper = c(100,50,1,50), rc.data = TRUE, se = sample_size, datatype = "CUM", ttol = 1e-06, pplot = TRUE, Iplot = TRUE, Mplot = TRUE, tlab = "years", silent = FALSE) # vitality.6p data(swedish_females) swe <- swedish_females initial_age <- 0 time <- swedish_females$age survival_fraction <- swe$lx / swe$lx[1] sample_size <- swe$Lx[1] #sample size results.6par <- vitality.6p(time = time, sdata = survival_fraction, #init.params=FALSE, init.params=c(0.012, 0.01, 0.1, 0.1, 0.1, 1), lower = c(0, 0, 0, 0, 0, 0), upper = c(100,50,1,50,50,50), rc.data = TRUE, se=FALSE, #se = sample_size, datatype = "CUM", ttol = 1e-06, pplot = TRUE, Iplot = TRUE, Mplot = TRUE, tlab = "years", silent = FALSE)
This function provides the fitting routine for the 4-parameter 2-process vitality model. Intrinsic mortality is characterized by the mean (r) and variability (s) in the vitality loss rate. Extrinsic mortality is characterized by random challenges of frequency (lambda) and random magnitude (beta) exceeding the remaining average vitality. Model is appropriate to adult human mortality data (e.g. Li and Anderson 2013).
vitality.4p(time = 0:(length(sdata)-1), sdata, init.params = FALSE, lower = c(0, 0, 0, 0), upper = c(100,50,100,50),rc.data = FALSE, se = FALSE, datatype = c("CUM", "INC"), ttol = 1e-06, pplot = TRUE, Iplot = FALSE, Mplot = FALSE, tlab = "years", silent = FALSE)
vitality.4p(time = 0:(length(sdata)-1), sdata, init.params = FALSE, lower = c(0, 0, 0, 0), upper = c(100,50,100,50),rc.data = FALSE, se = FALSE, datatype = c("CUM", "INC"), ttol = 1e-06, pplot = TRUE, Iplot = FALSE, Mplot = FALSE, tlab = "years", silent = FALSE)
time |
Vector. Time component of data: Defaults to
|
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. If first element of |
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 |
Optional, Boolean. Incremental mortality for
both data and fitted curves? Default: |
Mplot |
Optional, Boolean. Plot fitted mortality
curve? Default is |
tlab |
Optional, character. specifies units for x-axis of plots. Default is "days". |
silent |
Optional, Boolean. Stops all print and plot
options (still get most warning and all error messages)
Default is |
vector of final MLE r, s, lambda, beta parameter estimates. standard errors of MLE parameter estimates (if se = <population> is specified).
D.H. Salinger, J.J. Anderson and O. Hamel (2003). "A parameter fitting routine for the vitality based survival model." Ecological Modeling 166(3): 287–294.
Li, T. and J.J. Anderson (2013). "Shaping human mortality patterns through intrinsic and extrinsic vitality processes." Demographic Research 28(12): 341-372.
data(swedish_females) swe <- swedish_females initial_age <- 20 # Could be adjusted time <- initial_age:max(swedish_females$age) survival_fraction <- swe$lx / swe$lx[1] survival_fraction <- survival_fraction[time] # when first element <1 data is adjusted sample_size <- swe$Lx[initial_age] #sample size results.4par <- vitality.4p(time = time, sdata = survival_fraction, #init.params=FALSE, init.params=c(0.012, 0.01, 0.1, 0.1), lower = c(0, 0, 0, 0), upper = c(100,50,1,50), rc.data = TRUE, se = sample_size, datatype = "CUM", ttol = 1e-06, pplot = TRUE, Iplot = TRUE, Mplot = TRUE, tlab = "years", silent = FALSE)
data(swedish_females) swe <- swedish_females initial_age <- 20 # Could be adjusted time <- initial_age:max(swedish_females$age) survival_fraction <- swe$lx / swe$lx[1] survival_fraction <- survival_fraction[time] # when first element <1 data is adjusted sample_size <- swe$Lx[initial_age] #sample size results.4par <- vitality.4p(time = time, sdata = survival_fraction, #init.params=FALSE, init.params=c(0.012, 0.01, 0.1, 0.1), lower = c(0, 0, 0, 0), upper = c(100,50,1,50), rc.data = TRUE, se = sample_size, datatype = "CUM", ttol = 1e-06, pplot = TRUE, Iplot = TRUE, Mplot = TRUE, tlab = "years", silent = FALSE)
This function provides the fitting routine for the 6-parameter 2-process vitality model. Intrinsic mortality is characterized by the mean (r) and variability (s) in the vitality loss rate. Adult extrinsic mortality is characterized by random challenges of frequency (lambda) and random magnitude (beta) exceeding the remaining average vitality. Child extrinsic mortality is characterized by childhood challenges of frequency (gamma) exceeding childhood vitality development rate (alpha). Model is appropriate to full lifespan of human mortality data (e.g. Anderson and Li 2015).
vitality.6p(time = 0:(length(sdata)-1), sdata, init.params = FALSE, lower = c(0, 0, 0, 0, 0, 0),upper = c(100,50,100,50,50,10), rc.data = FALSE, se = FALSE, datatype = c("CUM", "INC"), ttol = 1e-06, pplot = TRUE, Iplot = FALSE, Mplot = FALSE, tlab = "years", silent = FALSE)
vitality.6p(time = 0:(length(sdata)-1), sdata, init.params = FALSE, lower = c(0, 0, 0, 0, 0, 0),upper = c(100,50,100,50,50,10), rc.data = FALSE, se = FALSE, datatype = c("CUM", "INC"), ttol = 1e-06, pplot = TRUE, Iplot = FALSE, Mplot = FALSE, tlab = "years", silent = FALSE)
time |
Vector. Time component of data: Defaults to
|
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 |
Optional, Boolean. Incremental mortality for
both data and fitted curves? Default: |
Mplot |
Optional, Boolean. Plot fitted total, intrinsic, extrinsic (child), and extrinsic (adult) mortality
curves? Default: |
tlab |
Optional, character. specifies units for x-axis of plots. Default is "years". |
silent |
Optional, Boolean. Stops all print and plot
options (still get most warning and all error messages)
Default is |
vector of final MLE r, s, lambda, beta, gamma and alpha parameter estimates. standard errors of MLE parameter estimates (if se = <population> is specified).
D.H. Salinger, J.J. Anderson and O. Hamel (2003). "A parameter fitting routine for the vitality based survival model." Ecological Modeling 166(3): 287–294.
Anderson, J.J. and T. Li. (2015). "A two-process mortality model with extensions to juvenile mortality, populations and evolution." Population Association of America Annual Meeting 2015 http://paa2015.princeton.edu/abstracts/153144
data(swedish_females) swe <- swedish_females initial_age <- 0 time <- swedish_females$age survival_fraction <- swe$lx / swe$lx[1] sample_size <- swe$Lx[1] #sample size results.6par <- vitality.6p(time = time, sdata = survival_fraction, #init.params=FALSE, init.params=c(0.012, 0.01, 0.1, 0.1, 0.1, 1), lower = c(0, 0, 0, 0, 0, 0), upper = c(100,50,1,50,50,50), rc.data = TRUE, se=FALSE, #se = sample_size, datatype = "CUM", ttol = 1e-06, pplot = TRUE, Iplot = TRUE, Mplot = TRUE, tlab = "years", silent = FALSE)
data(swedish_females) swe <- swedish_females initial_age <- 0 time <- swedish_females$age survival_fraction <- swe$lx / swe$lx[1] sample_size <- swe$Lx[1] #sample size results.6par <- vitality.6p(time = time, sdata = survival_fraction, #init.params=FALSE, init.params=c(0.012, 0.01, 0.1, 0.1, 0.1, 1), lower = c(0, 0, 0, 0, 0, 0), upper = c(100,50,1,50,50,50), rc.data = TRUE, se=FALSE, #se = sample_size, datatype = "CUM", ttol = 1e-06, pplot = TRUE, Iplot = TRUE, Mplot = TRUE, tlab = "years", silent = FALSE)
This function provides the fitting routine for the 3-parameter vitality model. Intrinsic mortality is characterized by the mean (r) and variability (s) in vitality loss rate. Extrinsic mortality is characterized by the frequency (k) of lethal random challenges. Model is appropriate to animal mortality data (e.g. Anderson 2000).
vitality.k(time, sdata, rc.data=F, se=F, gfit=F, datatype="CUM", ttol=.000001, init.params=F, lower=c(0,-1,0), upper=c(100,50,50), pplot=T, tlab="days", lplot=F, cplot=F, Iplot=F, silent=F)
vitality.k(time, sdata, rc.data=F, se=F, gfit=F, datatype="CUM", ttol=.000001, init.params=F, lower=c(0,-1,0), upper=c(100,50,50), pplot=T, tlab="days", lplot=F, cplot=F, Iplot=F, silent=F)
time |
Vector. Time component of data: Defaults to
|
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? Must have |
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 r and s 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 |
vector of final MLE r, s, k parameter estimates. standard errors of MLE parameter estimates (if se = <population> is specified).
Anderson, J.J. (2000). "A vitality-based model relating stressors and environmental properties to organism survival." Ecological Monographs 70(3):445-470.
data(daphnia) time <- daphnia$days survival_fraction <- daphnia$lx results.modk <- vitality.k(time = time, sdata = survival_fraction, rc.data=TRUE, se=FALSE, gfit=FALSE, datatype="CUM", ttol=.000001, init.params=FALSE, #init.params=c(0.075, 0.15, 0.001), lower=c(0,-1,0), upper=c(100,50,50), pplot=TRUE, tlab="days", lplot=TRUE, cplot=TRUE, Iplot=TRUE, silent=FALSE)
data(daphnia) time <- daphnia$days survival_fraction <- daphnia$lx results.modk <- vitality.k(time = time, sdata = survival_fraction, rc.data=TRUE, se=FALSE, gfit=FALSE, datatype="CUM", ttol=.000001, init.params=FALSE, #init.params=c(0.075, 0.15, 0.001), lower=c(0,-1,0), upper=c(100,50,50), pplot=TRUE, tlab="days", lplot=TRUE, cplot=TRUE, Iplot=TRUE, silent=FALSE)
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)
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)
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)
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. |
vector of final MLE r, s, k, u parameter estimates. standard errors of MLE parameter estimates (if se = <population> is specified).
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.
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)
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)