ChiSq cdf and Inv ChiSq cdf implementations

Hey guys,
Was wondering if anyone had already implemented code for chi squared (specifically degrees of freedom=1) CDF and inverse CDF? If not, what’s the closest anyone’s gotten?
Thanks.

To clarify, are you looking for an equivalent of Matlab’s chi2cdf() and chi2inv() functions ? What is the use case? Could you approximate the distribution on the desired domain using CUDA’s existing functions? Sorry if this is a silly question, I know very little about statistics.

I am not aware of any CUDA implementations of the chi squared CDF. Have you looked into porting from Cephes (http://www.netlib.org/cephes/)? It provides chdtr(), chdtrc(), and chdtri() functions.

You might want to consider filing an enhancement request for CUDA via the bug reporting form linked from the registered developer website.

Hi njuffa,
Yes that’s exactly what I’m requesting.
The chi squared variable is a generalization of the Gamma(k,theta) distribution, so it would probably be best to implement that.

The trickiest part about this is that both the Chi Squared distribution and the Gamma distribution use the Incomplete Gamma Function (specifically the lower igf), which I do not think is implemented, and I have no idea how to effectively approximate such functions :(

If I can’t find a suitable solution I will definitely submit a RFE. Thanks :)

From a quick review of the literature it seems that an implementation of the incomplete gamma function is what is needed, as the chi-square CDF can be derived from that in straightforward manner. Unfortunately, the incomplete gamma function appears to be decidedly non-trivial to implement.

When you file the enhancement request, it will be helpful to list the use case(s), that will aid in prioritization. If you would like to attempt a port from existing code, you could either try code from the Cephes library that I mentioned earlier, or the code by DiDonato and Morris: http://www.netlib.org/toms/654