public class EmpiricalDist extends DiscreteDistribution
DiscreteDistribution to an empirical
distribution function,
based on the observations
X(1),..., X(n) (sorted by increasing order).
The distribution is uniform over the n observations, so the
distribution function has a jump of 1/n at each of the n observations.| Constructor and Description |
|---|
EmpiricalDist(double[] obs)
Constructs a new empirical distribution using
all the observations stored in obs, and which are assumed
to have been sorted in increasing numerical order.
|
EmpiricalDist(java.io.Reader in)
Constructs a new empirical distribution using
the observations read from the reader in.
|
| Modifier and Type | Method and Description |
|---|---|
double |
barF(double x)
Returns
bar(F)(x) = 1 - F(x).
|
double |
cdf(double x)
Returns the distribution function F(x).
|
double |
getInterQuartileRange()
Returns the interquartile range of the observations,
defined as the difference between the third and first quartiles.
|
double |
getMean()
Computes the mean
E[X] = ∑i=1npixi of the distribution.
|
double |
getMedian()
Returns the
n/2th item of the sorted observations when the number
of items is odd, and the mean of the
n/2th and the
(n/2 + 1)th items when the number of items is even.
|
static double |
getMedian(double[] obs,
int n)
Returns the
n/2th item of the array obs when the number
of items is odd, and the mean of the
n/2th and the
(n/2 + 1)th items when the number of items is even.
|
int |
getN()
Returns n, the number of observations.
|
double |
getObs(int i)
Returns the value of X(i).
|
double[] |
getParams()
Return a table containing parameters of the current distribution.
|
double |
getSampleMean()
Returns the sample mean of the observations.
|
double |
getSampleStandardDeviation()
Returns the sample standard deviation of the observations.
|
double |
getSampleVariance()
Returns the sample variance of the observations.
|
double |
getStandardDeviation()
Computes the standard deviation of the distribution.
|
double |
getVariance()
Computes the variance
Var[X] = ∑i=1npi(xi - E[X])2
of the distribution.
|
double |
inverseF(double u)
Returns the inverse distribution function
F-1(u), defined in.
|
double |
prob(int i)
Returns pk, the probability of
the k-th observation, for 0 <= k < n.
|
java.lang.String |
toString()
Returns a String containing information about the current distribution.
|
getXinf, getXsuppublic EmpiricalDist(double[] obs)
public EmpiricalDist(java.io.Reader in)
throws java.io.IOException
java.io.IOExceptionpublic double prob(int i)
DiscreteDistributionprob in class DiscreteDistributioni - observation number,
0 <= k < npublic double cdf(double x)
Distributioncdf in interface Distributioncdf in class DiscreteDistributionx - value at which the distribution function must be evaluatedpublic double barF(double x)
DistributionbarF in interface DistributionbarF in class DiscreteDistributionx - value at which the complementary distribution function must be evaluatedpublic double inverseF(double u)
DistributioninverseF in interface DistributioninverseF in class DiscreteDistributionu - value in the interval (0, 1) for which the inverse
distribution function is evaluatedpublic double getMean()
DiscreteDistributiongetMean in interface DistributiongetMean in class DiscreteDistributionpublic double getVariance()
DiscreteDistributiongetVariance in interface DistributiongetVariance in class DiscreteDistributionpublic double getStandardDeviation()
DiscreteDistributiongetStandardDeviation in interface DistributiongetStandardDeviation in class DiscreteDistributionpublic double getMedian()
public static double getMedian(double[] obs,
int n)
obs - the array of observationsn - the number of observationspublic int getN()
public double getObs(int i)
public double getSampleMean()
public double getSampleVariance()
public double getSampleStandardDeviation()
public double getInterQuartileRange()
public double[] getParams()
getParams in interface DistributiongetParams in class DiscreteDistributionpublic java.lang.String toString()
toString in class DiscreteDistributionTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.