public static DoubleVector pchisq(double x,DoubleVector ncp){
  int n=ncp.size();
  DoubleVector p=new DoubleVector(n);
  double mean;
  double xh=Math.sqrt(x);
  for (int i=0; i < n; i++) {
    mean=Math.sqrt(ncp.get(i));
    p.set(i,pnorm(xh - mean) - pnorm(-xh - mean));
  }
  return p;
}

public static DoubleVector pchisq ( double x , DoubleVector ncp ) { int n = ncp . size ( ) ; DoubleVector p = new DoubleVector ( n ) ; double mean ; double xh = Math . sqrt ( x ) ; for ( int i = 0 ; i < n ; i ++ ) { mean = Math . sqrt ( ncp . get ( i ) ) ; p . set ( i , pnorm ( xh - mean ) - pnorm ( - xh - mean ) ) ; } return p ; }
returns the cumulative probability of a set of noncentral chi - squared distributions .
