how can i get the inverse chisquare *pdf* in matlab? i see that
there's a function to get the inverse chi square CDF (chi2inv) but i
am interested in the pdf, i.e. the function shown in:
http://en.wikipedia.org/wiki/Inverse-gamma_distribution
i know the derivative of a cdf is the pdf but it seems silly to get a
numerical integral for this... unless i am missing something. where
can i find the pdf that's identical to the wikipedia page?
thank you.
That's actually the inverse CDF of the chi-squared dist'n, and _not_ the CDF of the inverse chi-squared dist'n. It's pretty easy to get what you want: invert the values you have, plug them into the chi-squared PDF, and multiply that by the jacobian of that 1/x transformation.
See lognpdf for a similar example.
Hope this helps.
- Peter Perkins
The MathWorks, Inc.
i'm confused about the jacobian part. is what you mean x = [0:.01:1];
x = 1./x; then chi2pdf(x, 2)*jacobian(x, chi2pdf(x, 2))? doesn't seem
right, why the jacobian??
> i'm confused about the jacobian part. is what you mean x = [0:.01:1];
> x = 1./x; then chi2pdf(x, 2)*jacobian(x, chi2pdf(x, 2))? doesn't seem
> right, why the jacobian??
It's basic probability, and a consequence of the chain rule of differentiation. Any book on probability will cover this.
nu = 9.87;
x = 1./chi2rnd(nu,100000,1);
subplot(2,1,1), hist(x,250); xlim([0 1]);
xx = linspace(.01,.99,1001);
f = @(x,nu) chi2pdf(1./x,nu) ./ x.^2;
ff = f(xx,nu);
subplot(2,1,2), plot(xx,ff); xlim([0 1]);