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.0512  gaussian
#>  2 -0.00849 gaussian
#>  3 -0.0437  gaussian
#>  4  0.0120  gaussian
#>  5 -0.00123 gaussian
#>  6  0.0429  gaussian
#>  7  0.0652  gaussian
#>  8 -0.0194  gaussian
#>  9 -0.00127 gaussian
#> 10  0.0122  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.0125  t_distributed
#>  2 -0.0363  t_distributed
#>  3 -0.206   t_distributed
#>  4  0.277   t_distributed
#>  5 -0.257   t_distributed
#>  6  0.231   t_distributed
#>  7 -0.00622 t_distributed
#>  8 -0.0497  t_distributed
#>  9 -0.00742 t_distributed
#> 10 -0.0302  t_distributed
#> # ℹ 490 more rows