jdistlib
Class NonCentralChiSquare
- java.lang.Object
-
- jdistlib.generic.GenericDistribution
-
- jdistlib.NonCentralChiSquare
-
public class NonCentralChiSquare extends GenericDistribution
-
-
Constructor Summary
Constructors Constructor and Description NonCentralChiSquare(double df, double ncp)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static doublecumulative_raw(double x, double f, double theta, double errmax, double reltol, int itrmax, boolean lower_tail, boolean log_p)doublecumulative(double p, boolean lower_tail, boolean log_p)static doublecumulative(double x, double df, double ncp, boolean lower_tail, boolean log_p)doubledensity(double x, boolean log)static doubledensity(double x, double df, double ncp, boolean give_log)doublequantile(double q, boolean lower_tail, boolean log_p)static doublequantile(double p, double df, double ncp, boolean lower_tail, boolean log_p)doublerandom()static doublerandom(double df, double lambda, RandomEngine random)According to Hans R.static double[]random(int n, double df, double lambda, RandomEngine random)-
Methods inherited from class jdistlib.generic.GenericDistribution
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
-
-
-
-
Method Detail
-
density
public static final double density(double x, double df, double ncp, boolean give_log)
-
cumulative_raw
public static final double cumulative_raw(double x, double f, double theta, double errmax, double reltol, int itrmax, boolean lower_tail, boolean log_p)
-
cumulative
public static final double cumulative(double x, double df, double ncp, boolean lower_tail, boolean log_p)
-
quantile
public static final double quantile(double p, double df, double ncp, boolean lower_tail, boolean log_p)
-
random
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)) }
-
random
public static final double[] random(int n, double df, double lambda, RandomEngine random)
-
density
public double density(double x, boolean log)- Specified by:
densityin classGenericDistribution
-
cumulative
public double cumulative(double p, boolean lower_tail, boolean log_p)- Specified by:
cumulativein classGenericDistribution
-
quantile
public double quantile(double q, boolean lower_tail, boolean log_p)- Specified by:
quantilein classGenericDistribution
-
random
public double random()
- Specified by:
randomin classGenericDistribution
-
-
DMelt 3.0 © DataMelt by jWork.ORG