/// Assigns new values to the parameters. /// This method assumes that the parameters have been already checked. private void DefineParameters(double shape1, double shape2) { _alpha1 = shape1; _alpha2 = shape2; _norm = GammaFunction.LogBeta(_alpha1, _alpha2); _gamma1 = null; _gamma2 = null; _incompleteBetaFunction = null; }
/// Assigns new degrees of freedom to the receiver. /// Compute the norm of the distribution after a change of parameters. /// @param n1 int first degree of freedom /// @param n2 int second degree of freedom public void DefineParameters(int n1, int n2) { _dof1 = n1; _dof2 = n2; double nn1 = 0.5 * n1; double nn2 = 0.5 * n2; _norm = nn1 * Math.Log(n1) + nn2 * Math.Log(n2) - GammaFunction.LogBeta(nn1, nn2); _incompleteBetaFunction = null; _chiSquareDistribution1 = null; _chiSquareDistribution2 = null; }
/// @return double integral from -x to x /// @param x double private double SymmetricAcceptance(double x) { return(IncompleteBetaFunction.Value(_dof / (x * x + _dof))); }
/// Assigns new degrees of freedom to the receiver. /// Compute the norm of the distribution after a change of parameters. /// @param n1 int first degree of freedom /// @param n2 int second degree of freedom public void DefineParameters(int n1, int n2) { _dof1 = n1; _dof2 = n2; double nn1 = 0.5 * n1; double nn2 = 0.5 * n2; _norm = nn1 * System.Math.Log(n1) + nn2 * System.Math.Log(n2) - GammaFunction.LogBeta(nn1, nn2); _incompleteBetaFunction = null; _chiSquareDistribution1 = null; _chiSquareDistribution2 = null; }
/// Returns the probability of finding a random variable smaller /// than or equal to x. /// @return integral of the probability density function from 0 to x. /// @param x double upper limit of integral. public override double DistributionValue(double x) { return(IncompleteBetaFunction.Value(_dof2 / (x * _dof1 + _dof2))); }
/// Returns the probability of finding a random variable smaller /// than or equal to x. /// @return integral of the probability density function from 0 to x. /// @param x double upper limit of integral. public override double DistributionValue(double x) { return(IncompleteBetaFunction.Value(x)); }