Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.
/ pyMCSpearman Public archive

Monte carlo calculation of Spearman's rank correlation coefficient with uncertainties. Following Curran (2014)

License

Notifications You must be signed in to change notification settings

privong/pyMCSpearman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pymcspearman

Note: This repository has been archived and is no longer being maintained. The project has migrated (and expanded) to pymccorrelation.

A tool to calculate Spearman's rank correlation coefficient for data, using bootstrapping and/or perturbation to estimate the uncertainties on the correlation coefficient. This is a python implementation of Curran (2014). Curran's original C implementation is MCSpearman (ASCL entry).

Status

All three modes (bootstrapping only, perturbing only, and composite) have been tested against Curran's code using the test data provided with MCSpearman. The (not very stringent) tests can be run using the run_tests() function or by running python pymcspearman.py.

The python implementation is currently noticeably slower than the original C implementation. For the test data (53 entries) and 1e5 iterations:

Bootstrap

$ time ./mcspearman -infile test.data -i 10000 -method 1
...
real	0m0.389s
user	0m0.385s
sys	0m0.005s

$ time python3 pymcspearman.py    # with only bootstrapping left uncommented
...
real	0m4.542s
user	0m4.475s
sys 	0m0.048s

Perturbation

$ time ./mcspearman -infile test.data -i 10000 -method 2
...
real	0m0.330s
user	0m0.320s
sys	0m0.012s

$ time python3 pymcspearman.py    # with only perturbation left uncommented
...
real	0m4.667s
user	0m4.622s
sys 	0m0.025s

Bootstrap & Perturbation

$ time ./mcspearman -infile test.data -i 10000 -method 3
...
real	0m0.394s
user	0m0.380s
sys	0m0.011s

$ time python3 pymcspearman.py     # with only composite method left uncommented
...
real	0m5.000s
user	0m4.703s
sys 	0m0.078s

Requirements

  • python3
  • scipy
  • numpy

About

Monte carlo calculation of Spearman's rank correlation coefficient with uncertainties. Following Curran (2014)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages