ellipses {tdaunif} | R Documentation |
Sample (with noise) from ellipses
Description
These functions generate uniform samples from configurations of ellipses of major or minor radius 1 in 2- or 3-dimensional space, optionally with noise.
Usage
sample_ellipse(n, ar = 1, sd = 0)
sample_cylinder_elliptical(n, ar = 1, width = 1, sd = 0)
Arguments
n |
Number of observations. |
ar |
Aspect ratio for an ellipse (ratio of major and minor radii). |
sd |
Standard deviation of (independent multivariate) Gaussian noise. |
width |
Width of the cylinder (with respect to the fixed radius of the ellipse). |
Details
The function sample_ellipse()
uses the usual sinusoidal parameterization
from the unit interval to an ellipse with radii 1 and 1/ar
. The uniform
sample is generated through a rejection sampling process as described by
Diaconis, Holmes, and Shahshahani (2013).
Examples
set.seed(97205L)
# ellipses in 2-space
x <- sample_ellipse(120, ar = 6)
plot(x, asp = 1, pch = 19, cex = .5)
x <- sample_ellipse(120, ar = 1/6)
plot(x, asp = 1, pch = 19, cex = .5)
# ellipses in 2-space
x <- sample_ellipse(120, ar = 6, sd = .1/6)
plot(x, asp = 1, pch = 19, cex = .5)
x <- sample_ellipse(120, ar = 1/6, sd = .1)
plot(x, asp = 1, pch = 19, cex = .5)
# cylinders in 3-space
x <- sample_cylinder_elliptical(120, ar = 1)
pairs(x, asp = 1, pch = 19, cex = .5)
x <- sample_cylinder_elliptical(120, ar = 3, width = 2*pi)
pairs(x, asp = 1, pch = 19, cex = .5)
[Package tdaunif version 0.2.0 Index]