I am looking at the example which appears in this R page:

http://stat.ethz.ch/R-manual/R-devel/library/survival/html/frailty.html

Code:

```
require(survival);
# Random institutional effect
# Using Method=df fixes the degrees of freedom for the random effect in the model.
coxph(Surv(time, status) ~ age + frailty(inst, df=4), lung)
# Output
Call:
coxph(formula = Surv(time, status) ~ age + frailty(inst, df = 4),
data = lung)
coef se(coef) se2 Chisq DF p
age 0.0194 0.00933 0.00925 4.31 1.00 0.038
frailty(inst, df = 4) 3.33 3.99 0.500
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
```

But, how did they decide?

This clearly can't be the number of institutions as there are 19 institutions.

> length(unique(lung$inst))

[1] 19

But, how to decide what degrees of freedom to specify for your random institution effect? What was the reason they chose df=4?

I would have fixed the df=1, because I would assume the institutions to come from a common distribution (i.e. gamma) and I would loose a degree of freedom for estimating the variance of this random effect.

Is this df actually the degrees of freedom for random effects, or is it something like degrees of freedom fro smoothing splines?

Please join in the discussion and share your thoughts.