nalimilan / FreqTables.jl

Frequency tables in Julia
Other
89 stars 19 forks source link

Feature Request: Statistical Test #39

Closed LawrenceMz closed 5 years ago

LawrenceMz commented 5 years ago

Hi, It would be very useful if there was an option to calculate the Fisher's exact test and chi-squared test.

nalimilan commented 5 years ago

Doesn't this suit your needs? http://juliastats.github.io/HypothesisTests.jl/latest/parametric/#Pearson-chi-squared-test-1

LawrenceMz commented 5 years ago

I can understand why you want to have a simpler module with few dependencies. However, I think that in high-level modules it is better to give options that make things easier for users. For example, compare the lines required to do the same task between Stata and Julia:

Stata: tab x y, chi2 exact

Julia: tbl = freqtable (df.x, df.y, skipmissing = true) ChisqTest (tbl) FisherExactTest (tbl [1,1], tbl [1,2], tbl [2,1], tbl [2,2])

Chi-square's function is pretty straightforward, but Fisher's function is not very glamorous. When you have to do this hundreds of times your productivity is not going to be the same, that adds up.

Anyway, thank you for your answer and I hope that this module is soon included somewhere in JuliaStats. I think the next step is to report a problem in HypothesisTests, asking FisherExactTest to receive AbstractMatrix like ChisqTest and maybe in the future to make a module that uses FreqTables and HypothesisTests as a base but providing a simpler and more direct interface.

Thanks again for your great work.

nalimilan commented 5 years ago

Yes, the problem is in HypothesisTests, not FreqTables. Please file an issue there.