View source: R/functions.syn.r
syn.pmm | R Documentation |
Generates univariate synthetic data using predictive mean matching.
syn.pmm(y, x, xp, smoothing = "", proper = FALSE, ...)
y |
an original data vector of length |
x |
a matrix ( |
xp |
a matrix ( |
proper |
a logical value specifying whether proper synthesis should be conducted. See details. |
smoothing |
smoothing method. See documentation for
|
... |
additional parameters. |
Synthesis of y
by predictive mean matching. The procedure
is as follows:
Fit a linear regression to the original data.
Compute predicted values y.hat
and ysyn.hat
for the original x
and synthesised
xp
covariates respectively.
For each predicted value ysyn.hat
find donor
observations with the closest predicted values y.hat
(ties are broken by random selection), randomly sample one of
them and take its observed value y
as the synthetic value.
The Bayesian version (for proper synthesis) includes additional step before computing predicted values:
Draw coefficients from normal distribution with mean and variance estimated in step 1 and use them to calculate predicted values for the synthesised covariates.
A list with two components:
res |
a vector of length |
fit |
a data frame with regression coefficients and error estimates. |
syn
, syn.smooth
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.