knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
This is an R package for fitting semiparametric dynamic frailty models with the EM algorithm. The hazard for individual $j$ from cluster $i$ is specified as: $$ \lambda_{ij}(t | Z_i(t)) = Z_i(t) \exp(\beta^\top x_{ij}(t)) \lambda_0(t). $$ The model used here is described in detail in Putter & van Houwelingen (2015). The distribution of $Z_i(t)$ is described by two parameters: $\theta$, that is an inverse-variability parameter of $Z_i(t)$ for a fixed $t$, and $\lambda$, that describes the autocorrelation of the process, so that for $t_1 \leq t_2$ $$ \mathrm{cor}(Z_i(t_1), Z_i(t_2)) = \exp(\lambda (t_2 - t_1)). $$
The estimation process is that for fixed $(\theta, \lambda)$ the maximized profile likelihood is calculated, i.e. maximized with respect to $(\beta, \lambda_0)$. This profile likelihood is finally maximized itself.
The development version from GitHub
:
devtools::install_github("tbalan/dynfrail")
The following packages are needed to build dynfrail
:
install.packages(c("RcppArmadillo", "tibble", "magrittr", "dplyr", "tidyr"))
The functioning of the package is described in the documentation of the main fitting function, dynfrail()
.
dynfrail()
has a friendly syntax very similar to the frailtyEM
package: next to a formula
and data
argument, the distribution
argument is used to specify the distribution parameters and the control
parameter is used for controling the precision of the estimation.dynfrail_prep()
and dynfrail_fit()
are used internally by dynfrail()
but are made user-available. The first one prepares the input of dynfrail()
to make it suitable for the actual EM algorithm. The second one performs one EM algorithm for fixed $(\theta, \lambda)$ to estimate the maximum ($\beta$, $\lambda_0$). Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.