MATLAB Answers

How can i calculate PDF and CDF of non-parametric distribution?

20 views (last 30 days)
israt fatema
israt fatema on 30 Jul 2021
Commented: israt fatema on 27 Aug 2021 at 5:05
I want to do probabilistic forecast from point forecast. I do have error distribution (non parametric) from point forecast. How can i calculate PDF and CDF of non-parametric distribution?

Accepted Answer

Star Strider
Star Strider on 30 Jul 2021
I am not certain what your data are. If ,they are appropriate for the function, I would begin with the ecdf function, since it is intended to do exactly what it appears that you want to do. It is usually easier to get the CDE first, then diferentiate it to get the PDF. See the See Also section of that documentation for similar functions.
israt fatema
israt fatema on 27 Aug 2021 at 5:05
my problem here is with inisializing the vector, which is not working for me properly since i have my own obs and fcst, not a vactor with random number. My obs vector should be (13 x 13) and fcst is (13 x 1)
obs: [7445.2, 7479.02, 7581.5, 7673.74, 7735.22, 7780.17, 7828.16, 7869.96, 8028.72, 8180.64, 8223.12, 8415.97, 8515.09];
fcst: [7438.35, 7502.96, 7548.12, 7683.68, 7797.14, 7846.95, 7887.55, 7922.21, 7950.36, 8160.52, 8318.25, 8261.64, 8474.051073];
obs: Vector of observations
fcst: Matrix of Ensemble forecast of size N x M. NB: N must equal length(obs), M equals the number of ensemble members
plot_pos: plotting positions that determine cumulative distribution function
mean_CRPS: Mean of non missing CRPS values
crps_values: A vector (length n) of CRPS values
num: number of non missing CRPS values used to compute mean_CRPS
fcst = rand(1000,1000);
obs = rand(1000,1);
[meanCRPS] = crps(fcst,obs);

Sign in to comment.

More Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 30 Jul 2021
You get some start towards estimates of the PDF/CDF from histogram and ksdensity. See the help and documentation to those functions. The next step (possibly) for you would then be to convert those estimates into a form (interpolating+extrapolating function?) that suits your forecast implementation - this might be trivial or "challenging" depending on circumstances - but those functions should give you first estimates.

Community Treasure Hunt

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

Start Hunting!