# How to integrate a lognormal pdf

4 views (last 30 days)
Marc Abdel Nour on 31 Jan 2023
Commented: Marc Abdel Nour on 3 Feb 2023
Hello everyone,
I'm trying to do 2 lognormal probability distribution and integrate them, but if i sum the probability density function (in this case sum(y12)), I'm getting relly large values, and it's largely dependent on the number of steps(m in the code).
How can I choose the correct number of steps and how can I integrate the pdf and make sure that it's the correct one?
a=0;
b=max(ero,[],'all');
m=0.005;
xi1=0:m:b;
xx=ero(ksi,:,1)';
xxx=ero(ksi,:,2)';
xx1=fitdist(xx,'lognormal');
xx2=fitdist(xxx,'lognormal');
y11=pdf(xx1,xi1);
y12=pdf(xx2,xi1);

Torsten on 31 Jan 2023
Moved: Torsten on 31 Jan 2023
Use "logncdf" with the parameter values from "fitdist" and the input values xi1.

Jeff Miller on 31 Jan 2023
It's hard to say for sure without seeing your xx and xxx values, but maybe it is just your expectations that are faulty? Certainly the sum of the pdf values can be arbitrarily large. pdf values are defined so that the area under the distribution is 1. For example, if the distribution of xxx only covers the narrow range from 0 to 0.01, then the average pdf value will have to be 100 to make the area 1. And the sum of those pdf values will thus be quite large. Also, the sum of the pdf values should increase with the number of steps. You are summing positive values from each step, so the sum becomes larger if there are more steps.
Marc Abdel Nour on 3 Feb 2023