HypothesisTests.jl
HypothesisTests.jl copied to clipboard
Add accessor functions
Currently to get the t-statistic and degrees of freedom from a OneSampleTTest, you need to do OneSampleTTest(x).t and OneSampleTTest(x).df, respectively. It seems to me that it would be nice to provide a unified interface for extracting the test statistic and degrees of freedom from a HypothesisTest object. I was thinking of something along the lines of:
statistic(OneSampleTTest(x)) == OneSampleTTest(x).t
dof(OneSampleTTest(x)) == OneSampleTTest(x).df
where dof would be extended from StatsBase.
Thoughts?
Any advances for easing the access to test's parameters?
Probably not. Help welcome.
It seems like every statistic reported in the table of output should have an accessor method. Would be nice to go through all the show_params methods for each test and add a function for each.
Why not return a dictionary. Then the user can query the dictionary for the parameter they are interested in.
mydict = getparamdict(OneSampleTTest(x))
# show the output
println( mydict["output"] )
# show the value of t
println("t is ", mydict["t"] )
Building a dictionary is quite inefficient when you just need one value.
For the multivariate tests I ported over from MultivariateTests.jl, I actually did add the dof extension, so this feature request is now about 5% implemented.
I wouldn't mind handling this. I can just go through and add all the things that are listed in the show_params function for each test.