Skip to contents

Calculate a summary of an "observed" dataset (typically used to overlay observed data in a simulated plot or table)

Usage

calculateObsSummary(
  data,
  respCol = getEctdColName("Response"),
  bVar = NULL,
  subset = NULL,
  alpha = 95,
  digits = 3,
  diffBase = FALSE,
  doseCol = getEctdColName("Dose"),
  timeCol = getEctdColName("Time"),
  idCol = getEctdColName("Subject"),
  respType = c("Continuous", "Categorical"),
  catType = c("Count", "Proportion"),
  fillRespRange = TRUE
)

Arguments

data

Observed data frame

respCol

Response column names (given by getEctdColName by default)

bVar

Variables by which summary should be produced (none by default)

subset

Subsets to be applied to the observed data before calculating the summary

alpha

Alpha value for calculation of lower and upper intervals

digits

Number of digits to round summary data

diffBase

Logical: Should differences from baseline be summarised instead of raw data?

doseCol

Dose column names (given by getEctdColName by default)

timeCol

Time column names (given by getEctdColName by default)

idCol

Subject 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)

Value

A data frame of response summaries

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 Subject (idCol), Dose (doseCol), Time (timeCol), and any by variables ((bVar) * The following summaries are then created (based on any by variables (bVar)) - Mean - Median - Minimum - Maximum - Number of non-missing values - Lower alpha\ alpha\

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