hexm26
从网上抄的一段程序,不知道对你有没有用:
/* Generate n random vector from a p dimensional population
with mean mu and the variance covariance matrix sigma */
proc iml ;
seed = 549065467 ;
n = 4 ;
sigma = { 4 2 1,
2 3 1,
1 1 5 };
mu = {1, 3, 0};
p = nrow(sigma);
m = repeat(mu‘,n,1) ;
g =root(sigma);
z =normal(repeat(seed,n,p)) ;
y = z*g + m ;
print ’Multivariate Normal Sample’;
print y;
jingju11
proc iml;
mu = { 1, 2.0 };
sigma= { 1 0.25, 0.25 1.5};
call vnormal(vNorm, mu, sigma, 50);
print vNorm;
*生成50个向量,这里是bivariate.
*if need multivariate,just specify corresponding mu and sigma matrix;