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

Add accessor functions

Open ararslan opened this issue 9 years ago • 7 comments

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?

ararslan avatar Oct 04 '16 03:10 ararslan

Any advances for easing the access to test's parameters?

DominiqueMakowski avatar Aug 30 '18 19:08 DominiqueMakowski

Probably not. Help welcome.

nalimilan avatar Sep 02 '18 13:09 nalimilan

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.

pdeffebach avatar Mar 18 '19 18:03 pdeffebach

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"]  )

StevenSiew avatar Dec 19 '19 00:12 StevenSiew

Building a dictionary is quite inefficient when you just need one value.

nalimilan avatar Dec 19 '19 08:12 nalimilan

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.

ararslan avatar Dec 19 '19 18:12 ararslan

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.

pdeffebach avatar Dec 23 '19 16:12 pdeffebach