Learn R Programming

tidysynthesis (version 0.1.2)

synth_spec_noise_api: Add, update, or remove noise from a synth_spec object

Description

Add, update, or remove noise from a synth_spec object

Usage

add_custom_noise(synth_spec, ...)

Value

A new synth_spec object.

A new synth_spec object with added custom noise.

Arguments

synth_spec

A synth_spec object

...

Optional named lists with two elements, vars and noise, mapping variable names to samplers.

Examples

Run this code

synth_spec <- synth_spec()

noise1 <- noise(
  add_noise = TRUE, 
  noise_func = add_noise_kde,
  noise_params = list(
    n_ntiles = 2
  )
)

add_custom_noise(
  synth_spec = synth_spec, 
  list("vars" = c("a", "b", "c"), "noise" = noise1)
)

Run the code above in your browser using DataLab