generate {simFrame} | R Documentation |
Generate data
Description
Generic function for generating data based on a (distribution) model.
Usage
generate(control, ...)
## S4 method for signature 'DataControl'
generate(control)
Arguments
control |
a control object inheriting from the virtual class
|
... |
if |
Details
The control class "DataControl"
is quite simple but general. For
user-defined data generation, it often suffices to implement a function and
use it as the distribution
slot in the "DataControl"
object.
See "DataControl"
for some requirements for such a
function.
However, if more specialized data generation models are required, the
framework can be extended by defining a control class "MyDataControl"
extending "VirtualDataControl"
and the corresponding
method generate(control)
with signature 'MyDataControl'
. If,
e.g., a specific distribution or mixture of distributions is frequently used
in simulation experiments, a distinct control class may be more convenient
for the user.
Value
A data.frame
.
Methods
control = "character"
generate data using a control class specified by the character string
control
. The slots of the control object may be supplied as additional arguments.control = "missing"
generate data using a control object of class
"DataControl"
. Its slots may be supplied as additional arguments.control = "DataControl"
generate data as defined by the control object
control
.
Author(s)
Andreas Alfons
References
Alfons, A., Templ, M. and Filzmoser, P. (2010) An Object-Oriented Framework for Statistical Simulation: The R Package simFrame. Journal of Statistical Software, 37(3), 1–36. doi: 10.18637/jss.v037.i03.
See Also
"DataControl"
, "VirtualDataControl"
Examples
# using a control object
dc <- DataControl(size = 10, distribution = rnorm,
dots = list(mean = 0, sd = 2))
generate(dc)
# supply slots of control object as arguments
generate(size = 10, distribution = rnorm,
dots = list(mean = 0, sd = 2))