I have used Matlab but I also welcome python for the solution.
I have a predicted CDF (i.e., CDF^) of a random variable Var
and would like to generate N scenarios using this predicted CDF (CDF^). Here is what I have done. I would like to know if this method makes sense and also how can I automatically generate N scenarios in step 3.
1) I fit an assumed cumulative distribution function(let's say Weibull) using the MLE on CDF^ and obtained the corresponding parameters of the fitted function.
2) Using these parameters, I have plotted the pdf of the assumed distribution.
3) In this step, I am not sure what to do and how! Basically I guess, I should discretize var
and find the corresponding probability of each segment by calculating the area of each rectangle.
4) How can I plot my original data (var) in PMF form since it is already in CDF form?!
var= [ 0.001 0.01 97 145 150 189 202 183 248 305 492 607 1013];
cdf_prob = [0.01, 0.05, 0.15, 0.25, 0.35, 0.45, 0.50, 0.55, 0.65, 0.75, 0.85, 0.95, 0.99];
% cumulative prob.
a= mle(var, 'distribution', 'wbl');
plot(var, cdf_prob, 'o-') % my data
hold on
xgrid = linspace (0, 1.1*max(var));
plot (xgrid, wblcdf(xgrid,a(1),a(2))); % fitted cdf
figure(2) % fitted PDF
pd= makedist('wbl', 'a', a(1),'b', a(2));
y=pdf(pd, xgrid);
plot(xgrid,y)
Step 3: