com.kutsyy.util
Class Cdf

java.lang.Object
  |
  +--com.kutsyy.util.Cdf

public final class Cdf
extends Object

Cdf class include functions for computing Cumulative density functions or integrals of PDF (in case of multivariate)
Created by Vadim Kutsyy

Author:
Vadim Kutsyy

Field Summary
private static double bvnor_eps
          default tolerance used by bvnor
private static double cup
          variable used internaly
private static double DMV_CUT
          variable used by dmv
private static double mvnor_cup
          variable used by mvnor
private static double mvnor_eplos
          variable used by mvnor
private static double mvnor_eps
          default tolerance for mvnor
private static double mvnor_epsmin
          default minimum tolerance for mvnor
private static double mvnor_ept
          variable used by mvnor
private static double mvnor_z
          variable used by mvnor
private static double mvnor_z_cup
          constant used by mvnor
private static double ranmvn_eps
          default tolerance for ranmvn
private static double ranmvn_error
          variable used by ranmvn
private static double ranmvn_releps
          default relevant tolerance for ranmvn
private static double ranmvn_value
          variable used by ranmvn
private static double ranmvn_varest
          variable used by ranmvn
private static Random rnd
          Internal random number generator
 
Constructor Summary
Cdf()
           
 
Method Summary
static double bvnor(double[] x, double[][] sigma)
          A function for computing bivariate normal probabilities.
static double bvnor(double[] lower, double[] upper, double rho)
          A function for computing bivariate normal probabilities.
static double bvnor(double[] lower, double[] upper, double[][] sigma)
          A function for computing bivariate normal probabilities.
static double bvnor(double[] lower, double[] upper, int[] infin, double cor)
          A function for computing bivariate normal probabilities.
static double bvnor(double sh, double sk, double r)
          A function for computing bivariate normal probabilities.
private static double dmv_solve(double[] h, double[][] r)
          Internal function used by #dmv(double[], double[][])
private static double dmv_tree(double[] h, double[][] r)
          Internal function used by #dmv(double[], double[][])
static double dmv(double[] high, double[][] cov)
          Compute Cdf of Miltivariate normal
Based on algorithms by
Zvi Drezner
Calofornia State University, Fullerton
"Computation of the Multivariate Normal Integral"
ACM Transaction on Mathematical Software, Vol 18, No 4, December 1992, Pages 470-480
static double dmv(double[] low, double[] high, double[][] cov)
          Compute Multivariate normal integral
static double mvnor(double[] low, double[] high, double[][] sig)
          Compute multivariate normal distribution function and the probability that a multivariate normal vector falls in a rectangle in n-space
routine called dmv(double[], double[], double[][]) if the result is less than (1e-10/low.length), the routine will call ranmvn(double[], double[], double[])
Note: the cut point above seems to work fine, in order to get at most 1% of relative error
static double nor(double x)
          Compute Cdf of standart normal
static double nor(double x, double mu, double sd)
          Compute Cdf of normal
private static double ranmvn_main(double[] low, double[] high, double[][] sig)
          main function for #ranmvn(double[], double[], double[][])
private static double ranmvn_mvnfnc(double[] w, double e0, double d0, double[] lower, double[] upper, double[][] cov)
          Internal function for #ranmvn(double[], double[], double[][])
private static void ranmvn_rcrude(int ndim, int maxpts, int ir, double e0, double d0, double[] lower, double[] upper, double[][] cov)
          Internal function for #ranmvn(double[], double[], double[][])
private static double ranmvn_solve(double[] lower, double[] upper, double[][] c, double releps)
          #ranmvn(double[], double[], double[][])
static double ranmvn(double[] low, double[] high, double[][] sig)
          Compute Cdf of Miltivariate normal
Based on algorithms by
Alan Genz http://www.sci.wsu.edu/math/faculty/genz/homepage
Department of Mathematics, Washington State University, Pullman, WA 99164-3113, Email : alangenz@wsu.edu
"Numerical Computation of Multivariate Normal Probabilities""
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mvnor_epsmin

private static final double mvnor_epsmin
default minimum tolerance for mvnor

mvnor_eps

private static final double mvnor_eps
default tolerance for mvnor

ranmvn_eps

private static final double ranmvn_eps
default tolerance for ranmvn

ranmvn_releps

private static final double ranmvn_releps
default relevant tolerance for ranmvn

mvnor_ept

private static double mvnor_ept
variable used by mvnor

mvnor_eplos

private static double mvnor_eplos
variable used by mvnor

mvnor_z

private static double mvnor_z
variable used by mvnor

cup

private static double cup
variable used internaly

mvnor_cup

private static double mvnor_cup
variable used by mvnor

mvnor_z_cup

private static final double mvnor_z_cup
constant used by mvnor

bvnor_eps

private static final double bvnor_eps
default tolerance used by bvnor

rnd

private static Random rnd
Internal random number generator

ranmvn_error

private static double ranmvn_error
variable used by ranmvn

ranmvn_value

private static double ranmvn_value
variable used by ranmvn

ranmvn_varest

private static double ranmvn_varest
variable used by ranmvn

DMV_CUT

private static final double DMV_CUT
variable used by dmv
Constructor Detail

Cdf

public Cdf()
Method Detail

bvnor

public static final double bvnor(double[] x,
                                 double[][] sigma)
A function for computing bivariate normal probabilities.
Parameters:
x - upper limit
sigma - covariate matrix
Returns:
double result
See Also:
bvnor(double,double,double)

bvnor

public static final double bvnor(double[] lower,
                                 double[] upper,
                                 double[][] sigma)
A function for computing bivariate normal probabilities.
Parameters:
lower - lower limits of integrations
upper - upper limits of integration
sigma - covariance matrix
Returns:
probability
See Also:
bvnor(double,double,double)

bvnor

public static final double bvnor(double[] lower,
                                 double[] upper,
                                 int[] infin,
                                 double cor)
A function for computing bivariate normal probabilities.
Parameters:
lower - lower limits of integrations
upper - upper limits of integration
infin - integration limits, provided in order to work with Mvndstpack
cor - correlation coeffitient
Returns:
probability
See Also:
bvnor(double,double,double)

bvnor

public static final double bvnor(double[] lower,
                                 double[] upper,
                                 double rho)
A function for computing bivariate normal probabilities.
Parameters:
lower - lower limit of integration
upper - upper limit of integration
rho - correlation coeffitient
Returns:
probability
See Also:
bvnor(double,double,double)

bvnor

public static final double bvnor(double sh,
                                 double sk,
                                 double r)
A function for computing bivariate normal probabilities.
Based on algorithms by
Yihong Ge, Department of Computer Science and Electrical Engineering, Washington State University, Pullman, WA 99164-2752
and
Alan Genz http://www.sci.wsu.edu/math/faculty/genz/homepage
Department of Mathematics, Washington State University, Pullman, WA 99164-3113, Email : alangenz@wsu.edu

Parameters:
sh - integration limit
sk - integration limit
r - correlation coefficient
Returns:
result

dmv

public static final double dmv(double[] high,
                               double[][] cov)
Compute Cdf of Miltivariate normal
Based on algorithms by
Zvi Drezner
Calofornia State University, Fullerton
"Computation of the Multivariate Normal Integral"
ACM Transaction on Mathematical Software, Vol 18, No 4, December 1992, Pages 470-480
Parameters:
high - upper limits of integration
cov - covariate matrix
Returns:
probabilty

dmv

public static final double dmv(double[] low,
                               double[] high,
                               double[][] cov)
Compute Multivariate normal integral
Parameters:
low - lower limit of integration
high - upper limit of integration
cov - covariance matrix
Returns:
probability
See Also:
dmv(double[],double[][])

mvnor

public static final double mvnor(double[] low,
                                 double[] high,
                                 double[][] sig)
Compute multivariate normal distribution function and the probability that a multivariate normal vector falls in a rectangle in n-space
routine called dmv(double[], double[], double[][]) if the result is less than (1e-10/low.length), the routine will call ranmvn(double[], double[], double[])
Note: the cut point above seems to work fine, in order to get at most 1% of relative error
Parameters:
low - Low limit of integration
high - Upper limits of integration
sig - Covariate matrix
Returns:
Probability
See Also:
dmv(double[], double[][]), ranmvn(double[], double[], double[][])

nor

public static final double nor(double x)
Compute Cdf of standart normal
Parameters:
x - upper limit
Returns:
probability

nor

public static final double nor(double x,
                               double mu,
                               double sd)
Compute Cdf of normal
Parameters:
x - upper limit
mu - mean
sd - stand diviation
Returns:
probability
See Also:
nor(double)

ranmvn

public static final double ranmvn(double[] low,
                                  double[] high,
                                  double[][] sig)
Compute Cdf of Miltivariate normal
Based on algorithms by
Alan Genz http://www.sci.wsu.edu/math/faculty/genz/homepage
Department of Mathematics, Washington State University, Pullman, WA 99164-3113, Email : alangenz@wsu.edu
"Numerical Computation of Multivariate Normal Probabilities""
Parameters:
low - lower limit of integration
high - upper limits of integration
sig - covariate matrix
Returns:
probabilty

dmv_solve

private static final double dmv_solve(double[] h,
                                      double[][] r)
Internal function used by #dmv(double[], double[][])
Parameters:
h - double[]
r - double[][]
Returns:
double
See Also:
dmv(double[], double[][])

dmv_tree

private static double dmv_tree(double[] h,
                               double[][] r)
Internal function used by #dmv(double[], double[][])
Parameters:
h - double[]
r - double[][]
Returns:
double
See Also:
dmv(double[], double[][])

ranmvn_main

private static final double ranmvn_main(double[] low,
                                        double[] high,
                                        double[][] sig)
main function for #ranmvn(double[], double[], double[][])
Parameters:
sig - double[]
low - Description of Parameter
high - Description of Parameter
Returns:
double
See Also:
ranmvn(double[], double[], double[][])

ranmvn_mvnfnc

private static final double ranmvn_mvnfnc(double[] w,
                                          double e0,
                                          double d0,
                                          double[] lower,
                                          double[] upper,
                                          double[][] cov)
Internal function for #ranmvn(double[], double[], double[][])
Parameters:
e0 - double
d0 - double
lower - double[]
upper - double[]
cov - double[][]
w - Description of Parameter
Returns:
double

ranmvn_rcrude

private static final void ranmvn_rcrude(int ndim,
                                        int maxpts,
                                        int ir,
                                        double e0,
                                        double d0,
                                        double[] lower,
                                        double[] upper,
                                        double[][] cov)
Internal function for #ranmvn(double[], double[], double[][])
Parameters:
ndim - int
maxpts - int
ir - int
e0 - double
d0 - double
lower - double[]
upper - double[]
cov - double[][]
See Also:
ranmvn(double[], double[], double[][])

ranmvn_solve

private static final double ranmvn_solve(double[] lower,
                                         double[] upper,
                                         double[][] c,
                                         double releps)
#ranmvn(double[], double[], double[][])
Parameters:
lower -  
upper -  
c -  
releps -  
Returns:
result
See Also:
ranmvn(double[], double[], double[][])