Inverse Transform method for discrete dataset

27 views (last 30 days)
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?

Answers (1)

Willemijn Wolf
Willemijn Wolf on 28 Jan 2020
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');

Tags

Community Treasure Hunt

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

Start Hunting!