Alex Herbert created STATISTICS-91:
--------------------------------------
Summary: Create confidence intervals from an independent sample
from a normally distributed population
Key: STATISTICS-91
URL: https://issues.apache.org/jira/browse/STATISTICS-91
Project: Commons Statistics
Issue Type: New Feature
Components: interval
Reporter: Alex Herbert
Confidence intervals can be generated for the mean and variance using a sample
from a normally distributed population. See [Normal distribution confidence
intervals
(Wikipedia)|https://en.wikipedia.org/wiki/Normal_distribution#Confidence_intervals].
Since there are two parameters that can be computed for the population this
requires a different API to the enum used in the BinomialConfidenceInterval to
compute intervals for the probability of success parameter.
A suggested API is:
{code:java}
public final class NormalConfidenceInterval {
public static NormalConfidenceInterval of(
double mean, double variance, int n);
public Interval getMeanInterval(double alpha);
public Interval getVarianceInterval(double alpha);
{code}
Note that the returned class does not implement {{{}Interval{}}}. Thus the name
is misleading. Alternatives:
- NormalConfidenceIntervalFactory
- NormalConfidenceIntervalGenerator
An alternative using an enum as a static factory:
{code:java}
public enum NormalConfidenceInterval {
MEAN,
VARIANCE;
public Interval fromErrorRate(
double mean, double variance, int n, double alpha);
}
{code}
The later is more inline with the current BiomialConfidenceInterval allowing:
{code:java}
double u = ...
double v = ...
int n = ...
Interval i = NormalConfidenceInterval.MEAN.fromErrorRate(u, v, n, 0.05);
{code}
This works as there is one method to compute the interval. But if there are
multiple then this will not be a flexible API. For example if using the
approximate formulas based on the asymptotic distributions of mean and variance
(i.e. as sample size n tends towards infinity).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)