How to compute cdf non-central chi-square

27 views
Skip to first unread message

jld...@gmail.com

unread,
Nov 17, 2015, 2:14:04 AM11/17/15
to jStat
Hi,

I would like compute cdf and cdf inverse functions for non central chi-square.

I see only function for chi-square:
jStat.chisquare.cdf( x, dof )
jStat.chisquare.inv( p, dof )


Can you help me ?


JLD Jean-Luc

unread,
Nov 17, 2015, 7:09:38 AM11/17/15
to jStat
At now, I made this function:

// non-central chi-square with dl  degrees of freedom and with lambda the noncentrality parameter
function cdfchn(x,dl,lambda) {

var ls2 = lambda/2;
var terme;
var fac = 1;
var som = 0 , j = 0;
    do {
terme = Math.pow(ls2,j) * jStat.chisquare.cdf( x, dl + 2*j )/fac;
som   = som + terme;
fac   = fac * (j+1);
j     = j + 1;
    } while (Math.abs(terme) > 1E-16);

return( Math.exp(-ls2)*som );
Reply all
Reply to author
Forward
0 new messages