Simple deterministic smooth shapes for simulation truth
Source:R/simulation_helpers.R
sim_smooth_shapes.RdThese helpers are intended for readable simulation specifications. They work
best with inputs already scaled to [0, 1], for example by
sim_rescale01().
Usage
sim_smooth_linear(x, slope = 1, center = TRUE)
sim_smooth_sin(x, amplitude = 1, period = 1, phase = 0)
sim_smooth_bump(x, amplitude = 1, location = 0.5, width = 0.15)
sim_smooth_sigmoid(x, amplitude = 1, location = 0.5, steepness = 10)
sim_smooth_u(x, amplitude = 1, location = 0.5)
sim_smooth_wiggle(x, amplitude = 1)Arguments
- x
Numeric input, usually scaled to
[0, 1].- slope
Linear slope.
- center
Logical; if
TRUE, centerxaround 0.5 for the linear shape.- amplitude
Effect amplitude.
- period
Period of the sinusoid in units of
x.- phase
Phase shift for the sinusoid.
- location
Center/location of the bump, sigmoid, or U-shape.
- width
Width of the Gaussian bump.
- steepness
Steepness of the sigmoid transition.