25package umontreal.ssj.probdist;
27import umontreal.ssj.probdist.BetaDist;
28import umontreal.ssj.util.*;
51 private static final int DECPREC = 15;
64 return Math.exp(C1 + 0.5 * (n1 - 2) * Math.log(x) - (0.5 * (n1 + n2) * Math.log(n2 + n1 * x)));
67 public double cdf(
double x) {
71 public double barF(
double x) {
96 public static double density(
int n1,
int n2,
double x) {
98 throw new IllegalArgumentException(
"n1 <= 0");
100 throw new IllegalArgumentException(
"n2 <= 0");
104 return Math.exp(((n1 / 2.0) * Math.log(n1) + (n2 / 2.0) * Math.log(n2) + ((n1 - 2) / 2.0) * Math.log(x))
105 - (
Num.
lnBeta(n1 / 2.0, n2 / 2.0) + ((n1 + n2) / 2.0) * Math.log(n2 + n1 * x)));
114 public static double cdf(
int n1,
int n2,
int d,
double x) {
116 throw new IllegalArgumentException(
"n1 <= 0");
118 throw new IllegalArgumentException(
"n2 <= 0");
121 return BetaDist.
cdf(n1 / 2.0, n2 / 2.0, (n1 * x) / (n1 * x + n2));
128 public static double cdf(
int n1,
int n2,
double x) {
129 return cdf(n1, n2, DECPREC, x);
139 public static double barF(
int n1,
int n2,
int d,
double x) {
141 throw new IllegalArgumentException(
"n1 <= 0");
143 throw new IllegalArgumentException(
"n2 <= 0");
146 return BetaDist.
barF(n1 / 2.0, n2 / 2.0, (n1 * x) / (n1 * x + n2));
154 public static double barF(
int n1,
int n2,
double x) {
155 return barF(n1, n2, DECPREC, x);
164 public static double inverseF(
int n1,
int n2,
int d,
double u) {
166 throw new IllegalArgumentException(
"n1 <= 0");
168 throw new IllegalArgumentException(
"n2 <= 0");
169 if (u > 1.0 || u < 0.0)
170 throw new IllegalArgumentException(
"u < 0 or u > 1");
174 return Double.POSITIVE_INFINITY;
177 return ((n2 * z) / (n1 * (1 - z)));
184 public static double inverseF(
int n1,
int n2,
double u) {
185 return inverseF(n1, n2, DECPREC, u);
194 public static double getMean(
int n1,
int n2) {
196 throw new IllegalArgumentException(
"n1 <= 0");
198 throw new IllegalArgumentException(
"n2 <= 2");
200 return (n2 / (n2 - 2.0));
213 throw new IllegalArgumentException(
"n1 <= 0");
215 throw new IllegalArgumentException(
"n2 <= 4");
217 return ((2.0 * n2 * n2 * (n2 + n1 - 2)) / (n1 * (n2 - 2.0) * (n2 - 2.0) * (n2 - 4.0)));
249 throw new IllegalArgumentException(
"n1 <= 0");
251 throw new IllegalArgumentException(
"n2 <= 0");
256 C1 = (n1 / 2.0) * Math.log(n1) + (n2 / 2.0) * Math.log(n2) -
Num.
lnBeta(n1 / 2.0, n2 / 2.0);
264 double[] retour = { n1, n2 };
272 return getClass().getSimpleName() +
" : n1 = " + n1 +
", n2 = " + n2;
Extends the class ContinuousDistribution for the beta distribution.
double inverseF(double u)
Returns the inverse distribution function .
double barF(double x)
Returns the complementary distribution function.
double cdf(double x)
Returns the distribution function .
Classes implementing continuous distributions should inherit from this base class.
static double cdf(int n1, int n2, int d, double x)
Computes the distribution function of the Fisher distribution with parameters n1 and n2,...
int getN1()
Returns the parameter n1 of this object.
static double density(int n1, int n2, double x)
Computes the density function ( FisherF ) for a Fisher distribution with n1 and n2 degrees of freedo...
double cdf(double x)
Returns the distribution function .
static double barF(int n1, int n2, int d, double x)
Computes the complementary distribution function of the Fisher.
static double inverseF(int n1, int n2, int d, double u)
Computes the inverse of the Fisher distribution with parameters n1 and n2, evaluated at ,...
static double barF(int n1, int n2, double x)
Computes the complementary distribution function of the Fisher.
FisherFDist(int n1, int n2)
Constructs a Fisher distribution with n1 and n2 degrees of freedom.
double density(double x)
Returns , the density evaluated at .
static double inverseF(int n1, int n2, double u)
Computes the inverse of the Fisher distribution with parameters n1 and n2, evaluated at .
double barF(double x)
Returns the complementary distribution function.
double getStandardDeviation()
Returns the standard deviation.
double[] getParams()
Return a table containing the parameters of the current distribution.
static double getStandardDeviation(int n1, int n2)
Computes and returns the standard deviation of the Fisher distribution with parameters n1 and n2.
void setParams(int n1, int n2)
Sets the parameters n1 and n2 of this object.
double inverseF(double u)
Returns the inverse distribution function .
static double cdf(int n1, int n2, double x)
Computes the distribution function of the Fisher distribution with parameters n1 and n2,...
static double getVariance(int n1, int n2)
Computes and returns the variance.
static double getMean(int n1, int n2)
Computes and returns the mean of the Fisher distribution with parameters n1 and n2.
String toString()
Returns a String containing information about the current distribution.
double getMean()
Returns the mean.
double getVariance()
Returns the variance.
int getN2()
Returns the parameter n2 of this object.
This class provides various constants and methods to compute numerical quantities such as factorials,...
static double lnBeta(double lam, double nu)
Computes the natural logarithm of the Beta function .