From 27e6dc60b711499fe6a0925dda2ef588e1123e3e Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Sat, 29 Jul 2023 12:01:01 -0700 Subject: [PATCH] Add a function for extracting a test statistic This is added to StatsAPI rather than to HypothesisTests since StatsAPI also houses `HypothesisTest`, `pvalue`, and other relevant functionality. Defining this function will bring a resolution to the 7-year-old issue https://github.com/JuliaStats/HypothesisTests.jl/issues/79, which has received a number of duplicates over the years, suggesting that it would be of general interest. --- src/StatsAPI.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/StatsAPI.jl b/src/StatsAPI.jl index eef2fdf..0c8f3dd 100644 --- a/src/StatsAPI.jl +++ b/src/StatsAPI.jl @@ -37,8 +37,8 @@ function pairwise! end Abstract supertype for all statistical hypothesis tests. Subtypes must implement [`pvalue`](@ref) at a minimum and may also -implement functions such as [`confint`](@ref), [`nobs`](@ref), and -[`dof`](@ref) as appropriate. +implement functions such as [`teststatistic`](@ref), [`confint`](@ref), +[`nobs`](@ref), and [`dof`](@ref) as appropriate. """ abstract type HypothesisTest end @@ -49,4 +49,11 @@ Compute the p-value for a given significance test. """ function pvalue end +""" + teststatistic(test) + +Return the test statistic for a given hypothesis test. +""" +function teststatistic end + end # module