MixedTypeEngine-class {Umpire} | R Documentation |
The "MixedTypeEngine" Class
Description
A MixedTypeEngine combines a ClinicalEngine (which defines the combinatorics
of hits and block hyperparameters that determine cluster identities and behavior),
a stored ClinicalNoiseModel
, and cutpoints for generating mixed type
data generated by makeDataTypes
into an object that can be used to
re-generate downstream datasets with shared parameters.
Usage
MixedTypeEngine(ce, noise, cutpoints)
## S4 method for signature 'MixedTypeEngine'
rand(object, n, keepall = FALSE, ...)
## S4 method for signature 'MixedTypeEngine'
summary(object, ...)
Arguments
ce |
Object of class |
noise |
Object of class |
cutpoints |
a list with the properties of the |
object |
object of class |
n |
a non-negative integer |
keepall |
a logical value |
... |
additional arguments for generic functions. |
Details
The MixedTypeEngine is a device for a parameter set used to generate a simulated set of clinical data which can be used to store these parameters and to generate related datasets downstream. Building a MixedTypeEngine requires many parameters. You can supply these parameters in mutliple steps:
Construct a
ClinicalEngine
.Contruct a
ClinicalNoiseModel
.Use
rand
rand to generate a "raw" data set from theClinicalEngine
.Use
blur
to add noise to the raw data.Feed the noisy data into
makeDataTypes
to generate a mixed-type dataset, with cut points.Pass the
ClinicalEngine
,ClinicalNoiseModel
, and cutpoints into theMixedTypeEngine
constructor.
The alternative method is to pass the parameters for Steps 1, 2, and 5
directly into the MixedTypeEngine
directly, as lists, and it will
carry out steps 3-5 automatically. Note, however, that instead of
passing a dataset
to be used by the makeDataTypes
function,
you instead set the value of N
to the desired number of patients
used during construction. Also, if you use the explicit steps, you
can save the intermediate data sets that are generated. If you simply
pass all of the parameters to the constructor, those intermediate data
sets are discarded, and you must generate a new data set using
rand
.
Objects from the Class
Objects can be created by a direct call to
new, though using the constructor
MixedTypeEngine
is preferred.
Methods
- rand(object, n, keepall, ...)
Generates
nrow(Engine)*n
matrix representing clinical features ofn
patients following the underlying distribution, noise, and data discretization pattern captured in the object ofMixedTypeEngine
. Ifkeepall == TRUE
, it reurns a list containing a data frame namedclinical
and three data matrices calledraw
,noisy
, andbinned
. Ifkeepall == FALSE
, then noly theclinical
andbinned
components are returned.
- summary(object, ...)
Prints a summary of the object.
Author(s)
Kevin R. Coombes krc@silicovore.com, Caitlin E. Coombes caitlin.coombes@osumc.edu
See Also
Engine
CancerModel
CancerEngine
ClinicalNoiseModel
makeDataTypes
Examples
## Generate a Clinical Engine of continuous data
## with clusters generated from variation on the base CancerEngine
ce <- ClinicalEngine(20, 4, TRUE)
summary(ce)
## Generate an initial data set
set.seed(194718)
dset <- rand(ce, 300)
class(dset)
names(dset)
summary(dset$clinical)
dim(dset$data)
## Add noise before binning mixed type data
cnm <- ClinicalNoiseModel(nrow(ce@localenv$eng)) # default
noisy <- blur(cnm, dset$data)
## Set the data mixture
dt <- makeDataTypes(dset$data, 1/3, 1/3, 1/3, 0.3)
## Store the cutpoints
cp <- dt$cutpoints
## Use the pieces from above to create an MTE.
mte <- MixedTypeEngine(ce,
noise = cnm,
cutpoints = dt$cutpoints)
## Use the MTE rand method to generate
## multiple data sets with the same parameters
R <- rand(mte, 20)
summary(R)
S <- rand(mte, 20)
summary(S)