fpe*_*fpe 5 data-binding matlab normal-distribution data-fitting
我有一个比较容易理解的问题。
我有一组数据,我想估计这些数据对标准正态分布的拟合程度。为此,我从我的代码开始:
[f_p,m_p] = hist(data,128);
f_p = f_p/trapz(m_p,f_p);
x_th = min(data):.001:max(data);
y_th = normpdf(x_th,0,1);
figure(1)
bar(m_p,f_p)
hold on
plot(x_th,y_th,'r','LineWidth',2.5)
grid on
hold off
Run Code Online (Sandbox Code Playgroud)
图 1 将如下所示:
很容易看出,合身性很差,虽然可以发现钟形。因此,主要问题在于我的数据的差异。
为了找出我的数据箱应该拥有的正确出现次数,我这样做:
f_p_th = interp1(x_th,y_th,m_p,'spline','extrap');
figure(2)
bar(m_p,f_p_th)
hold on
plot(x_th,y_th,'r','LineWidth',2.5)
grid on
hold off
Run Code Online (Sandbox Code Playgroud)
这将导致下图。:
因此,问题是:如何缩放我的数据块以匹配图 2中的高斯分布?
警告
我想强调的一点聚焦:我不想要找到的最好的分布拟合的数据; 该问题被逆转:从我的数据开始,我想操纵它以这样的方式,在年底,其分布合理符合高斯之一。
不幸的是,目前,我对如何执行这些数据“过滤”、“转换”或“操作”没有真正的想法。
欢迎任何支持。
也许您感兴趣的是基于等级的逆正态变换。基本上,您首先对数据进行排名,然后将其转换为正态分布:
rank = tiedrank( data );
p = rank / ( length(rank) + 1 ); %# +1 to avoid Inf for the max point
newdata = norminv( p, 0, 1 );
Run Code Online (Sandbox Code Playgroud)