NTRANDMULTINORM
Returns multivariate normal pseudo random number(s) based on Mersenne Twister Algorithm which has long period (219937-1), high order of equidistribution (623 dimensions).
Syntax
NTRANDMULTINORM(
- Size,
- Cov,
- Mean,
- Algorithm,
- Random seed1,
- Random seed2,
- Use invert func,
- Use antithetic,
- Use resampling
)
Parameters
- Size is # of random numbers (Positive integer).
- Cov is a covariance matrix.
- Mean is a vector of the arithmetic means of each variable.
- Algorithm is a integer value that determines a method to generate uniform random number.
- 0: Mersenne Twister(2002)
- 1: Mersenne Twister(1998)
- 2: Numerical Recipes
ran2()
- Random seed1 is 1st. random seed.
- Random seed2 is 2nd. random seed.
- Use invert func is a logical value that determines a method to generate normal random number. If Use invert func is TRUE, inverse function method is used; if FALSE, box-Muller method is used.
- Use antithetic is a logical value that determines antithetic variant method is used or not. If Use antithetic is TRUE, antithetic variant method is used; if FALSE, antithetic variant method is not used.
- Use resampling is a logical value that determines quadratic resampling method is used or not. If Use resampling is TRUE, quadratic resampling method is used; if FALSE, quadratic resampling method is not used.
Example
- The example may be easier to understand if you copy it to a blank worksheet
How to copy an example
- Create a blank workbook or worksheet.
- Select the example in the Help topic.
Note Do not select the row or column headers.
Selecting an example from Help
- Press CTRL+C.
- In the worksheet, select cell A1, and press CTRL+V.
- To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
1 2 3 4 5 6 7 8
A B C D Data Data Data Description 1.44 0.48 -0.36 cov. matrix 0.48 0.64 0 cov. matrix -0.36 0 0.25 cov. matrix Data Data Data Description 1 2 3 mean vector Formula Description (Result) =NTRANDMULTINORM(100,A2:C4,A6:C6) 100 normal deviates (x 3 variables) for the terms above Note The formula in the example must be entered as an array formula. After copying the example to a blank worksheet, select the range A8:C107 starting with the formula cell. Press F2, and then press CTRL+SHIFT+ENTER.
- Download sample excel sheet
- See tutorial video
See also
- Normal distribution (Multi variables)
- Choice of the random number generator algorithm
- Why I always see the same result even if I input formula into multiple cell?