Fit mortality hazard models, with special attention to humans at old ages.
-
20160526 - this depends on the version of RcppFaddeeva that is on github and not the CRAN version. (The github version exports the Rcpp headers properly.) So it's necessary to
install_github("baptiste/RcppFaddeeva@5fb5c32")
in order to build this version
(NB: The issue opened by Tim Riffe on github has a solution)
Example steps used to create the Beard hazard object:
-
create
mortalityhazard-beard.R
- include code to create new
mortalityHazard
object
- include code to create new
-
calculate
- hazard to probability function
- gradients
-
Using Sage, I produced C++ code to calculate (1) and (2) above. I put the results in
mortalityhazard-beard.cpp
. The function names are:mortalityhazard_beard_cpp
- calculates the mortality hazard, given paramsmortalityhazard_to_prob_beard_cpp
- given params and ages, calculates cond prob of deathmortalityhazard_beard_binomial_grad_cpp
- calculates the gradient of the binomial likelihoodbeard_partial_alpha_partI
- calculates first part of gradient wrt alphabeard_partial_alpha_partII
- calculates second part of gradient wrt alpha- similar functions to calculate gradient wrt other params