Skip to contents

Generate Synthetic Noise

Usage

noise_gen(n = 500, type = "gaussian", level = 0.01, seed = NULL)

Arguments

n

Integer. Number samples to generate. Default is 500.

type

Character string specifying the type of noise to generate. Supported types:

  • "gaussian": Standard normal distribution.

  • "uniform": Uniform distribution between -level and +level.

  • "lognormal": Log-normal distribution.

  • "t_distributed": Heavy-tailed t-distribution with 3 degrees of freedom.

  • "cauchy": Extremely heavy-tailed Cauchy distribution.

  • "beta_noise": Beta distribution shifted and scaled to [-level, level].

  • "exponential": Positive-only exponential distribution.

  • "microstructure": Oscillatory sinusoidal pattern with additive Gaussian noise.

level

Numeric. Controls the scale (standard deviation, range, or spread) of the noise. Default is 0.01.

seed

Optional integer. Sets a random seed for reproducibility.

Value

A tibble with two columns:

  • value: Numeric vector of generated noise samples.

  • type: Character string indicating the type of noise.

Examples

# Gaussian noise with small scale
noise_gen(500, type = "gaussian", level = 0.05)
#> # A tibble: 500 × 2
#>      value type    
#>      <dbl> <chr>   
#>  1  0.0705 gaussian
#>  2  0.0575 gaussian
#>  3 -0.0379 gaussian
#>  4  0.0291 gaussian
#>  5 -0.0287 gaussian
#>  6  0.0416 gaussian
#>  7  0.0152 gaussian
#>  8  0.0725 gaussian
#>  9  0.0377 gaussian
#> 10 -0.0194 gaussian
#> # ℹ 490 more rows

# Heavy-tailed noise
noise_gen(500, type = "t_distributed", level = 0.1)
#> # A tibble: 500 × 2
#>      value type         
#>      <dbl> <chr>        
#>  1  0.0276 t_distributed
#>  2 -0.140  t_distributed
#>  3 -0.147  t_distributed
#>  4 -0.0156 t_distributed
#>  5 -0.0225 t_distributed
#>  6  0.283  t_distributed
#>  7  0.0429 t_distributed
#>  8  0.250  t_distributed
#>  9  0.125  t_distributed
#> 10 -0.0934 t_distributed
#> # ℹ 490 more rows