/** * Returns the natural logarithm of the beta function B(a, b). * * The implementation of this method is based on: * <ul> * <li><a href="http://mathworld.wolfram.com/BetaFunction.html"> * Beta Function</a>, equation (1).</li> * </ul> * * @param a Parameter {@code a}. * @param b Parameter {@code b}. * @param epsilon This parameter is ignored. * @param maxIterations This parameter is ignored. * @return log(B(a, b)). * @deprecated as of version 3.1, this method is deprecated as the * computation of the beta function is no longer iterative; it will be * removed in version 4.0. Current implementation of this method * internally calls {@link #logBeta(double, double)}. */ @Deprecated public static double logBeta(double a, double b, double epsilon, int maxIterations) { return logBeta(a, b); }
/** {@inheritDoc} **/ @Override public double logDensity(double x) { final double nhalf = numeratorDegreesOfFreedom / 2; final double mhalf = denominatorDegreesOfFreedom / 2; final double logx = FastMath.log(x); final double logn = FastMath.log(numeratorDegreesOfFreedom); final double logm = FastMath.log(denominatorDegreesOfFreedom); final double lognxm = FastMath.log(numeratorDegreesOfFreedom * x + denominatorDegreesOfFreedom); return nhalf * logn + nhalf * logx - logx + mhalf * logm - nhalf * lognxm - mhalf * lognxm - Beta.logBeta(nhalf, mhalf); }
FastMath.log(a) - logBeta(a, b)) * 1.0 / fraction.evaluate(x, epsilon, maxIterations);
final public static double beta(double a, double b) { return Math.exp(Beta.logBeta(a, b)); }
/** * Returns the natural logarithm of the beta function B(a, b). * * The implementation of this method is based on: * <ul> * <li><a href="http://mathworld.wolfram.com/BetaFunction.html"> * Beta Function</a>, equation (1).</li> * </ul> * * @param a Parameter {@code a}. * @param b Parameter {@code b}. * @param epsilon This parameter is ignored. * @param maxIterations This parameter is ignored. * @return log(B(a, b)). * @deprecated as of version 3.1, this method is deprecated as the * computation of the beta function is no longer iterative; it will be * removed in version 4.0. Current implementation of this method * internally calls {@link #logBeta(double, double)}. */ @Deprecated public static double logBeta(double a, double b, double epsilon, int maxIterations) { return logBeta(a, b); }
/** {@inheritDoc} **/ @Override public double logDensity(double x) { final double nhalf = numeratorDegreesOfFreedom / 2; final double mhalf = denominatorDegreesOfFreedom / 2; final double logx = Math.log(x); final double logn = Math.log(numeratorDegreesOfFreedom); final double logm = Math.log(denominatorDegreesOfFreedom); final double lognxm = Math.log(numeratorDegreesOfFreedom * x + denominatorDegreesOfFreedom); return nhalf * logn + nhalf * logx - logx + mhalf * logm - nhalf * lognxm - mhalf * lognxm - Beta.logBeta(nhalf, mhalf); }
/** * Returns the natural logarithm of the beta function B(a, b). * * The implementation of this method is based on: * <ul> * <li><a href="http://mathworld.wolfram.com/BetaFunction.html"> * Beta Function</a>, equation (1).</li> * </ul> * * @param a Parameter {@code a}. * @param b Parameter {@code b}. * @param epsilon This parameter is ignored. * @param maxIterations This parameter is ignored. * @return log(B(a, b)). * @deprecated as of version 3.1, this method is deprecated as the * computation of the beta function is no longer iterative; it will be * removed in version 4.0. Current implementation of this method * internally calls {@link #logBeta(double, double)}. */ @Deprecated public static double logBeta(double a, double b, double epsilon, int maxIterations) { return logBeta(a, b); }
Math.log(a) - logBeta(a, b)) * 1.0 / fraction.evaluate(x, epsilon, maxIterations);
/** {@inheritDoc} **/ @Override public double logDensity(double x) { final double nhalf = numeratorDegreesOfFreedom / 2; final double mhalf = denominatorDegreesOfFreedom / 2; final double logx = FastMath.log(x); final double logn = FastMath.log(numeratorDegreesOfFreedom); final double logm = FastMath.log(denominatorDegreesOfFreedom); final double lognxm = FastMath.log(numeratorDegreesOfFreedom * x + denominatorDegreesOfFreedom); return nhalf * logn + nhalf * logx - logx + mhalf * logm - nhalf * lognxm - mhalf * lognxm - Beta.logBeta(nhalf, mhalf); }
FastMath.log(a) - logBeta(a, b)) * 1.0 / fraction.evaluate(x, epsilon, maxIterations);