Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

inv-chi-square pdf?

19 views
Skip to first unread message

Per Freem

unread,
Sep 8, 2008, 4:44:58 PM9/8/08
to
hello,

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.

Peter Perkins

unread,
Sep 8, 2008, 5:53:59 PM9/8/08
to
Per Freem wrote:
> hello,
>
> 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)

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.

Per Freem

unread,
Sep 8, 2008, 7:48:35 PM9/8/08
to
On Sep 8, 5:53 pm, Peter Perkins

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??

Peter Perkins

unread,
Sep 9, 2008, 9:45:19 AM9/9/08
to
Per Freem wrote:

> 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]);

0 new messages