simulate_swiss_roll_1d_2d.RdSimulates a 2D spiral (often used as a 1D analogue of a swiss roll) parameterized by \(t \in [t_{\min}, t_{\max}]\). The noiseless curve is \((x(t),y(t)) = (t\cos t, t\sin t)\). Independent Gaussian noise is added to each coordinate.
Integer \(\ge 1\). Number of samples.
Numeric vector of length 2 specifying \([t_{\min}, t_{\max}]\).
Nonnegative numeric. Standard deviation of Gaussian noise. May be a scalar (applied to both coordinates) or a length-2 vector for coordinate-specific noise.
Optional integer. If not NULL, sets the RNG seed via set.seed().
A list with components:
t: numeric vector of length n, the latent parameter.
truth: data.frame with columns x, y for the noiseless curve.
obs: data.frame with columns x, y for the noisy observations.
sim <- simulate_swiss_roll_1d_2d(n = 300, sigma = 0.1, seed = 1)
head(sim$obs)
#> x y
#> 1 -4.818342 7.025793
#> 2 -8.512613 -5.259583
#> 3 12.397960 3.026388
#> 4 4.641363 -17.056883
#> 5 2.016847 7.101558
#> 6 2.224280 -17.250608