Description Usage Arguments Details Value Author(s) References See Also Examples

Generates correrlated binary cluster data given value of Intracluster Correlation, proportion of event and it's variance, number of clusters, cluster size and it's variance, and minimum cluster size

1 2 | ```
rcbin1(prop = 0.5, prvar = 0, noc, csize, csvar = 0, mincsize = 2,
rho)
``` |

`prop` |
A numeric value between 0 and 1 denoting assumed proportion of event in interest, default value is 0.5. See Detail |

`prvar` |
A numeric value between 0 and 1 denoting varince in assumed proportion of event ( |

`noc` |
A positive numeric value telling the number of clusters to be generated |

`csize` |
A numeric value ( |

`csvar` |
A positive numeric value denoting Variance of cluster size, default value is 0, see Detail |

`mincsize` |
A numeric value ( |

`rho` |
A numeric value between 0 and 1 denoting desired level of Intracluster Correlation |

If supplied value of `prvar`

is 0, the event proportion for all clusters is considered constant as supplied by `prop`

.
If supplied `prvar`

is > 0, cluster specific event proportions are generated from Beta distribution with
`shape1`

and `shape2`

parameters *a* and *b* respectively, see `rbeta`

The shape parameters are obtained using supplied values of `prop`

and `prvar`

by solving the equations
`prop`

*= a/(a + b)* and `prvar`

*= ab/[(a + b)^2(1 + a + b)]*

If supplied value of `csvar`

is 0, cluster of equal size (`csize`

) will be generated. For `csvar`

> 0, will be generated from
Normal or Negative Binomial dsitributions depending on relationship between `csize`

and `csvar`

.
If `csvar`

< `csize`

, the varying cluster sizes will be generated
from a Normal distribution with mean = `csize`

and variacne = `csvar`

(see `rnorm`

).
If `csvar`

*≥* `csize`

i.e. in the case of overdispersion,
cluster sizes will be generated from Negative Bionomial distribution using `mu`

= `csize`

and
`size`

= `csize`

/(`csize`

*(`cscv`

^2 - 1))
(see `rnbinom`

), where `cscv`

is the coefficient of variation of cluster sizes defined as
`sqrt(csvar)`

/`csize`

. If the size of any cluster
is generated as less than 2, it will be replaced by the supplied value of minimum cluster size (`mincsize`

) which has a default value
of 2

A dataframe with two columns presenting cluster id (`cid`

) and a binary response (`y`

) variables

Akhtar Hossain [email protected]

Lunn, A.D. and Davies, S.J., 1998. A note on generating correlated binary variables. Biometrika, 85(2), pp.487-490.

1 | ```
rcbin1(prop = .6, prvar = .1, noc = 100, csize = 10, csvar = 12, rho = 0.2, mincsize = 2)
``` |

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.