Calculate mean simulated responses by replicate
Usage
calculateSimTrialMeans(
data,
respCol = getEctdColName("Response"),
bVar = doseCol,
subset = NULL,
diffBase = FALSE,
idCol = getEctdColName("Subject"),
timeCol = getEctdColName("Time"),
doseCol = getEctdColName("Dose"),
replicateCol = getEctdColName("Replicate"),
respType = c("Continuous", "Categorical"),
catType = c("Proportion", "Count"),
fillRespRange = TRUE,
digits = 3
)
Arguments
- data
Simulated trial data frame
- respCol
Response column names (given by getEctdColName by default)
- bVar
Variables by which means should be produced ("Dose" by default)
- subset
Subsets to be applied to the data before calculating the means
- diffBase
Logical: Should differences from baseline be summarised instead of raw data?
- idCol
Subject column names (given by getEctdColName by default)
- timeCol
Time column names (given by getEctdColName by default)
- doseCol
Dose column names (given by getEctdColName by default)
- replicateCol
Replicate column names (given by getEctdColName by default)
- respType
Response type: Continuous (default) or Categorical
- catType
For Categorical response, should "Count" (default) or "Proportion" summary be returned?
- fillRespRange
For Categorical response, should we "fill" the range of responses (see below)
- digits
Number of digits to round summary data
Details
The inputs are checked, and the alpha value is parsed using checkSimAlpha Subsets are applied to the data if "subset" is specified and differences from baseline are calculated using calculateDiffsFromBase if required
If respType is "Continuous": * Mean responses are calculated by Replicate
(replicateCol
), Subject (idCol
), Dose (doseCol
), Time
(timeCol
), and any by variables (bVar
) * Means of these means
are then calculated by Replicate (replicateCol
) and any by variables
(bVar
) * The data is rounded (digits
) and returned
When dealing with categorical responses, it is possible that the unique set
of responses could be (say): 1, 2, 4, 5 In this case, it is unclear as to
whether the value "3" should be included in a summary. If "fillRespRange"
is TRUE, it would be included (although would have a count/proportion of
zero) Frequencies are calculated by "Response level" (respCol
) and
any by variables Frequences are converted to proportions (within by variable
level) if required (catType
)
Author
Mike K Smith mstoolkit@googlemail.com