generate: Generate data

Description Usage Arguments Details Value Methods Author(s) References See Also Examples

Description

Generic function for generating data based on a (distribution) model.

Usage

1
2
3
4
generate(control, ...)

## S4 method for signature 'DataControl'
generate(control)

Arguments

control

a control object inheriting from the virtual class "VirtualDataControl" or a character string specifying such a control class (the default being "DataControl").

...

if control is a character string or missing, the slots of the control object may be supplied as additional arguments. See "DataControl" for details on the slots.

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

1
2
3
4
5
6
7
8
# 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))

simFrame documentation built on Oct. 14, 2021, 5:24 p.m.