Implement ZTEST: One-Sample t-Test Statistic with validation tests

- Added Ztest class to compute the one-sample t-statistic using sample standard deviation with Bessel correction.
- Implemented validation tests for Ztest to ensure accuracy against manual calculations and PineScript.
- Updated documentation for Ztest, detailing its mathematical foundation, performance profile, and common pitfalls.
- Adjusted NDepend badges to reflect changes in code metrics after implementation.
- Updated missing indicators report to reflect the completion of statistical indicators, including ZTEST.
This commit is contained in:
Miha Kralj
2026-02-16 16:54:36 -08:00
parent 09ffd31a40
commit b3a64f18fa
73 changed files with 13041 additions and 88 deletions
+10
View File
@@ -217,13 +217,23 @@ Mathematical and statistical computations on price series.
| [**HARMEAN**](../lib/statistics/harmean/Harmean.md) | Harmonic Mean | Rolling harmonic mean via reciprocal-sum approach |
| [**HURST**](../lib/statistics/hurst/Hurst.md) | Hurst Exponent | Long-range dependence via Rescaled Range (R/S) analysis |
| [**IQR**](../lib/statistics/iqr/Iqr.md) | Interquartile Range | Robust dispersion measure (Q3 - Q1) |
| [**JB**](../lib/statistics/jb/Jb.md) | Jarque-Bera Test | Normality test combining skewness and kurtosis |
| [**KENDALL**](../lib/statistics/kendall/Kendall.md) | Kendall Tau-a | Rank-based ordinal association [-1, +1] |
| [**GRANGER**](../lib/statistics/granger/Granger.md) | Granger Causality | F-statistic testing if X helps predict Y |
| [**LINREG**](../lib/statistics/linreg/LinReg.md) | Linear Regression | Best-fit line |
| [**MEDIAN**](../lib/statistics/median/Median.md) | Rolling Median | 50th percentile |
| [**MODE**](../lib/statistics/mode/Mode.md) | Mode | Most frequent value in rolling window |
| [**KURTOSIS**](../lib/statistics/kurtosis/Kurtosis.md) | Kurtosis | Fourth-moment excess kurtosis (sample/population) |
| [**PERCENTILE**](../lib/statistics/percentile/Percentile.md) | Percentile | Value at given percentile via linear interpolation (PERCENTILE.INC) |
| [**QUANTILE**](../lib/statistics/quantile/Quantile.md) | Quantile | Value at given quantile (01) via linear interpolation |
| [**SKEW**](../lib/statistics/skew/Skew.md) | Skewness | Distribution asymmetry |
| [**SPEARMAN**](../lib/statistics/spearman/Spearman.md) | Spearman Rank Correlation | Pearson on ranks; monotonic association [-1, +1] |
| [**STDDEV**](../lib/statistics/stddev/StdDev.md) | Standard Deviation | Dispersion measure |
| [**SUM**](../lib/statistics/sum/Sum.md) | Rolling Sum | Windowed sum |
| [**THEIL**](../lib/statistics/theil/Theil.md) | Theil T Index | Information-theoretic inequality/concentration measure |
| [**VARIANCE**](../lib/statistics/variance/Variance.md) | Variance | Squared deviation |
| [**ZSCORE**](../lib/statistics/zscore/Zscore.md) | Z-Score | Population standard deviations from rolling mean |
| [**ZTEST**](../lib/statistics/ztest/Ztest.md) | Z-Test | One-sample t-statistic against hypothesized mean |
### Forecasts
+13 -4
View File
@@ -150,7 +150,7 @@ No external reference exists. Implementation verified through unit tests, edge c
| **Interquartile Range** | Iqr | - | - | - | - |
| **Intraday Intensity Index** | [Iii](../lib/volume/iii/Iii.md) | - | - | - | - |
| **Intraday Momentum Index** | Imi | - | - | - | ❔ |
| **Jarque-Bera Test** | Jb | - | - | - | - |
| **Jarque-Bera Test** | [Jb](../lib/statistics/jb/Jb.md) | - | - | - | - |
| **Jurik Moving Average** | [Jma](../lib/trends/jma/jma.md) | - | - | - | ❔ |
| **Jurik Volatility** | [Jvolty](../lib/volatility/jvolty/Jvolty.md) | - | - | - | - |
| **Jurik Adaptive Envelope Bands** | [Jbands](../lib/channels/jbands/Jbands.md) | - | - | - | - |
@@ -159,9 +159,9 @@ No external reference exists. Implementation verified through unit tests, edge c
| **Kaufman Adaptive Moving Average** | [Kama](../lib/trends/kama/kama.md) | ✔️ | ✔️ | ✔️ | ✔️ |
| **KDJ Indicator** | [Kdj](../lib/oscillators/kdj/Kdj.md) | - | - | - | - |
| **Keltner Channel** | [Kchannel](../lib/channels/kchannel/kchannel.md) | - | - | ✔️ | ❔ |
| **Kendall Rank Correlation** | Kendall | - | - | - | |
| **Kendall Rank Correlation** | [Kendall](../lib/statistics/kendall/Kendall.md) | - | - | - | - |
| **Klinger Volume Oscillator** | [Kvo](../lib/volume/kvo/Kvo.md) | - | ✔️ | ✔️ | ❔ |
| **Kurtosis** | Kurtosis | - | - | - | |
| **Kurtosis** | [Kurtosis](../lib/statistics/kurtosis/Kurtosis.md) | - | - | - | [✔️](../lib/statistics/kurtosis/Kurtosis.md#validation) |
| **Least Squares Moving Average** | [Lsma](../lib/trends/lsma/lsma.md) | ✔️ | - | ✔️ | ❔ |
| **Linear Regression** | [LinReg](../lib/statistics/linreg/LinReg.md) | ✔️ | ✔️ | ✔️ | [⚠️](../lib/statistics/linreg/LinReg.md#validation) |
| **Linear Transformation** | Lineartrans | - | - | - | - |
@@ -304,7 +304,7 @@ No external reference exists. Implementation verified through unit tests, edge c
| **Zero-Lag Exponential Moving Average** | [Zlema](../lib/trends_IIR/zlema/Zlema.md) | - | ✔️ | - | ❔ |
| **Zero-Lag Triple Exponential MA** | Zltema | - | - | - | ❔ |
| **ZigZag** | - | - | - | ✔️ | - |
| **Z-score standardization** | Zscore | - | - | - | |
| **Z-score standardization** | Zscore | - | - | - | ✔️ Manual + Standardize cross-validation |
| **Z-Test** | Ztest | - | - | - | - |
## Statistical Indicators
@@ -319,12 +319,21 @@ No external reference exists. Implementation verified through unit tests, edge c
| **Hurst Exponent** | [Hurst](../lib/statistics/hurst/Hurst.md) | - | - | - | - |
| **Interquartile Range** | [Iqr](../lib/statistics/iqr/Iqr.md) | - | - | - | - |
| **Granger Causality** | [Granger](../lib/statistics/granger/Granger.md) | - | - | - | - |
| **Jarque-Bera Test** | [Jb](../lib/statistics/jb/Jb.md) | - | - | - | - |
| **Kendall Rank Correlation** | [Kendall](../lib/statistics/kendall/Kendall.md) | - | - | - | - |
| **Median (Statistical)** | [Median](../lib/statistics/median/Median.md) | ✔️ | - | - | - |
| **Mode** | [Mode](../lib/statistics/mode/Mode.md) | - | - | - | - |
| **Percentile** | [Percentile](../lib/statistics/percentile/Percentile.md) | - | - | - | - |
| **Quantile** | [Quantile](../lib/statistics/quantile/Quantile.md) | - | - | - | - |
| **Skewness** | [Skew](../lib/statistics/skew/Skew.md) | ✔️ | - | - | - |
| **Spearman Rank Correlation** | [Spearman](../lib/statistics/spearman/Spearman.md) | - | - | - | - |
| **Standard Deviation** | [StdDev](../lib/statistics/stddev/StdDev.md) | ✔️ | ✔️ | ✔️ | ✔️ |
| **Sum (Rolling)** | [Sum](../lib/statistics/sum/Sum.md) | - | ✔️ | ✔️ | - |
| **Theil T Index** | [Theil](../lib/statistics/theil/Theil.md) | - | - | - | - |
| **Partial Autocorrelation Function** | [Pacf](../lib/statistics/pacf/Pacf.md) | - | - | - | - |
| **Variance** | [Variance](../lib/statistics/variance/Variance.md) | ✔️ | ✔️ | ✔️ | ✔️ |
| **Z-Score** | [Zscore](../lib/statistics/zscore/Zscore.md) | - | - | - | - |
| **Z-Test** | [Ztest](../lib/statistics/ztest/Ztest.md) | - | - | - | - |
## Error Metrics