| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.math3.distribution.AbstractRealDistribution
statalign.utils.NormalDistribution
public class NormalDistribution
Implementation of the normal (gaussian) distribution. Adapted from Apache Commons Math v3.0,
 but modified to use Utils.generator as the random number source.
| Field Summary | |
|---|---|
| static double | DEFAULT_INVERSE_ABSOLUTE_ACCURACYDefault inverse cumulative probability accuracy. | 
| Fields inherited from class org.apache.commons.math3.distribution.AbstractRealDistribution | 
|---|
| SOLVER_DEFAULT_ABSOLUTE_ACCURACY | 
| Constructor Summary | |
|---|---|
| NormalDistribution()Create a normal distribution with mean equal to zero and standard deviation equal to one. | |
| NormalDistribution(double mean,
                   double sd)Create a normal distribution using the given mean and standard deviation. | |
| NormalDistribution(double mean,
                   double sd,
                   double inverseCumAccuracy)Create a normal distribution using the given mean, standard deviation and inverse cumulative distribution accuracy. | |
| NormalDistribution(org.apache.commons.math3.random.RandomGenerator rng,
                   double mean,
                   double sd,
                   double inverseCumAccuracy)Creates a normal distribution. | |
| Method Summary | |
|---|---|
|  double | cumulativeProbability(double x)If xis more than 40 standard deviations from the mean, 0 or 1
 is returned, as in these cases the actual value is withinDouble.MIN_VALUEof 0 or 1. | 
|  double | cumulativeProbability(double x0,
                      double x1)Deprecated. See RealDistribution.cumulativeProbability(double,double) | 
|  double | density(double x) | 
|  double | getMean()Access the mean. | 
|  double | getNumericalMean()For mean parameter mu, the mean ismu. | 
|  double | getNumericalVariance()For standard deviation parameter s, the variance iss^2. | 
|  double | getStandardDeviation()Access the standard deviation. | 
|  double | getSupportLowerBound()The lower bound of the support is always negative infinity no matter the parameters. | 
|  double | getSupportUpperBound()The upper bound of the support is always positive infinity no matter the parameters. | 
|  boolean | isSupportConnected()The support of this distribution is connected. | 
|  boolean | isSupportLowerBoundInclusive() | 
|  boolean | isSupportUpperBoundInclusive() | 
|  double | logDensity(double x) | 
|  double | probability(double x0,
            double x1) | 
|  double | sample() | 
| Methods inherited from class org.apache.commons.math3.distribution.AbstractRealDistribution | 
|---|
| inverseCumulativeProbability, probability, reseedRandomGenerator, sample | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY
| Constructor Detail | 
|---|
public NormalDistribution()
public NormalDistribution(double mean,
                          double sd)
                   throws org.apache.commons.math3.exception.NotStrictlyPositiveException
mean - Mean for this distribution.sd - Standard deviation for this distribution.
org.apache.commons.math3.exception.NotStrictlyPositiveException - if sd <= 0.
public NormalDistribution(double mean,
                          double sd,
                          double inverseCumAccuracy)
                   throws org.apache.commons.math3.exception.NotStrictlyPositiveException
mean - Mean for this distribution.sd - Standard deviation for this distribution.inverseCumAccuracy - Inverse cumulative probability accuracy.
org.apache.commons.math3.exception.NotStrictlyPositiveException - if sd <= 0.
public NormalDistribution(org.apache.commons.math3.random.RandomGenerator rng,
                          double mean,
                          double sd,
                          double inverseCumAccuracy)
                   throws org.apache.commons.math3.exception.NotStrictlyPositiveException
rng - Random number generator.mean - Mean for this distribution.sd - Standard deviation for this distribution.inverseCumAccuracy - Inverse cumulative probability accuracy.
org.apache.commons.math3.exception.NotStrictlyPositiveException - if sd <= 0.| Method Detail | 
|---|
public double getMean()
public double getStandardDeviation()
public double density(double x)
public double logDensity(double x)
public double cumulativeProbability(double x)
x is more than 40 standard deviations from the mean, 0 or 1
 is returned, as in these cases the actual value is within
 Double.MIN_VALUE of 0 or 1.
@Deprecated
public double cumulativeProbability(double x0,
                                               double x1)
                             throws org.apache.commons.math3.exception.NumberIsTooLargeException
RealDistribution.cumulativeProbability(double,double)
cumulativeProbability in interface org.apache.commons.math3.distribution.RealDistributioncumulativeProbability in class org.apache.commons.math3.distribution.AbstractRealDistributionorg.apache.commons.math3.exception.NumberIsTooLargeException
public double probability(double x0,
                          double x1)
                   throws org.apache.commons.math3.exception.NumberIsTooLargeException
probability in class org.apache.commons.math3.distribution.AbstractRealDistributionorg.apache.commons.math3.exception.NumberIsTooLargeExceptionpublic double getNumericalMean()
mu, the mean is mu.
public double getNumericalVariance()
s, the variance is s^2.
public double getSupportLowerBound()
Double.NEGATIVE_INFINITY)public double getSupportUpperBound()
Double.POSITIVE_INFINITY)public boolean isSupportLowerBoundInclusive()
public boolean isSupportUpperBoundInclusive()
public boolean isSupportConnected()
truepublic double sample()
sample in interface org.apache.commons.math3.distribution.RealDistributionsample in class org.apache.commons.math3.distribution.AbstractRealDistribution| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||