| generate | R Documentation |
generate() draws synthetic records from a fitted model such as an
sp_synthesizer (see fit_synthesizer()) or an sp_ts_synthesizer (see
fit_synthesizer.ts()).
generate(object, ...)
## S3 method for class 'sp_synthesizer'
generate(
object,
n = object$n_train,
seed = NULL,
dependence = 1,
closeness = 1,
perturb = NULL,
stratum_sizes = c("multinomial", "proportional"),
...
)
## S3 method for class 'sp_ts_synthesizer'
generate(object, n = object$n_train, seed = NULL, start = object$start, ...)
object |
A fitted model. |
... |
Further arguments passed to methods. |
n |
Number of records (rows) to generate. Defaults to the number of rows in the training data. |
seed |
Optional random seed. The global random number generator state is restored afterwards. |
dependence |
Number in [0, 1] scaling the strength of the dependence between variables: 1 (default) reproduces the fitted copula, 0 generates independent columns. Intermediate values shrink the copula correlation matrix towards the identity; the marginal distributions are unaffected. |
closeness |
Number in [0, 1] controlling how close the synthetic
data are to the real data: 1 (default) reproduces the fitted model as
closely as possible; smaller values move records away from the real
ones (noise on continuous variables, random re-drawing of categories) and
loosen the distributions (flatter category probabilities, weaker
dependence). With |
perturb |
Optional |
stratum_sizes |
For stratified models: |
start |
Start time of the generated series (default: the start of the training series). |
Synthetic data of the same type as the training data: a data
frame, matrix, vector or ts object.
fit_synthesizer(), synthesize(), generate_to_file()
fit <- fit_synthesizer(mtcars)
generate(fit, n = 5, seed = 42)
# weaker dependence
syn <- generate(fit, n = 500, dependence = 0.5, seed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.