rcbin1: Generates correlated binary cluster data

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


rcbin1(prop = 0.5, prvar = 0, noc, csize, csvar = 0, mincsize = 2,



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


A numeric value between 0 and 1 denoting varince in assumed proportion of event (prvar), default value is 0. See Detail


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


A numeric value (≥ 2) denoting cluster size desired


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


A numeric value (≥ 2) denoting the minimum cluster size desired, default value is 2, see Detail


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.

See Also

rcbin iccbin


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

akhtarh/ICCbin documentation built on May 17, 2019, 12:04 p.m.