Hartigan's Dip Statistic
The code below implements Hartigan's dip statistic in Matlab. The code was adapted from Hartigan's original Fortran code by Ferenc Mechler and was hosted briefly on Dario Ringach's website, which is where I obtained it. The zip-file contains the 3 m-files and 2 pdfs of Hartigan's original papers that are individually linked below.
- Zip file containing everything below
- The Dip Test of Unimodality. Hartigan JA & Hartigan PM. Annals of Statistics 1985, 13(1): 70-84 (pdf)
- Algorithm AS 217: Computation of the Dip Statistic to Test for Unimodality. Hartigan PM Applied Statistics (1985) 34(3): 320-325. (pdf)
- hartigansdiptest.m - implements dip test
- hartigansdipsigniftest.m - tests significance of dip statistic
- hartigansdiptestdemo.m - basic demo showing how dip test as a distribution changes from clearly uni- to bimodal