Description Usage Arguments Details Value References See Also Examples

The frailty function allows one to add a simple random effects term to a Cox or survreg model.

1 2 3 4 5 6 7 | ```
frailty(x, distribution="gamma", ...)
frailty.gamma(x, sparse = (nclass > 5), theta, df, eps = 1e-05,
method = c("em","aic", "df", "fixed"), ...)
frailty.gaussian(x, sparse = (nclass > 5), theta, df,
method =c("reml","aic", "df", "fixed"), ...)
frailty.t(x, sparse = (nclass > 5), theta, df, eps = 1e-05, tdf = 5,
method = c("aic", "df", "fixed"), ...)
``` |

`x` |
the variable to be entered as a random effect. It is always treated as a factor. |

`distribution` |
either the |

`...` |
Arguments for specific distribution, including (but not limited to) |

`sparse` |
cutoff for using a sparse coding of the data matrix.
If the total number of levels of |

`theta` |
if specified, this fixes the variance of the random effect.
If not, the variance is a parameter, and a best solution is sought.
Specifying this implies |

`df` |
if specified, this fixes the degrees of freedom for the random effect.
Specifying this implies |

`method` |
the method used to select a solution for theta, the variance of the
random effect.
The |

`tdf` |
the degrees of freedom for the t-distribution. |

`eps` |
convergence criteria for the iteration on theta. |

The `frailty`

plugs into the general penalized
modeling framework provided by the `coxph`

and `survreg`

routines.
This framework deals with likelihood, penalties, and degrees of freedom;
these aspects work well with either parent routine.

Therneau, Grambsch, and Pankratz show how maximum likelihood estimation for
the Cox model with a gamma frailty can be accomplished using a general
penalized routine, and Ripatti and Palmgren work through a similar argument
for the Cox model with a gaussian frailty. Both of these are specific to
the Cox model.
Use of gamma/ml or gaussian/reml with
`survreg`

does not lead to valid results.

The extensible structure of the penalized methods is such that the penalty
function, such as `frailty`

or
`pspine`

, is completely separate from the modeling
routine. The strength of this is that a user can plug in any penalization
routine they choose. A weakness is that it is very difficult for the
modeling routine to know whether a sensible penalty routine has been
supplied.

Note that use of a frailty term implies a mixed effects model and use of a cluster term implies a GEE approach; these cannot be mixed.

The `coxme`

package has superseded
this method. It is faster, more stable, and more flexible.

this function is used in the model statement of either
`coxph`

or `survreg`

.
It's results are used internally.

S Ripatti and J Palmgren, Estimation of multivariate frailty models using penalized partial likelihood, Biometrics, 56:1016-1022, 2000.

T Therneau, P Grambsch and VS Pankratz, Penalized survival models and frailty, J Computational and Graphical Statistics, 12:156-175, 2003.

coxph, survreg

1 2 3 4 5 6 7 8 9 10 | ```
# Random institutional effect
coxph(Surv(time, status) ~ age + frailty(inst, df=4), lung)
# Litter effects for the rats data
rfit2a <- survreg(Surv(time, status) ~ rx +
frailty.gaussian(litter, df=13, sparse=FALSE), rats,
subset= (sex=='f'))
rfit2b <- survreg(Surv(time, status) ~ rx +
frailty.gaussian(litter, df=13, sparse=TRUE), rats,
subset= (sex=='f'))
``` |

```
Call:
coxph(formula = Surv(time, status) ~ age + frailty(inst, df = 4),
data = lung)
coef se(coef) se2 Chisq DF p
age 0.01937 0.00933 0.00925 4.31149 1.00 0.038
frailty(inst, df = 4) 3.33459 3.99 0.501
Iterations: 3 outer, 10 Newton-Raphson
Variance of random effect= 0.038 I-likelihood = -743.6
Degrees of freedom for terms= 1 4
Likelihood ratio test=9.96 on 4.97 df, p=0.075
n=227 (1 observation deleted due to missingness)
```

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.