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:
*λ**i j*

The estimation process is that for fixed (*θ*, *λ*) the maximized profile likelihood is calculated, i.e. maximized with respect to (*β*, *λ*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()`

.

- gamma, PVF, compount Poisson, inverse Gaussian distributions
- flexible adjustment of estimation parameters
- semiparametric
*Z*(*t*) that changes values at every*t*or piecewise constant*Z*(*t*) - clustered survival data & recurrent events (calendar time or gaptime) ar supported

`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 (*θ*,*λ*) to estimate the maximum (*β*,*λ*0).

- slow even for medium sized data sets. It is recommended to start with a small number of piecewise constant intervals and/or a subset of the data
- no direct standard errors for (
*θ*,*λ*).

**Any scripts or data that you put into this service are public.**

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.