Learn R Programming

evolvability (version 2.0.1)

randomBeta: Generating selection gradients/vectors in random directions.

Description

randomBeta generates unit length vectors (selection gradients) uniformly distributed in a k-dimensional hypersphere.

Usage

randomBeta(n = 1, k = 2)

Value

randomBeta returns a matrix where the vectors are stacked column wise.

Arguments

n

Number of selection gradients/vectors.

k

Number of dimensions.

Author

Geir H. Bolstad

Details

randomBeta exploits the spherical symmetry of a multidimensional Gaussian density function. Each element of each vector is randomly sampled from a univariate Gaussian distribution with zero mean and unit variance. The vector is then divided by its norm to standardize it to unit length.

Examples

Run this code
# Two vectors of dimension 3:
randomBeta(n = 2, k = 3)

Run the code above in your browser using DataLab