PDF of a function of a random variable - wrong scale?
2 次查看(过去 30 天)
显示 更早的评论
I have a random variable x, which is log-normally distributed with PDF lognpdf(x, 0,psi*sqrt(rho)).
I also have a function of x, Fx which PDF I want to find; I am using the following theorem and code:
x = 0.5:0.01:2; rho = 0.1; psi = 0.1834;
%Function of a random variable
Fx = logncdf(0.7./x,0,psi*sqrt(1 - rho));
%PDF of a function of a random variable
PDF_Fx = lognpdf(x, 0,psi*sqrt(rho)).*abs(gradient(x,Fx));
%PDF reaches 30
plot(Fx,PDF_Fx); set(gca,'XLim',[0 0.095]);
%Integral over pdf gives -1
trapz(Fx,PDF_Fx)
The problem is the scale of the resulting PDF which reaches very high levels of around 30. How can a probability of certain value of a rnd variable be 30? However, when I integrate over the PDF with trapz I get -1 which also doesn't make much sense. Is there something in the transformations that messes up with the scale of the PDF that I am not taking into account?
0 个评论
采纳的回答
Walter Roberson
2016-11-20
The integral of the PDF has to be 1, but the PDF of an interval is multiplied by the width of the interval when doing the integral.
For example, if you took an interval of width 1/30 and you limited the PDF to one, then the integral could not exceed 1 * (1/30) . So the PDF has to be 30 so that the integral would be 30 * (1/30) = 1
So, do not worry about the PDF exceeding 1.
As for the value coming out -1: your Fx values decrease instead of increasing.
trapz(fliplr(Fx),fliplr(PDF_Fx))
2 个评论
Walter Roberson
2016-11-20
If you want to limit the PDF to 1, you could divide the values by realmax, or you could divide the values by their max(). However, if you limit a PDF to 1 then it is no longer a Probability Density Function.
Consider a 1 x 1 square of uniform probability
____
| |
|___|
integral of 1 over width 1 is 1, so the total probability is good.
Now squeeze the area to be half as wide
__
| |
|_|
integral of 1 over width 1/2 is 1/2, so the total probability does not work out. But make it twice as high...
__
| |
| |
| |
|_|
integral of 2 over width 1/2 is 1, so the total probability works out.
The PDF corresponds to this 2. If you were to limit it to 1 then your total probability could not possibly work.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!