ran.CBData {CorrBin} | R Documentation |
ran.mc.CBData
generates a random CBData
object from a given two-parameter
distribution.
p.gen.fun and rho.gen.fun are functions that generate the parameter values for each treatment group; pdf.fun is a function generating the pdf of the number of responses given the two parameters p and rho, and the cluster size n.
ran.CBData(sample.sizes, p.gen.fun = function(g) 0.3, rho.gen.fun = function(g) 0.2, pdf.fun = qpower.pdf)
sample.sizes |
a dataset with variables Trt, ClusterSize and Freq giving the number of clusters to be generated for each Trt/ClusterSize combination. |
p.gen.fun |
a function of one parameter that generates the value of the first parameter of
pdf.fun (p) given the group number. |
rho.gen.fun |
a function of one parameter that generates the value of the second parameter
of pdf.fun (rho) given the group number. |
pdf.fun |
a function of three parameters (p, rho, n) giving the PDF of the
number of responses in a cluster given the two parameters (p, rho), and
the cluster size (n). Functions implementing two common distributions: the
beta-binomial (betabin.pdf ) and q-power (qpower.pdf ) are provided in
the package. |
p.gen.fun
and rho.gen.fun
expect the parameter value of 1 to represent the first
group, 2 - the second group, etc.
a CBData object with randomly generated number of responses with sample sizes specified in the call.
Aniko Szabo, aszabo@mcw.edu
set.seed(3486) ss <- expand.grid(Trt=0:3, ClusterSize=5, Freq=4) #Trt is converted to a factor rd <- ran.CBData(ss, p.gen.fun=function(g)0.2+0.1*g) rd