The CMData
function creates an object of class CMData that is
used in further analyses. It identifies the variables that define treatment
group, clustersize and the number of responses for each outcome type.
CMData(x, trt, nresp, clustersize = NULL, freq = NULL)
A data frame with each row representing all the clusters with the same trt/size/number of responses, and standardized variable names:
factor, the treatment group
numeric, the cluster size
numeric, the number of responses for each of the K+1 outcome types
numeric, number of clusters with the same values
a data frame with one row representing a cluster or potentially a set of clusters of the same size and number of responses for each outcome
the name of the variable that defines treatment group
either a character vector with the names or a numeric vector with indices
of the variables that define the number of responses in
the cluster for each outcome type. If clustersize
is NULL
, then it will be
calculated assuming that the nresp
vector contains all the possible outcomes.
If clustersize
is given, then an additional category is created for the excess cluster members.
the name or index of the variable that defines cluster size, or NULL
. If NULL
,
its value will be calculated by adding the counts from the nresp
variables. If defined,
an additional response type will be created for the excess cluster members.
the name or index of the variable that defines the number of clusters
represented by the data row. If NULL
, then each row is assumed to
correspond to one cluster.
Aniko Szabo
read.CMData
for creating a CMData
object
directly from a file.
data(dehp)
dehp <- CMData(dehp, trt="Trt", nresp=c("NResp.1","NResp.2","NResp.3"))
str(dehp)
Run the code above in your browser using DataLab