Learn R Programming

tidysynthesis (version 0.1.2)

add_noise_disc_gaussian: Add discrete normal noise with mean 0 to predicted values with constant variance

Description

Add discrete normal noise with mean 0 to predicted values with constant variance

Usage

add_noise_disc_gaussian(
  model,
  new_data,
  conf_model_data,
  outcome_var,
  col_schema,
  pred,
  variance = NULL,
  rho = NULL,
  sensitivity = NULL,
  increment = 1
)

Value

A numeric vector with noise added to each prediction

Arguments

model

A model_spec or a list of model_specs from library(parsnip)

new_data

A data frame used to generate predictions

conf_model_data

A data frame for estimating the predictive model

outcome_var

A string name representing the outcome variable

col_schema

A list of column schema specifications for the new variable

pred

A vector of values predicted by the model

variance

float, sampling variance for additive noise

rho

float, alternative privacy loss budget prescribed by the Gaussian mechanism under rho-zero-concentrated differential privacy.

sensitivity

float, alternative sample sensitivity prescribed by the Gaussian mechanism under rho-zero-concentrated differential privacy.

increment

Numeric indicating space between discrete noise samples, defaults to 1. Note that this does not impact the noise sampling variance, as the increment rescales noise distributions specified by sampling variance.

Examples

Run this code

add_noise_disc_gaussian(
  model = NULL,
  new_data = NULL,
  conf_model_data = NULL,
  outcome_var = NULL,
  col_schema = NULL,
  pred = 1:100,
  variance = 3
)

Run the code above in your browser using DataLab