circles: Sample (with noise) from circles

circlesR Documentation

Sample (with noise) from circles

Description

These functions generate uniform and stratified samples from configurations of circles of radius 1 in 2- or 3-dimensional space, optionally with noise.

Usage

sample_circle(n, bins = 1L, sd = 0)

sample_circles_interlocked(n, bins = 1L, sd = 0)

Arguments

n

Number of observations.

bins

Number of intervals to stratify by. Default set to 1, which generates a uniform sample.

sd

Standard deviation of (independent multivariate) Gaussian noise.

Details

The function sample_circle() uses the usual sinusoidal parameterization from the unit interval to the unit circle.

The function sample_circles_interlocked() effectively samples from a pair of circles and rotates them in 3-dimensional space so that they are interlocked (perpendicular to each other).

Both functions are length-preserving and admit stratification. If bins = 2, the stratification for the latter function will simply be between the two interlocked circles.

Examples

set.seed(14312L)

# circle in 2-space
x <- sample_circle(120, sd = .1)
plot(x, asp = 1, pch = 19, cex = .5)

# interlocked circles in 3-space
x <- sample_circles_interlocked(120, sd = .1)
pairs(x, asp = 1, pch = 19, cex = .5)

corybrunson/tdaunif documentation built on Feb. 2, 2024, 8:22 p.m.