1 | /*
|
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | * contributor license agreements. See the NOTICE file distributed with
|
---|
4 | * this work for additional information regarding copyright ownership.
|
---|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | * (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | * See the License for the specific language governing permissions and
|
---|
15 | * limitations under the License.
|
---|
16 | */
|
---|
17 | package agents.anac.y2019.harddealer.math3.stat.interval;
|
---|
18 |
|
---|
19 | import agents.anac.y2019.harddealer.math3.exception.NumberIsTooLargeException;
|
---|
20 | import agents.anac.y2019.harddealer.math3.exception.OutOfRangeException;
|
---|
21 | import agents.anac.y2019.harddealer.math3.exception.NotPositiveException;
|
---|
22 | import agents.anac.y2019.harddealer.math3.exception.NotStrictlyPositiveException;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Interface to generate confidence intervals for a binomial proportion.
|
---|
26 | *
|
---|
27 | * @see <a
|
---|
28 | * href="http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval">Binomial
|
---|
29 | * proportion confidence interval (Wikipedia)</a>
|
---|
30 | * @since 3.3
|
---|
31 | */
|
---|
32 | public interface BinomialConfidenceInterval {
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Create a confidence interval for the true probability of success
|
---|
36 | * of an unknown binomial distribution with the given observed number
|
---|
37 | * of trials, successes and confidence level.
|
---|
38 | * <p>
|
---|
39 | * Preconditions:
|
---|
40 | * <ul>
|
---|
41 | * <li>{@code numberOfTrials} must be positive</li>
|
---|
42 | * <li>{@code numberOfSuccesses} may not exceed {@code numberOfTrials}</li>
|
---|
43 | * <li>{@code confidenceLevel} must be strictly between 0 and 1 (exclusive)</li>
|
---|
44 | * </ul>
|
---|
45 | * </p>
|
---|
46 | *
|
---|
47 | * @param numberOfTrials number of trials
|
---|
48 | * @param numberOfSuccesses number of successes
|
---|
49 | * @param confidenceLevel desired probability that the true probability of
|
---|
50 | * success falls within the returned interval
|
---|
51 | * @return Confidence interval containing the probability of success with
|
---|
52 | * probability {@code confidenceLevel}
|
---|
53 | * @throws NotStrictlyPositiveException if {@code numberOfTrials <= 0}.
|
---|
54 | * @throws NotPositiveException if {@code numberOfSuccesses < 0}.
|
---|
55 | * @throws NumberIsTooLargeException if {@code numberOfSuccesses > numberOfTrials}.
|
---|
56 | * @throws OutOfRangeException if {@code confidenceLevel} is not in the interval {@code (0, 1)}.
|
---|
57 | */
|
---|
58 | ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel)
|
---|
59 | throws NotStrictlyPositiveException, NotPositiveException,
|
---|
60 | NumberIsTooLargeException, OutOfRangeException;
|
---|
61 |
|
---|
62 | }
|
---|