com.kutsyy.util
Class Exp

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

public final class Exp
extends Object

Class Esp contains functions for computing expected value for some distributions.
Created by Vadim Kutsyy

Author:
Vadim Kutsyy

Field Summary
private static double mvntrc_cup
          variable used internaly by mvntrc
private static double mvntrc_eps
          constant used internaly by mvntrc
private static double mvntrc_ept
          variable used internaly by mvntrc
private static double mvntrc_z
          constant used internaly by mvntrc
 
Constructor Summary
Exp()
           
 
Method Summary
private static double[] cor2to1(double[][] cor2)
          transfor two dimentional array in to one dimentional, used internaly
private  double[][] cov1to2(double[] r)
          transfor one dimentional array in to two dimentional, used internaly
static double[] mvntrc(double[] a, double[][] r)
          Evaluate mean and covariance matrix of multivariate tuncated normal
static double[] mvntrc(double[] a, double[] b, double[][] r)
          Evaluate mean and covariance matrix of multivariate tuncated normal
 void mvntrc(double[] bounds, double[] u, double[][] v, double eps, double[] tmean, double[][] tvar)
          calulate mean and covariance matrix of truncated normal
 void mvntrc(double[] low, double[] high, double[] u, double[][] v, double eps, double[] tmean, double[][] tvar)
          Description of the Method
static double[] mvntrcMoment(double[] a, double[][] r)
          Evaluate first and second moments of multivariate tuncated normal Based on algorithms:
Leppard, P.
static double[] mvntrcMoment(double[] a, double[] b, double[][] r)
          Evaluate first and second moments of multivariate tuncated normal
private static double[] mvntrcMomentPrivate(double[] low, double[][] R)
          used internaly
private static double[] mvntrcMomentPrivate(double[] a, double[] b, double[][] r)
          used internaly
 void mvntrcMoments(double[] bounds, double[] u, double[][] v, double eps, double[] tmean, double[][] tvar)
          Description of the Method
 void mvntrcMoments(double[] low, double[] high, double[] u, double[][] v, double eps, double[] tmean, double[][] tvar)
          Constructor for the mvntrc object
static double ntrc(double low)
          Description of the Method
static double ntrc(double low, double high)
          Evaluate mean of trantated standart normal Creation date: (2/3/00 2:37:20 PM)
static double ntrc(double low, double high, double sd)
          Evaluate mean of trantated normal
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mvntrc_z

private static final double mvntrc_z
constant used internaly by mvntrc

mvntrc_cup

private static double mvntrc_cup
variable used internaly by mvntrc

mvntrc_eps

private static final double mvntrc_eps
constant used internaly by mvntrc

mvntrc_ept

private static double mvntrc_ept
variable used internaly by mvntrc
Constructor Detail

Exp

public Exp()
Method Detail

mvntrcMoments

public void mvntrcMoments(double[] low,
                          double[] high,
                          double[] u,
                          double[][] v,
                          double eps,
                          double[] tmean,
                          double[][] tvar)
                   throws IllegalArgumentException
Constructor for the mvntrc object
Parameters:
low - lower limit
high - upper limit
u - mean of normal distribution
v - variance of normal distribution
eps - tolerance
tmean - mean of truncated normal (output)
tvar - covariance matrix of truncated normal (output)
Throws:
IllegalArgumentException - Description of Exception
See Also:
mvntrcMoments(double[], double[], double[][], double, double[], double[][])

mvntrcMoments

public void mvntrcMoments(double[] bounds,
                          double[] u,
                          double[][] v,
                          double eps,
                          double[] tmean,
                          double[][] tvar)
                   throws IllegalArgumentException
Description of the Method
Parameters:
bounds - lower limit
u - mean of original normal distribution
v - covariance matrix of original normal distribution
eps - tolerance
tmean - mean of truncated normal (output)
tvar - covariance matrix of truncated normal (output)
Throws:
IllegalArgumentException - Description of Exception

mvntrc

public void mvntrc(double[] bounds,
                   double[] u,
                   double[][] v,
                   double eps,
                   double[] tmean,
                   double[][] tvar)
            throws IllegalArgumentException
calulate mean and covariance matrix of truncated normal
Parameters:
bounds - lower limit
u - mean of original normal distribution
v - covariance matrix of original normal distribution
eps - tolerance
tmean - mean of truncated normal (output)
tvar - covariance matrix of truncated normal (output)
Throws:
IllegalArgumentException - thows if bounds, u of v are not the same lenth/dimentions
See Also:
mvntrcMoments(double[], double[], double[][], double, double[], double[][])

mvntrc

public void mvntrc(double[] low,
                   double[] high,
                   double[] u,
                   double[][] v,
                   double eps,
                   double[] tmean,
                   double[][] tvar)
            throws IllegalArgumentException
Description of the Method
Parameters:
low - lower limit
high - upper limit
u - mean of normal distribution
v - variance of normal distribution
eps - tolerance
tmean - mean of truncated normal (output)
tvar - covariance matrix of truncated normal (output)
Throws:
IllegalArgumentException - Description of Exception
See Also:
mvntrcMoments(double[], double[], double[][], double, double[], double[][])

cov1to2

private double[][] cov1to2(double[] r)
transfor one dimentional array in to two dimentional, used internaly
Parameters:
r - one dimentional array
Returns:
two dimentional array

ntrc

public static double ntrc(double low,
                          double high)
Evaluate mean of trantated standart normal Creation date: (2/3/00 2:37:20 PM)
Parameters:
low - lower trancation
high - upper trancation
Returns:
expected value

ntrc

public static double ntrc(double low,
                          double high,
                          double sd)
Evaluate mean of trantated normal
Parameters:
low - lower trancation
high - upper trancation
sd - standart diviation
Returns:
expected value

ntrc

public static double ntrc(double low)
Description of the Method
Parameters:
low - Description of Parameter
Returns:
Description of the Returned Value

mvntrc

public static double[] mvntrc(double[] a,
                              double[][] r)
Evaluate mean and covariance matrix of multivariate tuncated normal
Parameters:
a - lower truncation limit
r - covariance matrix or original normal distribution, before truncation
Returns:
mean of tuncated normal (ie E(X_i))
See Also:
mvntrcMoments(double[], double[], double[][], double, double[], double[][])

mvntrc

public static double[] mvntrc(double[] a,
                              double[] b,
                              double[][] r)
Evaluate mean and covariance matrix of multivariate tuncated normal
Parameters:
a - lower truncation limit
b - upper truncation limit
r - covariance matrix or original normal distribution, before truncation
Returns:
mean of tuncated normal (ie E(X_i))
See Also:
mvntrcMoments(double[], double[], double[][], double, double[], double[][])

mvntrcMoment

public static double[] mvntrcMoment(double[] a,
                                    double[][] r)
Evaluate first and second moments of multivariate tuncated normal Based on algorithms:
Leppard, P. ; Tallis, G. M. (
� "Evaluation of the mean and covariance of the truncated multinormal distribution"
Applied Statistics, 1989, V 38, 543-553
Parameters:
a - lower truncation limit
r - covariance matrix or original normal distribution, before truncation
Returns:
mean of tuncated normal (ie E(X_i))
See Also:
mvntrcMoments(double[], double[], double[][], double, double[], double[][])

mvntrcMoment

public static double[] mvntrcMoment(double[] a,
                                    double[] b,
                                    double[][] r)
Evaluate first and second moments of multivariate tuncated normal
Parameters:
a - lower truncation limit
b - upper truncation limit
r - covariance matrix or original normal distribution, before truncation
Returns:
mean of tuncated normal (ie E(X_i))
See Also:
mvntrcMoments(double[], double[], double[][], double, double[], double[][])

cor2to1

private static final double[] cor2to1(double[][] cor2)
transfor two dimentional array in to one dimentional, used internaly
Parameters:
cor2 - 2 dimentional array
Returns:
1 dimentional array

mvntrcMomentPrivate

private static double[] mvntrcMomentPrivate(double[] low,
                                            double[][] R)
used internaly
Parameters:
low - Description of Parameter
R - Description of Parameter
Returns:
double[]

mvntrcMomentPrivate

private static double[] mvntrcMomentPrivate(double[] a,
                                            double[] b,
                                            double[][] r)
used internaly
Parameters:
a - double[]
b - double[]
r - double[][]
Returns:
double[]