应用cdf函数从Matlab中的多元法线绘制

时间:2017-05-05 12:57:40

标签: matlab

为什么我在Matlab中应用cdf函数从多元正态分布中提取我没有统一分布?

P=10000; %number of draws

%% 4 random variables (X,Y,Z,W) jointly distributed as a normal with mean mu:=(muX, muY, muZ, muW)
% and variance sigma:=(sigmaX2 sigmaXY 0 0; sigmaXY sigmaY2 0 0; 0 0 sigmaZ2 sigmaZW; 0 0 sigmaZW sigmaW2)

muX=0.3;
muY=-0.1;
muZ=0.5;
muW=0.2;
sigmaX2=1;
sigmaY2=1;
sigmaZ2=1;
sigmaW2=1;
sigmaXY=-0.7;
sigmaZW=0.6;

mu=[muX, muY, muZ, muW];
sigma=[sigmaX2, sigmaXY, 0, 0; sigmaXY, sigmaY2, 0, 0; 0, 0, sigmaZ2, sigmaZW; 0, 0, sigmaZW, sigmaW2];


%P random draws from the joint distribution of (X,Y,Z,W)
%indep(p,:) is a 1x4 vector representing a draw from the joint distribution of (X,Y,Z,W)
indep = mvnrnd(mu,sigma,P);


%Transform each draw (x,y) of (X,Y) in a draw in [0,1] using cdf(x,y). 
Qindep = mvncdf(indep(:,1:2),[muX, muY],[sigmaX2, sigmaXY; sigmaXY, sigmaY2]);

%Plot the empirical cdf of Qindep
cdfplot(Qindep)

情节不是[0,1]中制服的cdf。我做错了什么?

0 个答案:

没有答案