generate {simFrame} | R Documentation |
Generic function for generating data based on a (distribution) model.
generate(control, ...) ## S4 method for signature 'DataControl' generate(control)
control |
a control object inheriting from the virtual class
|
... |
if |
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.
A data.frame
.
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
.
Andreas Alfons
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. URL http://www.jstatsoft.org/v37/i03/.
"DataControl"
, "VirtualDataControl"
require(mvtnorm) mean <- rep(0, 2) sigma <- matrix(c(1, 0.5, 0.5, 1), 2, 2) # using a control object dc <- DataControl(size = 10, distribution = rmvnorm, dots = list(mean = mean, sigma = sigma)) generate(dc) # supply slots of control object as arguments generate(size = 10, distribution = rmvnorm, dots = list(mean = mean, sigma = sigma))