HypothesisTests.jl icon indicating copy to clipboard operation
HypothesisTests.jl copied to clipboard

Specifying pvalue computation method for BinomialTest

Open Sid-Bhatia-0 opened this issue 4 years ago • 0 comments

The confint method provides a keyword argument called method that can take values from {:clopper_pearson, :wald, :wilson, :jeffrey, :agresti_coull, :arcsine}

The pvalue function does not seem to accept an argument called method for a BinomialTest. So how do I choose the technique for p-value computation of a BinomialTest instance?

Version info:

julia> versioninfo()
Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = /usr/bin/vim

Package status:

(JC) pkg> st
Status `~/acads/projects/JC/Project.toml`
  [31a5f54b] Debugger v0.6.6
  [09f84164] HypothesisTests v0.10.0
  [1914dd2f] MacroTools v0.5.5
  [5fb14364] OhMyREPL v0.5.8

MethodError:

julia> using HypothesisTests

julia> t = BinomialTest(51, 235, 1/6)
Binomial test
-------------
Population details:
    parameter of interest:   Probability of success
    value under h_0:         0.16666666666666666
    point estimate:          0.2170212765957447
    95% confidence interval: (0.1661, 0.2753)

Test summary:
    outcome with 95% confidence: fail to reject h_0
    two-sided p-value:           0.0531

Details:
    number of observations: 235
    number of successes:    51


julia> pvalue(t, tail = :both, method = :clopper_pearson)
ERROR: MethodError: no method matching pvalue(::BinomialTest; tail=:both, method=:clopper_pearson)
Closest candidates are:
  pvalue(::BinomialTest; tail) at /home/sid/.julia/packages/HypothesisTests/5rgiE/src/binomial.jl:67 got unsupported keyword argument "method"
  pvalue(::DurbinWatsonTest; tail) at /home/sid/.julia/packages/HypothesisTests/5rgiE/src/durbin_watson.jl:180 got unsupported keyword argument "method"
  pvalue(::PowerDivergenceTest; tail) at /home/sid/.julia/packages/HypothesisTests/5rgiE/src/power_divergence.jl:44 got unsupported keyword argument "method"
  ...
Stacktrace:
 [1] kwerr(::NamedTuple{(:tail, :method),Tuple{Symbol,Symbol}}, ::Function, ::BinomialTest) at ./error.jl:157
 [2] top-level scope at REPL[6]:1

Sid-Bhatia-0 avatar Sep 16 '20 06:09 Sid-Bhatia-0