Class BivariateGaussianDistributionUtils
- java.lang.Object
-
- com.metsci.glimpse.util.math.stat.BivariateGaussianDistributionUtils
-
public class BivariateGaussianDistributionUtils extends Object
This class contains a collection of static methods for dealing with Bivariate Gaussian distributions.- Author:
- moskowitz
-
-
Constructor Summary
Constructors Constructor Description BivariateGaussianDistributionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double[]fromUnitCovarianceEllipse(double semiMajorAxisLength, double semiMinorAxisLength, double orientation)Given the parameters defining the unit covariance ellipse for a Bivariate Gaussian distribution centered about the origin, this method returns sigmaX = Sqrt[Var(X)], sigmaY = Sqrt[Var(Y)], and correlation = Cov(X,Y) / (sigmaX sigmaY) for this probability distribution.static voidmain(String[] args)static double[]toUnitCovarianceEllipse(double sigmaX, double sigmaY, double correlation)Returns the parameters defining the unit covariance ellipse for a Bivariate Gaussian distribution centered about the origin with given sigmaX, sigmaY, and correlation.
-
-
-
Method Detail
-
toUnitCovarianceEllipse
public static double[] toUnitCovarianceEllipse(double sigmaX, double sigmaY, double correlation)Returns the parameters defining the unit covariance ellipse for a Bivariate Gaussian distribution centered about the origin with given sigmaX, sigmaY, and correlation. The unit covariance ellipse is a constant probability contour enclosing a 1-sigma area (probability of being inside the ellipse approximately equals 39.35%).Note: correlation must be <= 1 and >= -1.
Ref: Data Analysis for Scientists and Engineers, Stuart Meyer, 1975, p.288-290.
- Parameters:
sigmaX- X standard deviation = Sqrt[Var(X)]sigmaY- Y standard deviation = Sqrt[Var(Y)]correlation- correlation coefficient = Cov(X,Y) / (sigmaX sigmaY)- Returns:
- array of size 3: {semi-major axis length, semi-minor axis length, orientation} of 1-sigma covariance ellipse
- Throws:
IllegalArgumentException- if correlation is outside valid domain.
-
fromUnitCovarianceEllipse
public static double[] fromUnitCovarianceEllipse(double semiMajorAxisLength, double semiMinorAxisLength, double orientation)Given the parameters defining the unit covariance ellipse for a Bivariate Gaussian distribution centered about the origin, this method returns sigmaX = Sqrt[Var(X)], sigmaY = Sqrt[Var(Y)], and correlation = Cov(X,Y) / (sigmaX sigmaY) for this probability distribution. The unit covariance ellipse is a constant probability contour enclosing a 1-sigma area (probability of being inside the ellipse approximately equals 39.35%).Note: Calculation is based on COV = Q' R Q where Q is rotation matrix {cos,sin;-sin, cos} for given orientation and R is diagonal matrix {semiMaj, 0; 0, semiMin} for axis lengths. With COV computed, we get sigmaX = Sqrt[COV(0,0)], sigmaY = Sqrt[COV(1,1)], and finally correlation = COV(0,1)/(sigmaX * sigmaY).
- Parameters:
semiMajorAxisLength- length of semi-major axis of 1-sigma covariance ellipsesemiMinorAxisLength- length of semi-minor axis of 1-sigma covariance ellipseorientation- orientation of covariance ellipse (azimuth of semi-major axis)- Returns:
- array of size 3: {sigmaX, sigmaY, correlation}
-
main
public static void main(String[] args)
-
-