DataStack function can be used to get the data generated in the Clinical Scenario Evaluation. The generation of the data stack is based on the pre-defined
DataStack function requires the input of two pre-specified objects defined in the following two arguments:
DataModelobject, as described in this page.
SimParametersobject, as described in this page.
DataStack function returns a
DataStack object containing a list with the following components:
description: a description of the object.
data.set: a list of size
n.simsdefined in the
SimParametersobject. This list contains the data generated for each data scenario (
data.scenariolevel) and each sample (
samplelevel). The data generated for the ith simulation run, the jth data scenario and the kth sample is stored in
data.scenario.grid: a data frame indicating all data scenarios according to the
data.structure: a list containing the data structure according to the
sim.parameters: a list containing the simulation parameters according to
The following example illustrates the use of the
In this example, we will use the data model and simulation parameters specified in the Case study 1 for normally distributed endpoints (see Case study 1).
Specification of the
The data model is specified below:
Specification of the
Additionally, the simulation parameters are specified:
The data generated in the CSE function can be obtained using the
DataStack function as follows:
Manipulation of a
DataStack object has been generated, the user can manipulate the object easily as it is structure as a
list object. Basically, the data sets are stored in the
data.set level of the object. This length of the list corresponds to the number of simulations specified in the
Within each simulation run, a nested list is used to store the data set for each data scenario and each sample. For example, the user can access to the data generated in the 100th simulation run for the 2nd data scenario as follows:
Finally, the data set generated for the first sample defined in the data model is accessible as follows:
To ease the manipulation of a
DataStack object, a function has been created to extract a particular set of data stack according to the data scenario, sample id and simulation runs index.
ExtractDataStack function requires the input of a pre-specified object defined in the following two arguments:
DataStackobject, as described above.
data.scenariodefines the data scenario index to extract. By default all data scenarios will be extracted.
sample.iddefines the sample id to extract. By default all sample ids will be extracted.
simulation.rundefines the simulation run index. By default all simulation runs will be extracted.
ExtractDataStack function returns a list having the same structure as the
data.set argument of a
data.set: a list of size corresponding to the number of simulation runs specified by the user defined in the
simulation.runargument. This list contains the data generated for each data scenario (
data.scenarioargument) and each sample (
sample.idargument) specified by the user.
Returning to our example, the user can extract the data set generated for the 100th simulation run and the 2nd data scenario as follows:
A carefull attention should be paid on the index of the nested lists. As only one simulation run index has been specified in this example, the result for the 100th simulation runs is stored in the first level of the list (
case.study1.extracted.data.stack$data.set[]). Similarly, as only one data scenario has been requested, the result for the 2nd data scenario is now in the first position (