Synthesis with bagging
syn.bag.RdGenerates univariate synthetic data using bagging. It uses
randomForest function from the randomForest package with
number of sampled predictors equal to number of all predictors.
Arguments
- y
an original data vector of length
n.- x
a matrix (
nxp) of original covariates.- xp
a matrix (
kxp) of synthesised covariates.- smoothing
smoothing method for numeric variable. See
syn.smooth.- proper
for proper synthesis (
proper = TRUE) a model is fitted to a bootstrapped sample of the original data.- ntree
number of trees to grow.
- ...
additional parameters passed to
randomForest.
Value
A list with two components:
- res
a vector of length
kwith synthetic values ofy.- fit
the model fitted to the observed data that was used to produce synthetic values.