public class NonCentralChiSquare extends GenericDistribution
Constructor and Description |
---|
NonCentralChiSquare(double df,
double ncp) |
Modifier and Type | Method and Description |
---|---|
static double |
cumulative_raw(double x,
double f,
double theta,
double errmax,
double reltol,
int itrmax,
boolean lower_tail,
boolean log_p) |
double |
cumulative(double p,
boolean lower_tail,
boolean log_p) |
static double |
cumulative(double x,
double df,
double ncp,
boolean lower_tail,
boolean log_p) |
double |
density(double x,
boolean log) |
static double |
density(double x,
double df,
double ncp,
boolean give_log) |
double |
quantile(double q,
boolean lower_tail,
boolean log_p) |
static double |
quantile(double p,
double df,
double ncp,
boolean lower_tail,
boolean log_p) |
double |
random() |
static double |
random(double df,
double lambda,
RandomEngine random)
According to Hans R.
|
static double[] |
random(int n,
double df,
double lambda,
RandomEngine random) |
cumulative_hazard, cumulative_hazard, cumulative, cumulative, cumulative, density, density, getRandomEngine, hazard, hazard, inverse_survival, inverse_survival, quantile, quantile, quantile, random, random, setRandomEngine, survival, survival, survival
public static final double density(double x, double df, double ncp, boolean give_log)
public static final double cumulative_raw(double x, double f, double theta, double errmax, double reltol, int itrmax, boolean lower_tail, boolean log_p)
public static final double cumulative(double x, double df, double ncp, boolean lower_tail, boolean log_p)
public static final double quantile(double p, double df, double ncp, boolean lower_tail, boolean log_p)
public static final double random(double df, double lambda, RandomEngine random)
According to Hans R. Kuensch's suggestion (30 sep 2002): It should be easy to do the general case (ncp > 0) by decomposing it as the sum of a central chisquare with df degrees of freedom plus a noncentral chisquare with zero degrees of freedom (which is a Poisson mixture of central chisquares with integer degrees of freedom), see Formula (29.5b-c) in Johnson, Kotz, Balakrishnan (1995). The noncentral chisquare with arbitary degrees of freedom is of interest for simulating the Cox-Ingersoll-Ross model for interest rates in finance. R code that works is rchisq0 <- function(n, ncp) { p <- 0 < (K <- rpois(n, lambda = ncp / 2)) r <- numeric(n) r[p] <- rchisq(sum(p), df = 2*K[p]) r } rchisq <- function(n, df, ncp=0) { if(missing(ncp)) .Internal(rchisq(n, df)) else rchisq0(n, ncp) + .Internal(rchisq(n, df)) }
public static final double[] random(int n, double df, double lambda, RandomEngine random)
public double density(double x, boolean log)
density
in class GenericDistribution
public double cumulative(double p, boolean lower_tail, boolean log_p)
cumulative
in class GenericDistribution
public double quantile(double q, boolean lower_tail, boolean log_p)
quantile
in class GenericDistribution
public double random()
random
in class GenericDistribution