【发布时间】:2017-12-30 00:29:30
【问题描述】:
考虑以下在 Matlab 中绘制的 2x1 向量,其概率分布是两个高斯分量的混合。
P=10^3; %number draws
v=1;
%First component
mu_a = [0,0.5];
sigma_a = [v,0;0,v];
%Second component
mu_b = [0,8.2];
sigma_b = [v,0;0,v];
%Combine
MU = [mu_a;mu_b];
SIGMA = cat(3,sigma_a,sigma_b);
w = ones(1,2)/2; %equal weight 0.5
obj = gmdistribution(MU,SIGMA,w);
%Draws
RV_temp = random(obj,P);%Px2
% Transform each component of RV_temp into a uniform in [0,1] by estimating the cdf.
RV1=ksdensity(RV_temp(:,1), RV_temp(:,1),'function', 'cdf');
RV2=ksdensity(RV_temp(:,2), RV_temp(:,2),'function', 'cdf');
现在,如果我们通过做检查RV1 和RV2 是否均匀分布在[0,1] 上
ecdf(RV1)
ecdf(RV2)
我们可以看到RV1 均匀分布在[0,1] 上(经验cdf 接近45 度线),而RV2 不是。
我不明白为什么。似乎mu_a(2)和mu_b(2)之间的距离越远,ksdensity在合理数量的平局中所做的工作就越差。为什么?
【问题讨论】: