View source: R/functions.syn.r

syn.logreg | R Documentation |

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

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

`y` |
an original data vector of length |

`x` |
a matrix ( |

`xp` |
a matrix ( |

`denom` |
an original denominator vector of length |

`denomp` |
a synthesised denominator vector of length |

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

`...` |
additional parameters. |

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

Fit a logistic regression to the original data.

Calculate predicted inverse logits for synthesied covariates.

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.

A list with two components:

`res` |
a vector of length |

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

`syn`

, `glm`

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.