help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with chisquare_inv/chi2inv


From: A. Scottedward Hodel
Subject: Re: Problem with chisquare_inv/chi2inv
Date: Wed, 19 Sep 2007 12:51:11 -0500

Short story: Ignore the bug report below if you're not using fink's 2.9.13 on Mac OS X.

Details:
I downloaded tarballs for 2.9.13, 2.9.12 and 2.9.11, and they don't match the gaminv.m routine that I had installed from fink.  (How that gaminv.m was corrupted  I don;t know).    I manually installed 2.9.14 on my machine and the chi2inv problem does not appear to be there.


On Sep 19, 2007, at 9:43 AM, A. Scottedward Hodel wrote:

The behavior of chisquare_inv (deprecated) and chi2inv appears to have changed between 2.9.12 and 2.9.13; I initially thought that the change is a result of a mild change to gaminv.m between octave 2.9.12 and 2.9.13 (diff at the end of this file), but this may incorrect.  Consider the  code below:

figure(1)
nu = linspace(1,2);
yy = sqrt(2*chi2inv(0.5,nu) ./ nu );
y2 = -0.1394*(nu.^2) + 0.6355*nu + 0.4612;
plot(nu,yy,'-;chisquare distribution function;', nu, y2,'-;quadratic approx;');
grid on
title('check quadratic approximation');

The two plots should match fairly closely, but as of octave 2.9.13, they are now off by about a factor of two.  I notice that they match almost perfectly if I reverse the order of the arguments to chi2inv, so perhaps this is the appropriate action for those of us using the old function.

I don't know whether the above issue is a bug or not. However,  it took me several days to track it down in my simulation work, so I thought I should report it to the list in case someone else has this problem as well.

Yours,
 diff -c ~/gaminv.m /sw/share/octave/2.9.13/m/statistics/distributions/gaminv.m
*** /Users/hodelas/gaminv.m     Wed Sep 19 09:08:20 2007
--- /sw/share/octave/2.9.13/m/statistics/distributions/gaminv.m Fri Sep  7 09:44:49 2007
***************
*** 59,67 ****
      if (!isscalar(a) || !isscalar(b))
        a = a (k);
        b = b (k);
!       y = a ./ b;
      else
!       y = a / b * ones (size (k));
      endif
      x = x (k);
      l = find (x < eps);
--- 59,67 ----
      if (!isscalar(a) || !isscalar(b))
        a = a (k);
        b = b (k);
!       y = a .* b;
      else
!       y = a * b * ones (size (k));
      endif
      x = x (k);
      l = find (x < eps);

_______________________________________________
Help-octave mailing list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]