Thread: ChiInv function
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
David J. Braden David J. Braden is offline
external usenet poster
 
Posts: 14
Default ChiInv function

Curious behavior. And try this in a worksheet: enter what, theoretically, is
the same thing:
=GAMMAINV(1-x,deg_freedom/2,2)
and you'll see that the latter is identical to CHIINV(x,deg_freedom) where
both don't return #NUM!, yet often one works where the other fails. So Excel
has a separate implementation for CHIINV. Weird.
Workaround would be (in pseudocode)
Dim vRes as variant, lDF as long, dX as Double, etc.
vRes = ChiInv(dX, lDF)
if lres is an error then
lRes = GammaInv(1-dX,lDF/2,2)
if lRes is an error then
'do something; linear or quartic interpolate if possible?
end if
end if

Another possibility: perhaps someone has done a better job of implementation
in an add-in.
Or, make a call to Mathematica or R (free open-source) from Excel.
HTH
Dave Braden
MVP

"Stef C" wrote in message
...
Hi,

I am using the ChiInv function of Excel and get an error
1004 when sending some values, but no error sending other
values... it do not seem to be an error from a certain
value (ex: start bugging when sending a value of 512 or
more...) it seem to be random, but I know that it is
not... anybody know this one.