sample_sphere_volume: Sample vectors uniformly from the volume of a sphere

Description

Sample finite-dimensional vectors to use as latent position vectors in
random dot product graphs

Usage

sample_sphere_volume(dim, n = 1, radius = 1, positive = TRUE)

Arguments

dim

Integer scalar, the dimension of the random vectors.

n

Integer scalar, the sample size.

radius

Numeric scalar, the radius of the sphere to sample.

positive

Logical scalar, whether to sample from the positive orthant
of the sphere.

Value

A dim (length of the alpha vector for
sample_dirichlet) times n matrix, whose columns are the sample
vectors.

Details

sample_sphere_volume generates uniform samples from \(S^{dim-1}\)
(the (dim-1)-sphere) i.e. the Euclidean norm of the samples is
smaller or equal to radius.