net.maizegenetics.stats.math.ErrorFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tassel6 Show documentation
Show all versions of tassel6 Show documentation
TASSEL 6 is a software package to evaluate traits association. Feature Tables are at the heart of the package where, a feature is a range of positions or a single position. Row in the that table are taxon.
// ErrorFunction.java
//
// (c) 1999-2001 PAL Development Core Team
//
// This package may be distributed under the
// terms of the Lesser GNU General Public License (LGPL)
package net.maizegenetics.stats.math;
/**
* error function and related stuff
*
* @version $Id: ErrorFunction.java,v 1.1 2007/01/12 03:26:15 tcasstevens Exp $
*
* @author Korbinian Strimmer
*/
public class ErrorFunction
{
//
// Public stuff
//
/**
* error function
*
* @param x argument
*
* @return function value
*/
public static double erf(double x)
{
if (x > 0.0)
{
return GammaFunction.incompleteGammaP(0.5, x*x);
}
else if (x < 0.0)
{
return -GammaFunction.incompleteGammaP(0.5, x*x);
}
else
{
return 0.0;
}
}
/**
* complementary error function = 1-erf(x)
*
* @param x argument
*
* @return function value
*/
public static double erfc(double x)
{
return 1.0-erf(x);
}
/**
* inverse error function
*
* @param z argument
*
* @return function value
*/
public static double inverseErf(double z)
{
return pointNormal(0.5*z+0.5)/Math.sqrt(2.0);
}
// Private
// Returns z so that Prob{x