public class RandomReturns extends Object implements dev.nm.stat.random.Seedable
Using this example. Generates an observations-by-assets matrix by multiplying random vectors by a Cholesky factor. NM matrix and vector indexing starts at one. Supply two seeds to seed(long...): the current implementation accesses seeds[1] even after its single-seed branch; this limitation is recorded in the audit notes.
Model and publication. Related theory and the scope of this example are distinguished below.
Implementation in this tutorial. This utility supplies artificial return observations rather than an economic model from a specific publication. A Cholesky factor introduces cross-asset dependence. The marginal generator and sample length remain explicit inputs, and the resulting matrix is not a historical performance series.
| Constructor and Description |
|---|
RandomReturns() |
RandomReturns(dev.nm.stat.random.rng.univariate.RandomNumberGenerator rng1) |
| Modifier and Type | Method and Description |
|---|---|
dev.nm.algebra.linear.matrix.doubles.Matrix |
getRandomCovariance(int N) |
dev.nm.algebra.linear.matrix.doubles.Matrix |
getRandomReturns(int N,
int T) |
dev.nm.algebra.linear.matrix.doubles.Matrix |
getRandomReturns(dev.nm.algebra.linear.matrix.doubles.Matrix S,
int T)
Applies a Cholesky factor of S to generated vectors.
|
void |
seed(long... seeds)
Seeds the return and correlation generators.
|
public RandomReturns(dev.nm.stat.random.rng.univariate.RandomNumberGenerator rng1)
public RandomReturns()
public dev.nm.algebra.linear.matrix.doubles.Matrix getRandomCovariance(int N)
public dev.nm.algebra.linear.matrix.doubles.Matrix getRandomReturns(dev.nm.algebra.linear.matrix.doubles.Matrix S,
int T)
S - positive-definite square covariance input (one row/column per asset)T - number of generated observationspublic dev.nm.algebra.linear.matrix.doubles.Matrix getRandomReturns(int N,
int T)
public final void seed(long... seeds)
seed in interface dev.nm.stat.random.Seedableseeds - two seeds, first for rng1 and second for rng2; the current
implementation does not safely support fewer than two seedsCopyright © 2026. All rights reserved.