@ConfidenceTestAssumptions(name="Gaussian Z-test", alsoKnownAs="Z-test", description="Determines if two populations have the same mean, if the populations are Gaussian and relatively large, at least 30 or so.", assumptions={"The two groups are sampled independently of each other.","The two groups are sampled from a Gaussian distribution, or the underlying distributions are non-Gaussian but obey the weak law of large numbers.","The variances of the two groups are equal."}, nullHypothesis="The means of the groups are equal.", dataPaired=false, dataSameSize=false, distribution=UnivariateGaussian.CDF.class, reference=@PublicationReference(author="Wikipedia",title="Z-test",type=WebPage,year=2009,url="http://en.wikipedia.org/wiki/Z-test")) public class GaussianConfidence extends AbstractCloneableSerializable implements NullHypothesisEvaluator<java.util.Collection<? extends java.lang.Number>>, ConfidenceIntervalEvaluator<java.util.Collection<? extends java.lang.Number>>
Modifier and Type | Class and Description |
---|---|
static class |
GaussianConfidence.Statistic
Confidence statistics for a Gaussian distribution
|
Modifier and Type | Field and Description |
---|---|
static GaussianConfidence |
INSTANCE
This class has no members, so here's a static instance.
|
Constructor and Description |
---|
GaussianConfidence()
Creates a new instance of GaussianConfidence
|
Modifier and Type | Method and Description |
---|---|
ConfidenceInterval |
computeConfidenceInterval(java.util.Collection<? extends java.lang.Number> data,
double confidence)
Computes a confidence interval for a given dataset and confidence (power)
level
|
ConfidenceInterval |
computeConfidenceInterval(double mean,
double variance,
int numSamples,
double confidence)
Computes the confidence interval given the mean and variance of
the samples, number of samples, and corresponding confidence interval
|
static ConfidenceInterval |
computeConfidenceInterval(UnivariateDistribution<?> dataDistribution,
int numSamples,
double confidence)
Computes the Gaussian confidence interval given a distribution of
data, number of samples, and corresponding confidence interval
|
static GaussianConfidence.Statistic |
evaluateNullHypothesis(java.util.Collection<? extends java.lang.Double> data1,
double data2)
Computes the probability that the input was drawn from the estimated
UnivariateGaussian distribution.
|
GaussianConfidence.Statistic |
evaluateNullHypothesis(java.util.Collection<? extends java.lang.Number> data1,
java.util.Collection<? extends java.lang.Number> data2)
Computes the probability that two data were generated by
the same distribution.
|
clone
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clone
public static final GaussianConfidence INSTANCE
public GaussianConfidence()
public GaussianConfidence.Statistic evaluateNullHypothesis(java.util.Collection<? extends java.lang.Number> data1, java.util.Collection<? extends java.lang.Number> data2)
NullHypothesisEvaluator
evaluateNullHypothesis
in interface NullHypothesisEvaluator<java.util.Collection<? extends java.lang.Number>>
data1
- First dataset to considerdata2
- Second dataset to considerpublic static GaussianConfidence.Statistic evaluateNullHypothesis(java.util.Collection<? extends java.lang.Double> data1, double data2)
data1
- Dataset to considerdata2
- Sample to compute the probability that a
UnivariateGaussian would produce a more unlikely sample than "data2"public ConfidenceInterval computeConfidenceInterval(java.util.Collection<? extends java.lang.Number> data, double confidence)
ConfidenceIntervalEvaluator
computeConfidenceInterval
in interface ConfidenceIntervalEvaluator<java.util.Collection<? extends java.lang.Number>>
data
- Dataset to use to compute the ConfidenceIntervalconfidence
- Confidence level (power, 1-pvalue) for the ConfidenceInterval,
must be on the interval (0,1]public static ConfidenceInterval computeConfidenceInterval(UnivariateDistribution<?> dataDistribution, int numSamples, double confidence)
dataDistribution
- UnivariateGaussian describing the distribution of the underlying datanumSamples
- Number of samples in the underlying dataconfidence
- Confidence value to assume for the ConfidenceInterval@PublicationReference(author="Wikipedia", title="Standard error (statistics)", type=WebPage, year=2009, url="http://en.wikipedia.org/wiki/Standard_error_(statistics)") public ConfidenceInterval computeConfidenceInterval(double mean, double variance, int numSamples, double confidence)
ConfidenceIntervalEvaluator
computeConfidenceInterval
in interface ConfidenceIntervalEvaluator<java.util.Collection<? extends java.lang.Number>>
mean
- Mean of the distribution.variance
- Variance of the distribution.numSamples
- Number of samples in the underlying dataconfidence
- Confidence value to assume for the ConfidenceInterval