How can I calculate with distributions?
5 views (last 30 days)
Show older comments
I have two data sets (couloumn vektors 86x1) and used the Distribution Fitter App to generate the best fit. Then I saved the fits to workspace as exepted as prob.LognormalDistribution and prob.NormalDistribution types. The variables are named: CDF_Zahnfreischlifflnge and ICDF_Zahnfreischlifflnge.
I want to generate a mathematic function: phi= cdf*icdf Related to my variables:
Here is the code I tried in command window with error messages:
phi=CDF_Zahnfreischlifflnge * ICDF_Zahnfreischlifflnge;
error massage: Undefined operator '*' for Input Arguments of type 'prob.NormalDistribution'.
phi=('CDF_Zahnfreischlifflnge' * 'ICDF_Zahnfreischlifflnge');
error massage: Inner Matrix dimensions must agree.
phi=(sum('CDF_Zahnfreischlifflnge' , 'ICDF_Zahnfreischlifflnge'));
error massage: Error using sum. Invalid Option. Option must be double, native, default, omitnan or inculdenan.
Using the option "times" insted of "sum" I get the error massage with "Inner Matrix dimensions must agree.".
Has someone an idea how to convert my variables CDF_Zahnfreischlifflnge and ICDF_Zahnfreischlifflnge in a way I can calculate with them?
1 Comment
Walter Roberson
on 24 Oct 2017
These objects appear to be returned by fitdist() and to be described at https://www.mathworks.com/help/stats/prob.lognormaldistribution.html and https://www.mathworks.com/help/stats/prob.normaldistribution.html
Answers (2)
KL
on 23 Oct 2017
If I understand you correctly, those two are column vectors and you want to perform element-wise multiplication, right? In that case,
phi=CDF_Zahnfreischlifflnge .* ICDF_Zahnfreischlifflnge;
should work.
Walter Roberson
on 24 Oct 2017
You appear to be attempting to do theoretical calculations with Statistics Toolbox probability distribution objects. Those objects are not designed for that purpose. The implementation of the formulas for each distribution is buried down several objects.
pdf() of a log normal distribution object eventually ends up calling lognpdf() with the parameters appropriate for that object. If you needed the theoretical formula, then you might start thinking about passing a symbolic x into lognpdf() to get out the formula. Unfortunately, that code contains
x(x <= 0) = Inf
and even if you
syms x positive
then it does not know that x <= 0 is to be false, and considers it unprovable, and generates an error message. Therefore you would have to go in to functions like that one and find the formula and extract it by hand to create the general symbolic form that you could then manipulate further.
2 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!