Resampling statistics: bootstrap confidence intervals and permutation tests,
as scipy.stats.bootstrap and scipy.stats.permutation_test.
- Source:
Methods
(static) bootstrap(data, statisticopt, optionsopt) → {BootstrapResult}
Bootstrap estimate of the sampling distribution of a statistic.
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Array | The sample. |
||||||||||||||||||||||
statistic |
function |
<optional> |
mean | Statistic computed on a sample. |
||||||||||||||||||||
options |
Object |
<optional> |
Properties
|
- Source:
Returns:
- Type
- BootstrapResult
Example
const result = bootstrap(data, (xs) => median(xs), { nResamples: 5000 })
result.confidenceInterval // [low, high]
(static) permutationTest(x, y, statisticopt, optionsopt) → {PermutationTestResult}
Two-sample permutation test of the null hypothesis that both samples come from the same distribution.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
Array.<number> | First sample. |
||||||||||||||||
y |
Array.<number> | Second sample. |
||||||||||||||||
statistic |
function |
<optional> |
Test statistic; difference of means by default. |
|||||||||||||||
options |
Object |
<optional> |
Properties
|
- Source:
Returns:
- Type
- PermutationTestResult
Example
permutationTest(control, treatment).pvalue
Type Definitions
BootstrapResult
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
estimate |
number | The statistic on the original data. |
standardError |
number | Standard deviation of the bootstrap distribution. |
bias |
number | Mean of the bootstrap distribution minus the estimate. |
confidenceInterval |
Array.<number> | [lower, upper] bounds. |
distribution |
Array.<number> | The bootstrap replicates of the statistic. |
- Source:
PermutationTestResult
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
statistic |
number | The observed statistic. |
pvalue |
number | The permutation p-value. |
nullDistribution |
Array.<number> | Statistic values under random relabelling. |
- Source: