Learn R Programming

mgc (version 2.0.2)

mgc.sims.2sphere: Sample from Unit 2-Sphere

Description

Sample from the 2-sphere in d-dimensions.

Usage

mgc.sims.2sphere(n, d, r, cov.scale = 0)

Arguments

n

the number of samples.

d

the number of dimensions.

r

the radius of the 2-ball. Defaults to 1.

cov.scale

if desired, sample from 2-ball with error sigma. Defaults to 0, which has no noise.

Value

the points sampled from the sphere, as a [n, d] array.

Examples

Run this code
# NOT RUN {
library(mgc)
# sample 100 points from 3-d 2-sphere with radius 2
X <- mgc.sims.2sphere(100, 3, 2)
# }

Run the code above in your browser using DataLab