<< Vector Vector Weibull >>

distfun >> distfun > Vector > distfun_vectorrnd

distfun_vectorrnd

Random vectors.

Calling Sequence

x=distfun_vectorrnd(r)
x=distfun_vectorrnd(r,n)
x=distfun_vectorrnd(r,n,sigma)

Parameters

r :

a list with d items describing the multivariate random variable (see below)

n :

a 1-by-1 matrix of floating point integers, the number of rows in x (default n = 1)

sigma :

a d-by-d matrix of doubles, the covariance matrix, symmetric, positive definite (default = identity)

x:

a m-by-n matrix of doubles, the random numbers.

Description

Generate a multivariate random vector given marginal and covariance matrix.

The covariance matrix sigma must have unit diagonal. Its non-diagonal terms must be in the range [0,1).

If sigma is not provided (default), then the multivariate sample is generated by direct simulation, considering that the dimensions are independent.

If sigma is provided, the algorithm produces a sample with Gaussian copula.

The variable r is a list of n items, where r(i) is a list which describes the i-th random variable. The first item in r(i) is a string, which is the short name of the distribution. The used map is defined by distfun_list.

Implementation notes

If sigma is provided, the algorithm is the following.

Examples

sigma = [
3.0  0.5
0.5  1.0
]
v1=list("unif",5,12) // Uniform(min=5,max=12)
v2=list("norm",-5,7) // Normal(mean=-5,sigma=7)
r=list(v1,v2)
n=10 // Number of outcomes
x=distfun_vectorrnd(r,sigma,n)

// Graphical "test" (requires Stixbox)
x=distfun_vectorrnd(r,sigma,1000);
scf();
for i=1:4
subplot(2,2,i)
rho=(i-1)/4;
sigma = [1.0  rho;rho  1.0];
x=distfun_vectorrnd(r,1000,sigma);
plot(x(:,1),x(:,2),"bo");
title("rho="+string(rho));
end
scf();
subplot(1,2,1)
histo(x(:,1));
title("Uniform(5,12)");
subplot(1,2,2)
histo(x(:,2));
title("Normal(-5,7)");

Bibliography

http://web.ics.purdue.edu/~hwan/IE680/Lectures/Chap08Slides.pdf

http://fr.mathworks.com/help/stats/examples/simulating-dependent-random-variables-using-copulas.html

Authors


Report an issue
<< Vector Vector Weibull >>