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

syn.nested

Synthesis for a variable nested within another variable.


Description

Synthesizes one variable (y) from another one (x) when y is nested in the categories of x. A bootstrap sample is created from the original values of y within each category of xp (the synthesised values of the grouping variable).

Usage

syn.nested(y, x, xp, smoothing = "", cont.na = NA,  ...)

Arguments

y

an original data vector of length n for the nested variable.

x

an original data vector of length n for the variable within which y is nested.

xp

a vector of length k with synthetic values of x.

smoothing

if this has the value "density" then values of a numeric y are smoothed after synthesis with a kernel density smoother.

cont.na

when y is numeric this can be a list or a vector giving values of y that indicate missing values.

...

additional parameters.

Details

An example would be when x is a classification of occupations and y is a more detailed sub-classification. It is intended that x is a categorical (factor) variable. A warning will be issued if the original y is not nested within x. A variable synthesised by syn.nested() is automatically excluded from predicting later variables because it will provide no extra information, given its grouping variable. syn.nested() is also used for the final synthesis of variables in syn() when the option numtocat is used to synthesise numerical variables as groups.

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 ("nested").


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.