cluster | R Documentation |

This is a special function used in the context of survival models. It
identifies correlated groups of observations, and is used on the right hand
side of a formula.
This style is now discouraged, use the `cluster`

option instead.

```
cluster(x)
```

`x` |
A character, factor, or numeric variable. |

The function's only action is semantic, to mark a variable as the cluster indicator. The resulting variance is what is known as the “working independence” variance in a GEE model. Note that one cannot use both a frailty term and a cluster term in the same model, the first is a mixed-effects approach to correlation and the second a GEE approach, and these don't mix.

`x`

`coxph`

, `survreg`

```
marginal.model <- coxph(Surv(time, status) ~ rx, data= rats, cluster=litter,
subset=(sex=='f'))
frailty.model <- coxph(Surv(time, status) ~ rx + frailty(litter), rats,
subset=(sex=='f'))
```

survival documentation built on March 31, 2023, 7:41 p.m.

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.