Confidence Interval#
statista.confidence_interval.ConfidenceInterval
#
ConfidenceInterval.
Source code in src\statista\confidence_interval.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
bs_indexes(data, n_samples=10000)
staticmethod
#
bs_indexes.
- generate random indeces to shuffle the data of the given array.
- using the indeces, you can access the given data array and get randomly generated data from the
original given data.
- Given data points data, where axis 0 is considered to delineate points, return a generator for
sets of bootstrap indexes.
This can be used as a list of bootstrap indexes (with list(bootstrap_indexes(data))) as well.
Returns:
| Type | Description |
|---|---|
|
np.ndarray: array with the same length as the input data, containing integer indices. |
Examples:
>>> from statista.confidence_interval import ConfidenceInterval
>>> data = [3.1, 2.4, 5.6, 8.4]
>>> indices = ConfidenceInterval.bs_indexes(data, n_samples=2)
Source code in src\statista\confidence_interval.py
boot_strap(data, state_function, alpha=0.05, n_samples=100, **kwargs)
staticmethod
#
boot_strap
Calculate confidence intervals using parametric bootstrap and the percentile interval method This is used to get confidence intervals for the estimators and the return values for several return values.
More info about bootstrapping can be found on
- Efron: "An Introduction to the Bootstrap", Chapman & Hall (1993)
- https://en.wikipedia.org/wiki/Bootstrapping_%28statistics%29
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
(list, ndarray)
|
data to be used to calculate the confidence interval |
required |
state_function
|
callable
|
function to be used to calculate the confidence interval |
required |
n_samples
|
int
|
number of samples to be generated. Default is 100. |
100
|
alpha
|
numeric
|
alpha or SignificanceLevel is a value of the confidence interval. Default is 0.05 |
0.05
|
**kwargs
|
gevfit (list): Three parameters of the GEV distribution [shape, loc, scale] F (list): non-exceedance probability/ cdf method (str): method used to fit the generated samples from the bootstrap method ["lmoments", "mle", "mm"]. Default is "lmoments". |
{}
|