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

syn.logreg

Synthesis by logistic regression


Description

Generates univariate synthetic data for binary or binomial response variable using logistic regression model.

Usage

syn.logreg(y, x, xp, denom = NULL, denomp = NULL, proper = FALSE, ...)

Arguments

y

an original data vector of length n.

x

a matrix (n x p) of original covariates.

xp

a matrix (k x p) of synthesised covariates.

denom

an original denominator vector of length n for a binomial regression model.

denomp

a synthesised denominator vector of length k for a binomial regression model.

proper

a logical value specifying whether proper synthesis should be conducted. See details.

...

additional parameters.

Details

Synthesis for binary response variables by the non-Bayesian or approximate Bayesian logistic regression model. The non-Bayesian method consists of the following steps:

  1. Fit a logistic regression to the original data.

  2. Calculate predicted inverse logits for synthesied covariates.

  3. Compare the inverse logits to a random (0,1) deviate and get synthetic values.

The Bayesian version (for proper synthesis) includes additional step before computing inverse logits, namely drawing coefficients from normal distribution with mean and variance estimated in step 1.

The method relies on the standard glm.fit function. Warnings from glm.fit are suppressed. Perfect prediction is handled by the data augmentation method.

Value

A list with two components:

res

a vector of length k with synthetic values of y.

fit

a summary of the model fitted to the observed data and used to produce synthetic values.

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.