cdf of multivariate normal random numbers

1 回表示 (過去 30 日間)
PChoppala
PChoppala 2013 年 8 月 8 日
Hi
I want to find the cdf of a set of 1000 bivariate normal random numbers that are generated by
X=mvnrnd([3,12],[1,.2;.2,1],1000);
To obtain the cdf for a 1d distribution, I can evaluate the cumsum of the probability of each sample after the samples have been sorted in ascending order. But I am confused on how to do this for a bivariate or (for greater dimension) case. I appreciate you help on this.

回答 (1 件)

Shashank Prasanna
Shashank Prasanna 2013 年 8 月 8 日
  2 件のコメント
PChoppala
PChoppala 2013 年 8 月 8 日
To get the cdf I only have X. Is the below piece of code is a correct way of obtaining that (or what you are referring to)?
X=mvnrnd([3,12],[1,.3;.3,1],625);
mu=mean(X);
Sigma=corrcoef(X);
N=25;
[X1,X2] = meshgrid(linspace(1,5,N)', linspace(9,15,N)');
XX = [X1(:) X2(:)];
C = mvncdf(XX, mu, Sigma);
contour(X1,X2,reshape(C,N,N));
Shashank Prasanna
Shashank Prasanna 2013 年 8 月 8 日
It is correct for what it is doing. Also, you already have the means and covariance:
[3,12] and [1,0.3;0.3,1]
1) You don't don't have to re estimate them you can use them directly.
2) MVNCDF expects the Covariance and not correlation matrix. Use COV function instead.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by