Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

syn.sample

Synthesis by simple random sampling


Description

Generates a random sample from the observed data.

Usage

syn.sample(y, xp, smoothing = "", cont.na = NA, proper = FALSE, ...)

Arguments

y

an original data vector of length n.

xp

a target length k of a synthetic data vector.

smoothing

smoothing method for a continous variable.

cont.na

a vector of codes for missing values for continuous variables that should be excluded from smoothing.

proper

if proper = TRUE values are sampled from a bootstrapped sample of the original data.

...

additional parameters passed to sample.

Details

A simple random sample with replacement is taken from the observed values in y and used as synthetic values. A Guassian kernel smoothing can be applied to continuous variables by setting smoothing parameter to "density". It is recommended as a tool to decrease the disclosure risk.

Value

A list with two components:

res

a vector of length k with synthetic values of y.

fit

a name of the method used for synthesis ("sample").

See Also


synthpop

Generating Synthetic Versions of Sensitive Microdata for Statistical Disclosure Control

v1.6-0
GPL-2 | GPL-3
Authors
Beata Nowok [aut, cre], Gillian M Raab [aut], Chris Dibben [ctb], Joshua Snoke [ctb], Caspar van Lissa [ctb]
Initial release
2020-09-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.