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

Add stderror and meandiff functions for TTest

Open pdeffebach opened this issue 7 years ago • 9 comments

Fixes issue #150 by adding two small functions for TTest abstract types.

There are probably many more types we can define this for if we want.

It's clear that a getproperty give the user what they need, but it's good practice to wrap all of these in a function.

pdeffebach avatar Feb 21 '19 16:02 pdeffebach

I guess it makes sense to use stderror since it already exists, but is it really worth exporting a new meandiff function for that?

A few other ideas:

  • print the standard error in the test output?
  • add it to the docstring
  • add tests

nalimilan avatar Feb 22 '19 12:02 nalimilan

Fair enough about the meandiff.

Should I go ahead and make all of these changes for all functions that have confint defined? If you have a confidence interval, surely you have a standard error.

pdeffebach avatar Feb 22 '19 20:02 pdeffebach

Should I go ahead and make all of these changes for all functions that have confint defined? If you have a confidence interval, surely you have a standard error.

If it makes sense for those tests, yes.

nalimilan avatar Feb 22 '19 20:02 nalimilan

Now that I'm on winter break I will work on this more. I will start by making a list of all the tests and whether or not stderror is well defined.

pdeffebach avatar Dec 23 '19 02:12 pdeffebach

To determine which tests should be updated I searched for confint and the following tests have confint implemented:

  • t-test: Implemented easily
  • z: Implemented easily
  • Binomial: Tough because there are multiple methods of calculating it. It's not clear to me whether the standard error is just sqrt(p * (1-p) / n) for everything and the confidence intervals are calculated differently for each test.
  • Partial Correlation test: Wikipedia tells me the standard error is just sqrt(1 / dof(test). So this is implemented.
  • Fisher's exact test: I think the Fisher's Hon-central Hypergeometric geometric distribution has a well-defined standard deviation available in Distributions.
  • Power Divergence Test: Googling tells me that this statistic doesn't have a standard error associated with it.
  • Signed Rank Test: As far as I can tell the standard error is not commonly used for this test.

pdeffebach avatar Dec 23 '19 06:12 pdeffebach

I totally forgot about this pull request for over a year, but I just added tests. I think this is good to be merged.

I didn't add stderror for Fischer's exact test because I don't understand it enough. I can always add it later.

pdeffebach avatar Mar 13 '20 16:03 pdeffebach

Thanks. There should probably be documentation for these methods, just like what we have for confint and pvalue?

nalimilan avatar Mar 26 '20 12:03 nalimilan

Thanks! added tests for the empty function and then edited all the implements:... docstrings in the docstrings for the types.

pdeffebach avatar Mar 29 '20 20:03 pdeffebach

This PR can be merged I think. Sorry this has languished.

pdeffebach avatar Jun 08 '20 16:06 pdeffebach