Data Stack
DataStack
function
The 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 DataModel
and SimParameters
objects.
Description
Inputs
The DataStack
function requires the input of two pre-specified objects defined in the following two arguments:
-
data.model
defines aDataModel
object, as described in this page. -
sim.parameters
defines aSimParameters
object, as described in this page.
Outputs
The DataStack
function returns a DataStack
object containing a list with the following components:
-
description
: a description of the object. -
data.set
: a list of sizen.sims
defined in theSimParameters
object. This list contains the data generated for each data scenario (data.scenario
level) and each sample (sample
level). The data generated for the ith simulation run, the jth data scenario and the kth sample is stored indata.stack$data.set[[i]]$data.scenario[[j]]$sample[[k]]
wheredata.stack
is theDataStack
object. -
data.scenario.grid
: a data frame indicating all data scenarios according to theDataModel
object. -
data.structure
: a list containing the data structure according to theDataModel
object. -
sim.parameters
: a list containing the simulation parameters according toSimParameters
object.
Example
The following example illustrates the use of the DataStack
function.
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 DataModel
object
The data model is specified below:
Specification of the SimParameters
object
Additionally, the simulation parameters are specified:
Data generation
The data generated in the CSE function can be obtained using the DataStack
function as follows:
Manipulation of a DataStack
object
Once the 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 SimParameters
object.
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:
ExtractDataStack
function
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.
Description
Inputs
The ExtractDataStack
function requires the input of a pre-specified object defined in the following two arguments:
-
data.stack
defines aDataStack
object, as described above. -
data.scenario
defines the data scenario index to extract. By default all data scenarios will be extracted. -
sample.id
defines the sample id to extract. By default all sample ids will be extracted. -
simulation.run
defines the simulation run index. By default all simulation runs will be extracted.
Outputs
The ExtractDataStack
function returns a list having the same structure as the data.set
argument of a DataStack
object
data.set
: a list of size corresponding to the number of simulation runs specified by the user defined in thesimulation.run
argument. This list contains the data generated for each data scenario (data.scenario
argument) and each sample (sample.id
argument) specified by the user.
Example
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[[1]]
). Similarly, as only one data scenario has been requested, the result for the 2nd data scenario is now in the first position (case.study1.extracted.data.stack$data.set[[1]]$data.scenario[[1]]
).