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.0390  gaussian
#>  2 -0.00927 gaussian
#>  3 -0.0186  gaussian
#>  4 -0.0188  gaussian
#>  5 -0.0525  gaussian
#>  6  0.00678 gaussian
#>  7 -0.0521  gaussian
#>  8  0.0686  gaussian
#>  9  0.0106  gaussian
#> 10 -0.0210  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.0106  t_distributed
#>  2  0.0601  t_distributed
#>  3 -0.00778 t_distributed
#>  4  0.116   t_distributed
#>  5  0.00472 t_distributed
#>  6 -0.0952  t_distributed
#>  7  0.0545  t_distributed
#>  8  0.00486 t_distributed
#>  9 -0.0206  t_distributed
#> 10 -0.105   t_distributed
#> # ℹ 490 more rows