Skip to content

Commit

Permalink
Add a function for extracting a test statistic
Browse files Browse the repository at this point in the history
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
JuliaStats/HypothesisTests.jl#79, which has
received a number of duplicates over the years, suggesting that it would
be of general interest.
  • Loading branch information
ararslan committed Jul 29, 2023
1 parent 64d7d28 commit 27e6dc6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/StatsAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

1 comment on commit 27e6dc6

@babaq
Copy link

@babaq babaq commented on 27e6dc6 Jul 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is teststat(s) shorter and still clear enough compared to teststatistic?

Please sign in to comment.