Inverse Transform method for discrete dataset

조회 수: 13 (최근 30일)
Willemijn Wolf
Willemijn Wolf 2020년 1월 28일
답변: Willemijn Wolf 2020년 1월 28일
Hi all
I have a dataset that looks like this:
The red line I obtained by fitting a distribution via:
pd = fitdist(Z_vec,'kernel')
dataset.png
Now I would actually like to transform this data to a Gaussian Standard Normal (0,1).
I tried to follow Inverse Transform method, only the cdf function of Matlab can't create this for a kernel fitted distribution. It failed to do it just like this:
d = cdf(pd , data_vector);
Or are there any other statistical methods to transform a non-Gaussian dataset like this directly?

답변 (1개)

Willemijn Wolf
Willemijn Wolf 2020년 1월 28일
Found solution
quantiles = linspace(0,1,datasize);
[f,x, flo, fup] = ecdf(datavector); %experimental cdf
finv = interp1(f,x,quantile,'next');%Inverse experimental cdf
pdnorm = makedist('Normal'); transf = icdf(pdnorm,f); %create equivalent cdf values for N(0,1) distribution
plot(x,f); hold on; plot(finv,quantile, 'ro');

태그

Community Treasure Hunt

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

Start Hunting!

Translated by