Inverse cumulative probability density function (probit) of a normal
distribution.

@param x value to evaluate probit function at
@param mu Mean value
@param sigma Standard deviation.
@return The probit of the given normal distribution at x.
435746
public static double quantile(double x, double mu, double sigma) {
    return FastMath.exp(mu + sigma * NormalDistribution.standardNormalQuantile(x));
  }
202751
def ln_norm(x, mu, sigma=1.0):
    
    return np.log(stats.norm(loc=mu, scale=sigma).pdf(x))
1363963
def norm(x, mu, sigma=1.0):
    
    return stats.norm(loc=mu, scale=sigma).pdf(x)
37441
public static double quantile(double val, double mu, double sigma, double k) {
    if(val < 0.0 || val > 1.0) {
      return Double.NaN;
    }
    if(k < 0) {
      return mu + sigma * Math.max((1. - FastMath.pow(-FastMath.log(val), k)) / k, 1. / k);
    }
    else if(k > 0) {
      return mu + sigma * Math.min((1. - FastMath.pow(-FastMath.log(val), k)) / k, 1. / k);
    }
    else { // Gumbel
      return mu + sigma * FastMath.log(1. / FastMath.log(1. / val));
    }
  }
449346
public static double cdf(double x, double mu, double sigma, double skew) {
    x = (x - mu) / sigma;
    if(Math.abs(skew) > 0.) {
      double tmp = 1 - skew * x;
      if(tmp < 1e-15) {
        return (skew < 0.) ? 0. : 1.;
      }
      x = -FastMath.log(tmp) / skew;
    }
    return .5 + .5 * NormalDistribution.erf(x * MathUtil.SQRTHALF);
  }
675129
private void computeDerivatives(double sigma) {
		this.Lx2 = new float[width][height];
		this.Ly2 = new float[width][height];
		this.Lxy = new float[width][height];

		float[][][] grad = new float[width][height][];
		for (int y = 0; y < height; y++)
			for (int x = 0; x < width; x++)
				grad[x][y] = sobel(x, y);

		int radius = (int) (2 * sigma);
		int window = 1 + 2 * radius;
		float[][] gaussian = new float[window][window];
		for (int j = -radius; j <= radius; j++)
			for (int i = -radius; i <= radius; i++)
				gaussian[i + radius][j + radius] = (float) gaussian(i, j, sigma);

		for (int y = 0; y < height; y++) {
			for (int x = 0; x < width; x++) {

				for (int dy = -radius; dy <= radius; dy++) {
					for (int dx = -radius; dx <= radius; dx++) {
						int xk = x + dx;
						int yk = y + dy;
						if (xk < 0 || xk >= width)
							continue;
						if (yk < 0 || yk >= height)
							continue;

						double gw = gaussian[dx + radius][dy + radius];

						this.Lx2[x][y] += gw * grad[xk][yk][0]
								* grad[xk][yk][0];
						this.Ly2[x][y] += gw * grad[xk][yk][1]
								* grad[xk][yk][1];
						this.Lxy[x][y] += gw * grad[xk][yk][0]
								* grad[xk][yk][1];
					}
				}
			}
		}
	}
854337
def probability_lt(self, x):
        
        if self.mean is None:
            return
        return normdist(x=x, mu=self.mean, sigma=self.standard_deviation)
558668
public static double logpdf(double x, double mu, double sigma) {
    if(x <= 0.) {
      return Double.NEGATIVE_INFINITY;
    }
    final double xrel = (FastMath.log(x) - mu) / sigma;
    return MathUtil.LOG_ONE_BY_SQRTTWOPI - FastMath.log(sigma * x) - .5 * xrel * xrel;
  }
630795
protected static Kernel1D_F32 derivative1D_F32(int order, double sigma, int radius, boolean normalize) {

		Kernel1D_F32 ret = new Kernel1D_F32(radius * 2 + 1);
		float[] gaussian = ret.data;
		int index = 0;
		switch( order ) {
			case 1:
				for (int i = radius; i >= -radius; i--) {
					gaussian[index++] = (float) UtilGaussian.derivative1(0, sigma, i);
				}
				break;

			case 2:
				for (int i = radius; i >= -radius; i--) {
					gaussian[index++] = (float) UtilGaussian.derivative2(0, sigma, i);
				}
				break;

			case 3:
				for (int i = radius; i >= -radius; i--) {
					gaussian[index++] = (float) UtilGaussian.derivative3(0, sigma, i);
				}
				break;

			case 4:
				for (int i = radius; i >= -radius; i--) {
					gaussian[index++] = (float) UtilGaussian.derivative4(0, sigma, i);
				}
				break;

			default:
				throw new IllegalArgumentException("Only derivatives of order 1 to 4 are supported");
		}

		// multiply by the same factor as the gaussian would be normalized by
		// otherwise it will effective change the intensity of the input image
		if( normalize ) {
			double sum = 0;
			for (int i = radius; i >= -radius; i--) {
				sum += UtilGaussian.computePDF(0, sigma, i);
			}
			for (int i = 0; i < gaussian.length; i++) {
				gaussian[i] /= sum;
			}
		}
		
		return ret;
	}
855525
function partial( sigma ) {
	var s2 = pow( sigma, 2 );
	/**
	* FUNCTION: pdf( x )
	*	Evaluates the probability density function (PDF) for a Rayleigh distribution.
	*
	* @private
	* @param {Number} x - input value
	* @returns {Number} evaluated PDF
	*/
	return function pdf( x ) {
		if ( x < 0 ) {
			return 0;
		}
		return (1/s2) * x * exp( -pow( x, 2 ) / ( 2 * s2 ) );
	};
}
1183847
def ratio_beyond_r_sigma(x, r):
    
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)
    return np.sum(np.abs(x - np.mean(x)) > r * np.std(x))/x.size
780060
protected static float[] createGaussianWeightKernel( double sigma , int radius ) {
		Kernel2D_F32 ker = FactoryKernelGaussian.gaussian2D_F32(sigma,radius,false,false);
		float maxValue = KernelMath.maxAbs(ker.data,4*radius*radius);
		KernelMath.divide(ker,maxValue);
		return ker.data;
	}
1074533
public static double cdf(double val, double mu, double sigma, double xi) {
    val = (val - mu) / sigma;
    // Check support:
    if(val < 0) {
      return 0.;
    }
    if(xi < 0 && val > -1. / xi) {
      return 1.;
    }
    return 1 - FastMath.pow(1 + xi * val, -1. / xi);
  }
227885
public static double[][] cor(double[][] data, double[] mu) {
        double[][] sigma = cov(data, mu);

        int n = data[0].length;
        double[] sd = new double[n];
        for (int i = 0; i < n; i++) {
            sd[i] = sqrt(sigma[i][i]);
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j <= i; j++) {
                sigma[i][j] /= sd[i] * sd[j];
                sigma[j][i] = sigma[i][j];
            }
        }

        return sigma;
    }
1220831
public static double pdf(double x, double mu, double beta) {
    final double z = (x - mu) / beta;
    if(x == Double.NEGATIVE_INFINITY) {
      return 0.;
    }
    return FastMath.exp(-z - FastMath.exp(-z)) / beta;
  }
167920
public static double pdf(double x, double mu, double sigma, double lambda) {
    final double dx = x - mu;
    final double lss = lambda * sigma * sigma;
    final double erfc = NormalDistribution.erfc((lss - dx) / (sigma * MathUtil.SQRT2));
    return erfc > 0. ? .5 * lambda * FastMath.exp(lambda * (lss * .5 - dx)) * erfc : (x == x) ? 0. : Double.NaN;
  }
176207
private double gaussian(double x, double y, double sigma) {
		double sigma2 = sigma * sigma;
		double t = (x * x + y * y) / (2 * sigma2);
		double u = 1.0 / (2 * Math.PI * sigma2);
		double e = u * Math.exp(-t);
		return e;
	}