rhypersphere {gena}R Documentation

Hypersphere

Description

Simulates uniform random variates from the hypersphere.

Usage

rhypersphere(n, dim = 2, radius = 1, center = rep(0, dim), type = "boundary")

Arguments

n

number of observations to simulate.

dim

dimensions of hypersphere.

radius

radius of hypersphere.

center

center of hypersphere.

type

character; if "boundary" (default) then random variates are simulated from the hypersphere. If "inside" random variates are points lying inside the hypersphere. If "non-uniform" then random variates are non-uniform and simulated from the inner part of the hypersphere simply by making radius a uniform random variable between 0 and radius.

Value

The function returns a vector of random variates.

Examples

set.seed(123)
# Get 5 random uniform variates from 3D hypersphere
# of radius 10 centered at (2, 3, 1)
rhypersphere(n = 5, dim = 3, radius = 10, center = c(2, 3, 1))


[Package gena version 1.0.0 Index]