Description Usage Arguments Value References Examples
This function replicates each entry in a reference sample based on its fitted
weights. This is useful if the result of multiple replication algorithms
are compared to each other, or to generate a full synthetic population
based on the result of a ml_fit
object. Note that, all individual
and group ids of the synthetic population are not the same as those in
the original reference sample, and the total number of groups replicated
is always very close to or equal the sum of the fitted group weights.
1 2 3 4 5 6 | ml_replicate(
ml_fit,
algorithm = c("pp", "trs", "round"),
verbose = FALSE,
.keep_original_ids = FALSE
)
|
ml_fit |
A |
algorithm |
Replication algorithm to use. "trs" is the 'Truncate, replicate, sample' integerisation algorithm proposed by Lovelace et al. (2013), "pp" is weighted sampling with replacement, and "round" is just simple rounding. |
verbose |
If |
.keep_original_ids |
If |
The function returns a replicated sample in data.frame
in the format used in the reference sample of the input ml_fit
object.
1 2 3 |
1 2 3 4 | path <- toy_example("Tiny")
fit <- ml_fit(ml_problem = readRDS(path), algorithm = "entropy_o")
syn_pop <- ml_replicate(fit, algorithm = "trs")
syn_pop
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.