├── .circleci └── config.yml ├── .coveragerc ├── .github └── workflows │ ├── circleci-artifact-redirector.yml │ ├── coverage.yml │ └── test.yml ├── .gitignore ├── CONTRIBUTE.rst ├── LICENSE ├── Makefile ├── README.rst ├── RELEASE.txt ├── TODO.txt ├── doc ├── Makefile ├── README.md ├── release │ ├── contribs.py │ ├── release_0.1.a2.txt │ ├── release_0.1.a3.txt │ ├── release_0.1.a4.txt │ ├── release_0.1.a5.txt │ ├── release_0.2.txt │ ├── release_dev.txt │ └── release_template.txt └── source │ ├── _static │ └── copybutton.js │ ├── api │ ├── core.rst │ ├── data.rst │ ├── index.rst │ ├── irr.rst │ ├── npc.rst │ ├── qa.rst │ ├── stratified.rst │ └── utils.rst │ ├── conf.py │ ├── dev │ ├── contribute.rst │ ├── gitwash │ │ ├── branch_dropdown.png │ │ ├── configure_git.rst │ │ ├── development_workflow.rst │ │ ├── following_latest.rst │ │ ├── forking_button.png │ │ ├── forking_hell.rst │ │ ├── git_development.rst │ │ ├── git_install.rst │ │ ├── git_intro.rst │ │ ├── git_links.inc │ │ ├── git_resources.rst │ │ ├── index.rst │ │ ├── known_projects.inc │ │ ├── links.inc │ │ ├── maintainer_workflow.rst │ │ ├── patching.rst │ │ ├── pull_button.png │ │ ├── set_up_fork.rst │ │ └── this_project.inc │ └── index.rst │ ├── index.rst │ ├── permute.bib │ └── user │ ├── index.rst │ ├── npc │ ├── chap1-4.rst │ ├── index.rst │ ├── kenya.rst │ └── westfall-wolfinger.rst │ ├── one-sample.rst │ ├── references.rst │ ├── regression.rst │ └── two-sample.rst ├── permute ├── __init__.py ├── conftest.py ├── core.py ├── data │ ├── MacNell2014.csv │ ├── __init__.py │ ├── npc │ │ ├── README.md │ │ ├── autofluorescence │ │ │ ├── autofl.csv │ │ │ ├── drusen.csv │ │ │ ├── micro.csv │ │ │ ├── oct.csv │ │ │ └── pigment.csv │ │ ├── botulinum.csv │ │ ├── chrom17m.csv │ │ ├── confocal.csv │ │ ├── examples_chapters_1-4 │ │ │ ├── fly.csv │ │ │ ├── ipat.csv │ │ │ ├── job.csv │ │ │ ├── testosterone.csv │ │ │ └── worms.csv │ │ ├── germina.csv │ │ ├── kenya.csv │ │ ├── massaro_blair.csv │ │ ├── monachus.csv │ │ ├── mult.csv │ │ ├── perch.csv │ │ ├── rats.csv │ │ ├── setig.csv │ │ ├── survival │ │ │ ├── three_sample.csv │ │ │ ├── three_sample_strata.csv │ │ │ ├── two_sample_surv.csv │ │ │ └── two_sample_surv_strata.csv │ │ ├── urology.csv │ │ ├── washing_test.csv │ │ └── waterfalls.csv │ ├── nsgk.csv │ ├── nsgk_data_clean.txt │ ├── rb_clinical_trial.csv │ └── tests │ │ ├── __init__.py │ │ ├── test_data.py │ │ ├── test_macnell.py │ │ └── test_nsgk.py ├── irr.py ├── ksample.py ├── npc.py ├── qa.py ├── sprt.py ├── stratified.py ├── tests │ ├── __init__.py │ ├── test_SPRT.py │ ├── test_core.py │ ├── test_importing.py │ ├── test_irr.py │ ├── test_ksample.py │ ├── test_npc.py │ ├── test_qa.py │ ├── test_stratified.py │ └── test_utils.py └── utils.py ├── requirements.txt ├── requirements ├── README.md ├── default.txt ├── doc.txt ├── release.txt └── test.txt └── setup.py /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # See: https://circleci.com/docs/2.0/language-python/ 2 | 3 | version: 2 4 | jobs: 5 | build: 6 | docker: 7 | - image: cimg/python:3.9.2 8 | 9 | steps: 10 | - checkout # checkout source code to working directory 11 | 12 | - run: 13 | name: Install TeX 14 | command: | 15 | sudo apt-get update 16 | sudo apt-get install dvipng 17 | sudo apt-get install texlive texlive-latex-extra latexmk texlive-xetex 18 | 19 | - run: 20 | name: Install Python dependencies 21 | command: | 22 | python3 -m venv venv 23 | source venv/bin/activate 24 | pip install --upgrade pip wheel setuptools 25 | pip install -r requirements/default.txt 26 | pip install -r requirements/doc.txt 27 | pip list 28 | 29 | - run: 30 | name: Install permute 31 | command: | 32 | source venv/bin/activate 33 | pip install -e . 34 | 35 | - run: 36 | name: Build docs 37 | command: | 38 | source venv/bin/activate 39 | make -C doc/ html 40 | #make -C doc/ latexpdf LATEXOPTS="-file-line-error -halt-on-error" 41 | #cp -a doc/build/latex/permute.pdf doc/build/html/. 42 | 43 | - store_artifacts: 44 | path: doc/build/html 45 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = permute 4 | include = */permute/* 5 | omit = */setup.py 6 | -------------------------------------------------------------------------------- /.github/workflows/circleci-artifact-redirector.yml: -------------------------------------------------------------------------------- 1 | on: [status] 2 | jobs: 3 | circleci_artifacts_redirector_job: 4 | runs-on: ubuntu-latest 5 | name: Run CircleCI artifacts redirector 6 | steps: 7 | - name: GitHub Action step 8 | uses: larsoner/circleci-artifacts-redirector-action@master 9 | with: 10 | repo-token: ${{ secrets.GITHUB_TOKEN }} 11 | artifact-path: 0/doc/build/html/index.html 12 | circleci-jobs: build 13 | -------------------------------------------------------------------------------- /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: coverage 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | ubuntu: 11 | runs-on: Ubuntu-latest 12 | strategy: 13 | matrix: 14 | python-version: [3.9] 15 | steps: 16 | - uses: actions/checkout@v3 17 | 18 | - name: Set up Python ${{ matrix.python-version }} 19 | uses: actions/setup-python@v4 20 | with: 21 | python-version: ${{ matrix.python-version }} 22 | 23 | - name: Before install 24 | run: | 25 | python3 -m venv ~/venv 26 | source ~/venv/bin/activate 27 | 28 | - name: Install packages 29 | run: | 30 | pip install --upgrade pip wheel setuptools 31 | pip install -r requirements/default.txt 32 | pip install -r requirements/test.txt 33 | pip install . 34 | pip list 35 | 36 | - name: Coverage report for permute 37 | run: | 38 | make coverage 39 | codecov 40 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | 11 | ubuntu: 12 | runs-on: Ubuntu-latest 13 | strategy: 14 | matrix: 15 | python-version: ["3.8", "3.9", "3.10"] 16 | steps: 17 | - uses: actions/checkout@v3 18 | - name: Set up Python ${{ matrix.python-version }} 19 | uses: actions/setup-python@v4 20 | with: 21 | python-version: ${{ matrix.python-version }} 22 | 23 | - name: Before install 24 | run: | 25 | python3 -m venv ~/venv 26 | source ~/venv/bin/activate 27 | 28 | - name: Install packages 29 | run: | 30 | pip install --upgrade pip wheel setuptools 31 | pip install -r requirements/default.txt 32 | pip install -r requirements/test.txt 33 | pip install . 34 | pip list 35 | 36 | - name: Test permute 37 | run: make test-all 38 | 39 | macos: 40 | runs-on: macOS-latest 41 | strategy: 42 | matrix: 43 | python-version: ["3.8", "3.9", "3.10"] 44 | steps: 45 | - uses: actions/checkout@v3 46 | - name: Set up Python ${{ matrix.python-version }} 47 | uses: actions/setup-python@v4 48 | with: 49 | python-version: ${{ matrix.python-version }} 50 | 51 | - name: Before install 52 | run: | 53 | python3 -m venv ~/venv 54 | source ~/venv/bin/activate 55 | 56 | - name: Install packages 57 | run: | 58 | pip install --upgrade pip wheel setuptools 59 | pip install -r requirements/default.txt 60 | pip install -r requirements/test.txt 61 | pip install . 62 | pip list 63 | 64 | - name: Test permute 65 | run: make test-all 66 | 67 | windows: 68 | runs-on: windows-latest 69 | strategy: 70 | matrix: 71 | python-version: ["3.8", "3.9", "3.10"] 72 | steps: 73 | - uses: actions/checkout@v3 74 | - name: Set up Python ${{ matrix.python-version }} 75 | uses: actions/setup-python@v4 76 | with: 77 | python-version: ${{ matrix.python-version }} 78 | 79 | - name: Before install 80 | run: | 81 | python -m venv venv 82 | venv\Scripts\Activate.ps1 83 | 84 | - name: Install packages 85 | run: | 86 | pip install --upgrade pip wheel setuptools 87 | pip install -r requirements\default.txt 88 | pip install -r requirements\test.txt 89 | pip install . 90 | pip list 91 | 92 | - name: Test permute 93 | run: make test-all 94 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | version.py 2 | .DS_Store 3 | permute/old/Datasets_MATLAB_R_NPC/ 4 | 5 | # IPython notebooks 6 | *.ipynb 7 | .ipynb_checkpoints 8 | 9 | # Byte-compiled / optimized / DLL files 10 | __pycache__/ 11 | *.py[cod] 12 | 13 | # C extensions 14 | *.so 15 | 16 | # Distribution / packaging 17 | .Python 18 | env/ 19 | bin/ 20 | build/ 21 | develop-eggs/ 22 | dist/ 23 | eggs/ 24 | lib/ 25 | lib64/ 26 | parts/ 27 | sdist/ 28 | var/ 29 | *.egg-info/ 30 | .installed.cfg 31 | *.egg 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .cache 42 | nosetests.xml 43 | coverage.xml 44 | 45 | # Translations 46 | *.mo 47 | 48 | # Mr Developer 49 | .mr.developer.cfg 50 | .project 51 | .pydevproject 52 | 53 | # Rope 54 | .ropeproject 55 | 56 | # Django stuff: 57 | *.log 58 | *.pot 59 | 60 | # Sphinx documentation 61 | doc/build/ 62 | doc/source/_static/test.png 63 | 64 | \#* 65 | *~ 66 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2021, Philip Stark, Jarrod Millman, Kellie Ottoboni, Stefan van der Walt, and Matthew Brett 2 | Copyright (c) 2014, Philip Stark and Jarrod Millman 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all clean test 2 | 3 | all: 4 | python setup.py build_ext --inplace 5 | 6 | clean: 7 | find . -name "*.so" -o -name "*.pyc" -o -name "*.pyx.md5" | xargs rm -f 8 | rm -rf build dist permute.egg-info 9 | rm -rf .ipynb_checkpoints .coverage .cache 10 | 11 | test: 12 | pytest --durations=10 --pyargs permute 13 | 14 | doctest: 15 | pytest --doctest-modules --durations=10 --pyargs permute 16 | 17 | test-all: 18 | pytest --runslow --doctest-modules --durations=10 --pyargs permute 19 | 20 | coverage: 21 | pytest --cov=permute --runslow --doctest-modules --durations=10 --pyargs permute 22 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Permutation tests and confidence sets 2 | ===================================== 3 | 4 | |PyPI| |Build Status| |Coverage Status| 5 | 6 | Permutation tests and confidence sets for a variety of nonparametric 7 | testing and estimation problems, for a variety of randomization designs. 8 | 9 | - **Website (including documentation):** 10 | http://statlab.github.io/permute 11 | - **Mailing list:** http://groups.google.com/group/permute 12 | - **Source:** https://github.com/statlab/permute 13 | - **Bug reports:** https://github.com/statlab/permute/issues 14 | 15 | Installation from binaries 16 | -------------------------- 17 | 18 | :: 19 | 20 | $ pip install permute 21 | 22 | Installation from source 23 | ------------------------ 24 | 25 | Install dependencies using: 26 | 27 | :: 28 | 29 | $ pip install -r requirements.txt 30 | 31 | Then, install permute using: 32 | 33 | :: 34 | 35 | $ pip install . 36 | 37 | If you plan to develop the package, you may run it directly from source: 38 | 39 | :: 40 | 41 | $ pip install -e . # Do this once to add pkg to Python path 42 | 43 | License information 44 | ------------------- 45 | 46 | See the file LICENSE for information on the history of this software, 47 | terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES. 48 | 49 | .. |PyPI| image:: https://img.shields.io/pypi/v/permute.svg 50 | :target: https://pypi.org/project/permute/ 51 | .. |Build Status| image:: https://github.com/statlab/permute/workflows/default/badge.svg?branch=master 52 | :target: https://github.com/statlab/permute/actions?query=workflow%3Adefault+branch%3Amaster 53 | .. |Coverage Status| image:: https://codecov.io/gh/statlab/permute/branch/master/graph/badge.svg 54 | :target: https://codecov.io/gh/statlab/permute 55 | -------------------------------------------------------------------------------- /RELEASE.txt: -------------------------------------------------------------------------------- 1 | How to make a new release of ``permute`` 2 | ======================================== 3 | 4 | - Check ``TODO.txt`` for any outstanding tasks. 5 | 6 | - Update release notes. 7 | 8 | 1. Review and cleanup ``doc/release/release_dev.txt`` 9 | 10 | - To show a list of merges and contributors, run 11 | ``doc/release/contribs.py ``. 12 | 13 | 2. Rename to ``doc/release/release_.txt`` 14 | 15 | 3. Copy ``doc/release/release_template.txt`` to 16 | ``doc/release/release_dev.txt`` for the next release. 17 | 18 | 4. Make PR, review, and merge. 19 | 20 | - Update the version number in ``permute/__init__.py`` by removing the 21 | ``.dev0`` suffix from ``__version__ = .dev0``, commit, and push:: 22 | 23 | git add permute/__init__.py 24 | git commit -m "Designate release" 25 | 26 | - Update the docs: 27 | 28 | - Build a clean version of the docs. Run ``python setup.py install`` in the 29 | root dir, then ``make clean; make html; make pdflatex`` in the docs. 30 | - Deploy: ``make github``. 31 | 32 | - Add the version number as a tag in git:: 33 | 34 | git tag -s permute- -m 'signed tag' 35 | 36 | (If you do not have a gpg key, use -m instead; it is important for 37 | Debian packaging that the tags are annotated) 38 | 39 | - Push the new meta-data to github:: 40 | 41 | git push --tags upstream main 42 | 43 | - Review GitHub release page:: 44 | 45 | https://github.com/statlab/cryptorandom/releases 46 | 47 | - Publish on PyPi:: 48 | 49 | git clean -fxd 50 | python setup.py sdist 51 | python setup.py bdist_wheel 52 | twine upload dist/* 53 | 54 | - On the main branch, update the version number in ``permute/__init__.py`` 55 | to ``__version__ = .dev0``. For example, if 56 | `` == 0.1``, then `` == 0.2rc1``. Note that, 57 | if `` == 0.2rc1``, `` == 0.2rc2``; but, if all goes well, 58 | the next release may be ``0.2``. Then add, commit, and push:: 59 | 60 | git add permute/__init__.py 61 | git commit -m 'Bump version' 62 | git push <...> 63 | 64 | - Post release notes on mailing lists, blog, G+, etc. 65 | 66 | - permute@googlegroups.com 67 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | 1. NSGK results 2 | - current tests has significant results and concordance is less than 1/2 3 | - is there a test that reveals scientifically significant results 4 | as well as statistically significant 5 | 6 | 2. Performance (Pythonic) 7 | - numba / Cython ? (Stefan) 8 | 9 | 3. permuter scripts in pkg / building blocks 10 | - Ultimately want scripts in permute to test. Are vignettes reusable? 11 | - enumerate / (combinat from CSP.R) 12 | - itertools.combinations 13 | 14 | 4. two_sample 15 | - exact two-sample problem 16 | - (use MacNell as example/test) 17 | - see issue + gist 18 | - Write a vignette to show how this can be used to do rank tests, e.g. Wilcoxon 19 | 20 | 5. k-sample tests 21 | - ks-like test statistic: combine ks for each pair of samples by max distance, sum of distances, npc... 22 | - Permutation ANOVA 23 | - other? 24 | 25 | 6. n-dimensional k-sample 26 | - MST 27 | - LLQ 28 | - MDL (research topic) 29 | 30 | 7. Association 31 | - Pearson 32 | - Spearman (replace data by their ranks in call to Pearson) 33 | - Regression ( null beta=0) 34 | 35 | 8. Misc non-parametrics 36 | - Runs tests 37 | - Other kinds of symmetry 38 | - Romano-style projection 39 | 40 | 9. Contingency tables 41 | - ecological fixed-margin tests 42 | - Stefan's data example - see issue 43 | 44 | 10. Nonparametric combination of tests 45 | - generalize the IRR NPC code -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | @echo " github to upload the web site via gh-pages" 49 | 50 | clean: 51 | rm -rf $(BUILDDIR)/* source/bibtex.json 52 | 53 | html: 54 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 55 | @echo 56 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 57 | 58 | dirhtml: 59 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 60 | @echo 61 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 62 | 63 | singlehtml: 64 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 65 | @echo 66 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 67 | 68 | pickle: 69 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 70 | @echo 71 | @echo "Build finished; now you can process the pickle files." 72 | 73 | json: 74 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 75 | @echo 76 | @echo "Build finished; now you can process the JSON files." 77 | 78 | htmlhelp: 79 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 80 | @echo 81 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 82 | ".hhp project file in $(BUILDDIR)/htmlhelp." 83 | 84 | qthelp: 85 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 86 | @echo 87 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 88 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 89 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Permutationtestsandconfidencesets.qhcp" 90 | @echo "To view the help file:" 91 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Permutationtestsandconfidencesets.qhc" 92 | 93 | devhelp: 94 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 95 | @echo 96 | @echo "Build finished." 97 | @echo "To view the help file:" 98 | @echo "# mkdir -p $$HOME/.local/share/devhelp/Permutationtestsandconfidencesets" 99 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Permutationtestsandconfidencesets" 100 | @echo "# devhelp" 101 | 102 | epub: 103 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 104 | @echo 105 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 106 | 107 | latex: 108 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 109 | @echo 110 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 111 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 112 | "(use \`make latexpdf' here to do that automatically)." 113 | 114 | latexpdf: 115 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 116 | @echo "Running LaTeX files through pdflatex..." 117 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 118 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 119 | 120 | latexpdfja: 121 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 122 | @echo "Running LaTeX files through platex and dvipdfmx..." 123 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 124 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 125 | 126 | text: 127 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 128 | @echo 129 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 130 | 131 | man: 132 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 133 | @echo 134 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 135 | 136 | texinfo: 137 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 138 | @echo 139 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 140 | @echo "Run \`make' in that directory to run these through makeinfo" \ 141 | "(use \`make info' here to do that automatically)." 142 | 143 | info: 144 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 145 | @echo "Running Texinfo files through makeinfo..." 146 | make -C $(BUILDDIR)/texinfo info 147 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 148 | 149 | gettext: 150 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 151 | @echo 152 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 153 | 154 | changes: 155 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 156 | @echo 157 | @echo "The overview file is in $(BUILDDIR)/changes." 158 | 159 | linkcheck: 160 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 161 | @echo 162 | @echo "Link check complete; look for any errors in the above output " \ 163 | "or in $(BUILDDIR)/linkcheck/output.txt." 164 | 165 | doctest: 166 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 167 | @echo "Testing of doctests in the sources finished, look at the " \ 168 | "results in $(BUILDDIR)/doctest/output.txt." 169 | 170 | xml: 171 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 172 | @echo 173 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 174 | 175 | pseudoxml: 176 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 177 | @echo 178 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 179 | 180 | github: html latexpdf 181 | touch $(BUILDDIR)/html/.nojekyll 182 | cp -a $(BUILDDIR)/latex/permute.pdf $(BUILDDIR)/html/. 183 | ghp-import $(BUILDDIR)/html 184 | git push upstream gh-pages --force 185 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Building docs # 2 | To build docs, run `make` in this directory. `make help` lists all targets. 3 | 4 | ## Requirements ## 5 | Sphinx and Latex is needed to build doc. 6 | 7 | **Spinx:** 8 | ```sh 9 | pip install sphinx 10 | ``` 11 | 12 | **Latex Ubuntu:** 13 | ```sh 14 | sudo apt-get install -qq texlive texlive-latex-extra dvipng 15 | ``` 16 | 17 | **Latex Mac:** 18 | 19 | Install the full [MacTex](http://www.tug.org/mactex/) installation or install the smaller [BasicTex](http://www.tug.org/mactex/morepackages.html) and add *ucs* and *dvipng* packages: 20 | ```sh 21 | sudo tlmgr install ucs dvipng 22 | ``` 23 | 24 | 25 | ## Fixing Warnings ## 26 | 27 | - "citation not found: R###" 28 | $ cd doc/build; grep -rin R### . 29 | There is probably an underscore after a reference 30 | in the first line of a docstring (e.g. [1]_) 31 | 32 | - "Duplicate citation R###, other instance in..."" 33 | There is probably a [2] without a [1] in one of 34 | the docstrings 35 | 36 | - Make sure to use pre-sphinxification paths to images 37 | (not the _images directory) 38 | -------------------------------------------------------------------------------- /doc/release/contribs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import subprocess 3 | import sys 4 | import string 5 | import shlex 6 | 7 | if len(sys.argv) != 2: 8 | print("Usage: ./contributors.py tag-of-previous-release") 9 | sys.exit(-1) 10 | 11 | tag = sys.argv[1] 12 | 13 | def call(cmd): 14 | return subprocess.check_output(shlex.split(cmd), universal_newlines=True).split('\n') 15 | 16 | tag_date = call("git show --format='%%ci' %s" % tag)[0] 17 | print(f"Release {tag} was on {tag_date}\n") 18 | 19 | merges = call("git log --since='%s' --merges --format='>>>%%B' --reverse" % tag_date) 20 | merges = [m for m in merges if m.strip()] 21 | merges = '\n'.join(merges).split('>>>') 22 | merges = [m.split('\n')[:2] for m in merges] 23 | merges = [m for m in merges if len(m) == 2 and m[1].strip()] 24 | 25 | num_commits = call("git rev-list %s..HEAD --count" % tag)[0] 26 | print("A total of %s changes have been committed.\n" % num_commits) 27 | 28 | print("It contained the following %d merges:\n" % len(merges)) 29 | for (merge, message) in merges: 30 | if merge.startswith('Merge pull request #'): 31 | PR = ' (%s)' % merge.split()[3] 32 | else: 33 | PR = '' 34 | 35 | print('- ' + message + PR) 36 | 37 | 38 | print("\nMade by the following committers [alphabetical by last name]:\n") 39 | 40 | authors = call("git log --since='%s' --format=%%aN" % tag_date) 41 | authors = [a.strip() for a in authors if a.strip()] 42 | 43 | def key(author): 44 | author = [v for v in author.split() if v[0] in string.ascii_letters] 45 | return author[-1] 46 | 47 | authors = sorted(set(authors), key=key) 48 | 49 | for a in authors: 50 | print('- ' + a) 51 | -------------------------------------------------------------------------------- /doc/release/release_0.1.a2.txt: -------------------------------------------------------------------------------- 1 | Announcement: permute 0.1.alpha2 2 | ================================ 3 | 4 | We're happy to announce the release of permute v0.1.alpha2! 5 | 6 | permute is permutation testing and confidence set toolbox for Python. 7 | 8 | For more information, examples, and documentation, please visit our website: 9 | 10 | http://statlab.github.io/permute/ 11 | 12 | 13 | New Features 14 | ------------ 15 | 16 | This is the second release so everything is stilll new. As we get closer to 17 | the actual v0.1.0 release we will expand this section. 18 | 19 | 20 | A total of 91 changes have been committed. 21 | 22 | It contained the following 65 merges: 23 | 24 | - Package (#2) 25 | - Conform to PEP8 (#3) 26 | - Docs (#4) 27 | - * first-test: 28 | - * data: 29 | - * data: 30 | - * irr: 31 | - * 'master' of github.com:pbstark/permute: 32 | - Fixes - IRR permutation (#8) 33 | - * 'master' of github.com:pbstark/permute: 34 | - * doc: 35 | - Change to shuffling within rows (#11) 36 | - Irr test (#10) 37 | - close #7 (#17) 38 | - RF: try using module-level random state (#18) 39 | - ENH: enable travis-ci (#19) 40 | - * master: 41 | - * npc: 42 | - ENH: remove dependency on pandas (closes #16) (#20) 43 | - BF: set seed (#23) 44 | - Refactor philips example code closes #24 (#25) 45 | - Docstrings (#26) 46 | - Dev notes (#31) 47 | - Go over stratif (#32) 48 | - MRG: Minor cleanup (#35) 49 | - MRG: Workon core (#36) 50 | - MRG: Test core (#38) 51 | - DATA: added NSGK data (#40) 52 | - Improve tests (#41) 53 | - Debug two sample (#43) 54 | - ENH: correlation tests from work on SET with Anne Boring (#42) 55 | - MRG: Cleanup from friday (#44) 56 | - MRG: class demo (#45) 57 | - BF: test for zero variances to avoid divide by zero (#47) 58 | - Eda and cleanup (#49) 59 | - ENH: find duplicate consecutive rows (#50) 60 | - MRG: Clean naomi data (#48) 61 | - MRG: Improve website (#51) 62 | - Cleanup with pbs and kno (#53) 63 | - MRG: Doc (#56) 64 | - MRG: Docfix (#57) 65 | - MRG: try to check if missing nose dependency is handled (#58) 66 | - MRG: coverage (#59) 67 | - MRG: Trying irr with naomi data (#55) 68 | - ENH: closes #54 (#60) 69 | - MRG: Internal consistency (#62) 70 | - MRG: More core consistency (#63) 71 | - MRG: Sundry cleanups (#61) 72 | - Nsgk data looping (#65) 73 | - irr-bug-fix (#66) 74 | - RFT: remove old code (#67) 75 | - MRG: Make first release (#68) 76 | - Eda2qa (#70) 77 | - MRG: restructuring (#71) 78 | - MRG: Add permutation of binary incidence matrix with fixed row and column sums (#72) 79 | - DAT: add MacNell 2014 data (#73) 80 | - MRG: Paired/one-sample test (#77) 81 | - MRG: Two sample bugfix (#79) 82 | - MRG: moved binom & hypergeo CIs to utils; improved hypergeo CIs (#80) 83 | - MRG: Hyper tests (#84) 84 | - WIP: add option for generic function input for two_sample and one_sample (#85) 85 | - DOC: improved documentation for two_sample (#86) 86 | - Fixes to the documentation infra-structure (#87) 87 | - MRG: Two-sample confidence interval for shift model (#88) 88 | - ENH: update to do list (#89) 89 | 90 | Made by the following committers [alphabetical by last name]: 91 | 92 | - Matthew Brett 93 | - Jarrod Millman 94 | - Kellie Ottoboni 95 | - Philip B. Stark 96 | - Stefan van der Walt 97 | - kellieotto 98 | -------------------------------------------------------------------------------- /doc/release/release_0.1.a3.txt: -------------------------------------------------------------------------------- 1 | Announcement: permute 0.1.alpha3 2 | ================================ 3 | 4 | We're happy to announce the release of permute v0.1.alpha3! 5 | 6 | permute is permutation testing and confidence set toolbox for Python. 7 | 8 | For more information, examples, and documentation, please visit our website: 9 | 10 | http://statlab.github.io/permute/ 11 | 12 | 13 | New Features 14 | ------------ 15 | 16 | This is the first release so everything is new. As we get closer to 17 | the actual v0.1.0 release we will expand this section. 18 | 19 | Release v0.1.a2 was on tag v0.1.a2 20 | 21 | A total of 67 changes have been committed. 22 | 23 | It contained the following 73 merges: 24 | 25 | - * first-test: 26 | - * data: 27 | - * data: 28 | - * irr: 29 | - * 'master' of github.com:pbstark/permute: 30 | - Fixes - IRR permutation (#8) 31 | - * 'master' of github.com:pbstark/permute: 32 | - * doc: 33 | - Change to shuffling within rows (#11) 34 | - Irr test (#10) 35 | - close #7 (#17) 36 | - RF: try using module-level random state (#18) 37 | - ENH: enable travis-ci (#19) 38 | - * master: 39 | - * npc: 40 | - ENH: remove dependency on pandas (closes #16) (#20) 41 | - BF: set seed (#23) 42 | - Refactor philips example code closes #24 (#25) 43 | - Docstrings (#26) 44 | - Dev notes (#31) 45 | - Go over stratif (#32) 46 | - MRG: Minor cleanup (#35) 47 | - MRG: Workon core (#36) 48 | - MRG: Test core (#38) 49 | - DATA: added NSGK data (#40) 50 | - Improve tests (#41) 51 | - Debug two sample (#43) 52 | - ENH: correlation tests from work on SET with Anne Boring (#42) 53 | - MRG: Cleanup from friday (#44) 54 | - MRG: class demo (#45) 55 | - BF: test for zero variances to avoid divide by zero (#47) 56 | - Eda and cleanup (#49) 57 | - ENH: find duplicate consecutive rows (#50) 58 | - MRG: Clean naomi data (#48) 59 | - MRG: Improve website (#51) 60 | - Cleanup with pbs and kno (#53) 61 | - MRG: Doc (#56) 62 | - MRG: Docfix (#57) 63 | - MRG: try to check if missing nose dependency is handled (#58) 64 | - MRG: coverage (#59) 65 | - MRG: Trying irr with naomi data (#55) 66 | - ENH: closes #54 (#60) 67 | - MRG: Internal consistency (#62) 68 | - MRG: More core consistency (#63) 69 | - MRG: Sundry cleanups (#61) 70 | - Nsgk data looping (#65) 71 | - irr-bug-fix (#66) 72 | - RFT: remove old code (#67) 73 | - MRG: Make first release (#68) 74 | - Eda2qa (#70) 75 | - MRG: restructuring (#71) 76 | - MRG: Add permutation of binary incidence matrix with fixed row and column sums (#72) 77 | - DAT: add MacNell 2014 data (#73) 78 | - MRG: Paired/one-sample test (#77) 79 | - MRG: Two sample bugfix (#79) 80 | - MRG: moved binom & hypergeo CIs to utils; improved hypergeo CIs (#80) 81 | - MRG: Hyper tests (#84) 82 | - WIP: add option for generic function input for two_sample and one_sample (#85) 83 | - DOC: improved documentation for two_sample (#86) 84 | - Fixes to the documentation infra-structure (#87) 85 | - MRG: Two-sample confidence interval for shift model (#88) 86 | - ENH: update to do list (#89) 87 | - MRG: Clean stratif doc (#91) 88 | - MRG: clean up from last release (#92) 89 | - WIP: Regression (#93) 90 | - MRG: update pip requirements (#94) 91 | - MRG: Two-sided p-values (#98) 92 | - Broaden overview (#97) 93 | - MRG: add derivation for regression slope test (#95) 94 | - MRG: NPC (#99) 95 | - MRG: Docs (#100) 96 | - MRG: cleanup (#101) 97 | - DOC: update contributors (#102) 98 | 99 | Made by the following committers [alphabetical by last name]: 100 | 101 | - Matthew Brett 102 | - Jarrod Millman 103 | - Kellie Ottoboni 104 | - Philip B. Stark 105 | - Stefan van der Walt 106 | - kellieotto 107 | -------------------------------------------------------------------------------- /doc/release/release_0.1.a4.txt: -------------------------------------------------------------------------------- 1 | Announcement: permute 0.1.alpha4 2 | ================================ 3 | 4 | We're happy to announce the release of permute v0.1.alpha4! 5 | 6 | permute is permutation testing and confidence set toolbox for Python. 7 | 8 | For more information, examples, and documentation, please visit our website: 9 | 10 | http://statlab.github.io/permute/ 11 | 12 | 13 | New Features 14 | ------------ 15 | 16 | This is the first release so everything is new. As we get closer to 17 | the actual v0.1.0 release we will expand this section. 18 | 19 | 20 | 21 | Contributors to this release 22 | ---------------------------- 23 | (Listed alphabetically by last name) 24 | 25 | - Matthew Brett 26 | - Jarrod Millman 27 | - Kellie Ottoboni 28 | - Philip B. Stark 29 | -------------------------------------------------------------------------------- /doc/release/release_0.1.a5.txt: -------------------------------------------------------------------------------- 1 | Announcement: permute 0.1.a5 2 | =========================== 3 | 4 | We're happy to announce the release of permute v0.1.a5! 5 | 6 | permute is permutation testing and confidence set toolbox for Python. 7 | 8 | For more information, examples, and documentation, please visit our website: 9 | 10 | http://statlab.github.io/permute/ 11 | 12 | 13 | New Features 14 | ------------ 15 | 16 | k-sample tests and the minP familywise error rate correction 17 | 18 | 19 | Improvements 20 | ------------ 21 | 22 | Every permutation test has a `plus1` option to add 1 to the numerator and denominator of the p-value. 23 | 24 | The default PRNG is the SHA256-based CS-PRNG from `cryptorandom`, which should produce higher quality pseudo-random numbers. 25 | 26 | 27 | API Changes 28 | ----------- 29 | `hypergeom` and `binomial_p` no longer use permutations to calculate p-values. 30 | 31 | The `seed` argument to functions is now used to seed a SHA256 PRNG instance, rather than np.random. 32 | 33 | Deprecations 34 | ------------ 35 | 36 | 37 | Contributors to this release 38 | ---------------------------- 39 | Kellie Ottoboni 40 | -------------------------------------------------------------------------------- /doc/release/release_0.2.txt: -------------------------------------------------------------------------------- 1 | Announcement: permute 0.2.0 2 | =========================== 3 | 4 | We're happy to announce the release of permute v0.2.0! 5 | 6 | permute is permutation testing and confidence set toolbox for Python. 7 | 8 | For more information, examples, and documentation, please visit our website: 9 | 10 | http://statlab.github.io/permute/ 11 | 12 | Improvements 13 | ------------ 14 | 15 | - removed old Python 2 shims 16 | - switched from nose to pytest 17 | 18 | Contributors to this release 19 | ---------------------------- 20 | 21 | - Amanda Glazer 22 | - Jarrod Millman 23 | - Kellie Ottoboni 24 | - Philip Stark 25 | -------------------------------------------------------------------------------- /doc/release/release_dev.txt: -------------------------------------------------------------------------------- 1 | Announcement: permute 0.4.0 2 | =========================== 3 | 4 | We're happy to announce the release of permute v0.4.0! 5 | 6 | permute is permutation testing and confidence set toolbox for Python. 7 | 8 | For more information, examples, and documentation, please visit our website: 9 | 10 | http://statlab.github.io/permute/ 11 | 12 | 13 | New Features 14 | ------------ 15 | 16 | 17 | 18 | 19 | Improvements 20 | ------------ 21 | 22 | 23 | 24 | 25 | API Changes 26 | ----------- 27 | 28 | 29 | 30 | 31 | Deprecations 32 | ------------ 33 | 34 | 35 | Contributors to this release 36 | ---------------------------- 37 | (Listed alphabetically by last name) 38 | 39 | -------------------------------------------------------------------------------- /doc/release/release_template.txt: -------------------------------------------------------------------------------- 1 | Announcement: permute 0.X.0 2 | =========================== 3 | 4 | We're happy to announce the release of permute v0.X.0! 5 | 6 | permute is permutation testing and confidence set toolbox for Python. 7 | 8 | For more information, examples, and documentation, please visit our website: 9 | 10 | http://statlab.github.io/permute/ 11 | 12 | 13 | New Features 14 | ------------ 15 | 16 | 17 | 18 | 19 | Improvements 20 | ------------ 21 | 22 | 23 | 24 | 25 | API Changes 26 | ----------- 27 | 28 | 29 | 30 | 31 | Deprecations 32 | ------------ 33 | 34 | 35 | Contributors to this release 36 | ---------------------------- 37 | (Listed alphabetically by last name) 38 | 39 | -------------------------------------------------------------------------------- /doc/source/_static/copybutton.js: -------------------------------------------------------------------------------- 1 | /* This script from Doc/tools/static/copybutton.js in CPython distribution */ 2 | $(document).ready(function() { 3 | /* Add a [>>>] button on the top-right corner of code samples to hide 4 | * the >>> and ... prompts and the output and thus make the code 5 | * copyable. */ 6 | var div = $('.highlight-default .highlight,' + 7 | '.highlight-python .highlight,' + 8 | '.highlight-python3 .highlight') 9 | var pre = div.find('pre'); 10 | 11 | // get the styles from the current theme 12 | pre.parent().parent().css('position', 'relative'); 13 | var hide_text = 'Hide the prompts and output'; 14 | var show_text = 'Show the prompts and output'; 15 | var border_width = pre.css('border-top-width'); 16 | var border_style = pre.css('border-top-style'); 17 | var border_color = pre.css('border-top-color'); 18 | var button_styles = { 19 | 'cursor':'pointer', 'position': 'absolute', 'top': '0', 'right': '0', 20 | 'border-color': border_color, 'border-style': border_style, 21 | 'border-width': border_width, 'color': border_color, 'text-size': '75%', 22 | 'font-family': 'monospace', 'padding-left': '0.2em', 'padding-right': '0.2em', 23 | 'border-radius': '0 3px 0 0' 24 | } 25 | 26 | // create and add the button to all the code blocks that contain >>> 27 | div.each(function(index) { 28 | var jthis = $(this); 29 | if (jthis.find('.gp').length > 0) { 30 | var button = $('>>>'); 31 | button.css(button_styles) 32 | button.attr('title', hide_text); 33 | button.data('hidden', 'false'); 34 | jthis.prepend(button); 35 | } 36 | // tracebacks (.gt) contain bare text elements that need to be 37 | // wrapped in a span to work with .nextUntil() (see later) 38 | jthis.find('pre:has(.gt)').contents().filter(function() { 39 | return ((this.nodeType == 3) && (this.data.trim().length > 0)); 40 | }).wrap(''); 41 | }); 42 | 43 | // define the behavior of the button when it's clicked 44 | $('.copybutton').click(function(e){ 45 | e.preventDefault(); 46 | var button = $(this); 47 | if (button.data('hidden') === 'false') { 48 | // hide the code output 49 | button.parent().find('.go, .gp, .gt').hide(); 50 | button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden'); 51 | button.css('text-decoration', 'line-through'); 52 | button.attr('title', show_text); 53 | button.data('hidden', 'true'); 54 | } else { 55 | // show the code output 56 | button.parent().find('.go, .gp, .gt').show(); 57 | button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible'); 58 | button.css('text-decoration', 'none'); 59 | button.attr('title', hide_text); 60 | button.data('hidden', 'false'); 61 | } 62 | }); 63 | }); 64 | 65 | -------------------------------------------------------------------------------- /doc/source/api/core.rst: -------------------------------------------------------------------------------- 1 | Core functions 2 | -------------- 3 | 4 | .. automodule:: permute.core 5 | :members: 6 | 7 | 8 | -------------------------------------------------------------------------------- /doc/source/api/data.rst: -------------------------------------------------------------------------------- 1 | Data sets 2 | --------- 3 | 4 | .. automodule:: permute.data 5 | :members: 6 | 7 | 8 | -------------------------------------------------------------------------------- /doc/source/api/index.rst: -------------------------------------------------------------------------------- 1 | API Reference 2 | ============= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | data.rst 8 | utils.rst 9 | qa.rst 10 | core.rst 11 | stratified.rst 12 | npc.rst 13 | irr.rst 14 | 15 | .. automodule:: permute 16 | -------------------------------------------------------------------------------- /doc/source/api/irr.rst: -------------------------------------------------------------------------------- 1 | Interrater reliability 2 | ---------------------- 3 | 4 | .. automodule:: permute.irr 5 | :members: 6 | 7 | -------------------------------------------------------------------------------- /doc/source/api/npc.rst: -------------------------------------------------------------------------------- 1 | Nonparametric combination of tests 2 | ---------------------------------- 3 | 4 | .. automodule:: permute.npc 5 | :members: 6 | -------------------------------------------------------------------------------- /doc/source/api/qa.rst: -------------------------------------------------------------------------------- 1 | Quality assurance 2 | ----------------- 3 | 4 | .. automodule:: permute.qa 5 | :members: 6 | 7 | 8 | -------------------------------------------------------------------------------- /doc/source/api/stratified.rst: -------------------------------------------------------------------------------- 1 | Stratified testing 2 | ------------------ 3 | 4 | .. automodule:: permute.stratified 5 | :members: 6 | 7 | -------------------------------------------------------------------------------- /doc/source/api/utils.rst: -------------------------------------------------------------------------------- 1 | Utility functions 2 | ----------------- 3 | 4 | .. automodule:: permute.utils 5 | :members: 6 | -------------------------------------------------------------------------------- /doc/source/dev/contribute.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../../CONTRIBUTE.rst 2 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/branch_dropdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/statlab/permute/ef72da3394ca82c04a035c5fcdefe524eea62c45/doc/source/dev/gitwash/branch_dropdown.png -------------------------------------------------------------------------------- /doc/source/dev/gitwash/configure_git.rst: -------------------------------------------------------------------------------- 1 | .. _configure-git: 2 | 3 | =============== 4 | Configure git 5 | =============== 6 | 7 | .. _git-config-basic: 8 | 9 | Overview 10 | ======== 11 | 12 | Your personal git configurations are saved in the ``.gitconfig`` file in 13 | your home directory. 14 | 15 | Here is an example ``.gitconfig`` file:: 16 | 17 | [user] 18 | name = Your Name 19 | email = you@yourdomain.example.com 20 | 21 | [alias] 22 | ci = commit -a 23 | co = checkout 24 | st = status 25 | stat = status 26 | br = branch 27 | wdiff = diff --color-words 28 | 29 | [core] 30 | editor = vim 31 | 32 | [merge] 33 | summary = true 34 | 35 | You can edit this file directly or you can use the ``git config --global`` 36 | command:: 37 | 38 | git config --global user.name "Your Name" 39 | git config --global user.email you@yourdomain.example.com 40 | git config --global alias.ci "commit -a" 41 | git config --global alias.co checkout 42 | git config --global alias.st "status -a" 43 | git config --global alias.stat "status -a" 44 | git config --global alias.br branch 45 | git config --global alias.wdiff "diff --color-words" 46 | git config --global core.editor vim 47 | git config --global merge.summary true 48 | 49 | To set up on another computer, you can copy your ``~/.gitconfig`` file, 50 | or run the commands above. 51 | 52 | In detail 53 | ========= 54 | 55 | user.name and user.email 56 | ------------------------ 57 | 58 | It is good practice to tell git_ who you are, for labeling any changes 59 | you make to the code. The simplest way to do this is from the command 60 | line:: 61 | 62 | git config --global user.name "Your Name" 63 | git config --global user.email you@yourdomain.example.com 64 | 65 | This will write the settings into your git configuration file, which 66 | should now contain a user section with your name and email:: 67 | 68 | [user] 69 | name = Your Name 70 | email = you@yourdomain.example.com 71 | 72 | Of course you'll need to replace ``Your Name`` and ``you@yourdomain.example.com`` 73 | with your actual name and email address. 74 | 75 | Aliases 76 | ------- 77 | 78 | You might well benefit from some aliases to common commands. 79 | 80 | For example, you might well want to be able to shorten ``git checkout`` 81 | to ``git co``. Or you may want to alias ``git diff --color-words`` 82 | (which gives a nicely formatted output of the diff) to ``git wdiff`` 83 | 84 | The following ``git config --global`` commands:: 85 | 86 | git config --global alias.ci "commit -a" 87 | git config --global alias.co checkout 88 | git config --global alias.st "status -a" 89 | git config --global alias.stat "status -a" 90 | git config --global alias.br branch 91 | git config --global alias.wdiff "diff --color-words" 92 | 93 | will create an ``alias`` section in your ``.gitconfig`` file with contents 94 | like this:: 95 | 96 | [alias] 97 | ci = commit -a 98 | co = checkout 99 | st = status -a 100 | stat = status -a 101 | br = branch 102 | wdiff = diff --color-words 103 | 104 | Editor 105 | ------ 106 | 107 | You may also want to make sure that your editor of choice is used :: 108 | 109 | git config --global core.editor vim 110 | 111 | Merging 112 | ------- 113 | 114 | To enforce summaries when doing merges (``~/.gitconfig`` file again):: 115 | 116 | [merge] 117 | log = true 118 | 119 | Or from the command line:: 120 | 121 | git config --global merge.log true 122 | 123 | .. _fancy-log: 124 | 125 | Fancy log output 126 | ---------------- 127 | 128 | This is a very nice alias to get a fancy log output; it should go in the 129 | ``alias`` section of your ``.gitconfig`` file:: 130 | 131 | lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)[%an]%Creset' --abbrev-commit --date=relative 132 | 133 | You use the alias with:: 134 | 135 | git lg 136 | 137 | and it gives graph / text output something like this (but with color!):: 138 | 139 | * 6d8e1ee - (HEAD, origin/my-fancy-feature, my-fancy-feature) NF - a fancy file (45 minutes ago) [Matthew Brett] 140 | * d304a73 - (origin/placeholder, placeholder) Merge pull request #48 from hhuuggoo/master (2 weeks ago) [Jonathan Terhorst] 141 | |\ 142 | | * 4aff2a8 - fixed bug 35, and added a test in test_bugfixes (2 weeks ago) [Hugo] 143 | |/ 144 | * a7ff2e5 - Added notes on discussion/proposal made during Data Array Summit. (2 weeks ago) [Corran Webster] 145 | * 68f6752 - Initial implimentation of AxisIndexer - uses 'index_by' which needs to be changed to a call on an Axes object - this is all very sketchy right now. (2 weeks ago) [Corr 146 | * 376adbd - Merge pull request #46 from terhorst/master (2 weeks ago) [Jonathan Terhorst] 147 | |\ 148 | | * b605216 - updated joshu example to current api (3 weeks ago) [Jonathan Terhorst] 149 | | * 2e991e8 - add testing for outer ufunc (3 weeks ago) [Jonathan Terhorst] 150 | | * 7beda5a - prevent axis from throwing an exception if testing equality with non-axis object (3 weeks ago) [Jonathan Terhorst] 151 | | * 65af65e - convert unit testing code to assertions (3 weeks ago) [Jonathan Terhorst] 152 | | * 956fbab - Merge remote-tracking branch 'upstream/master' (3 weeks ago) [Jonathan Terhorst] 153 | | |\ 154 | | |/ 155 | 156 | Thanks to Yury V. Zaytsev for posting it. 157 | 158 | .. include:: links.inc 159 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/following_latest.rst: -------------------------------------------------------------------------------- 1 | .. _following-latest: 2 | 3 | ============================= 4 | Following the latest source 5 | ============================= 6 | 7 | These are the instructions if you just want to follow the latest 8 | *permute* source, but you don't need to do any development for now. 9 | 10 | The steps are: 11 | 12 | * :ref:`install-git` 13 | * get local copy of the `permute github`_ git repository 14 | * update local copy from time to time 15 | 16 | Get the local copy of the code 17 | ============================== 18 | 19 | From the command line:: 20 | 21 | git clone git://github.com/statlab/permute.git 22 | 23 | You now have a copy of the code tree in the new ``permute`` directory. 24 | 25 | Updating the code 26 | ================= 27 | 28 | From time to time you may want to pull down the latest code. Do this with:: 29 | 30 | cd permute 31 | git pull 32 | 33 | The tree in ``permute`` will now have the latest changes from the initial 34 | repository. 35 | 36 | .. include:: links.inc 37 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/forking_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/statlab/permute/ef72da3394ca82c04a035c5fcdefe524eea62c45/doc/source/dev/gitwash/forking_button.png -------------------------------------------------------------------------------- /doc/source/dev/gitwash/forking_hell.rst: -------------------------------------------------------------------------------- 1 | .. _forking: 2 | 3 | ====================================================== 4 | Making your own copy (fork) of permute 5 | ====================================================== 6 | 7 | You need to do this only once. The instructions here are very similar 8 | to the instructions at http://help.github.com/forking/ |emdash| please see 9 | that page for more detail. We're repeating some of it here just to give the 10 | specifics for the `permute`_ project, and to suggest some default names. 11 | 12 | Set up and configure a github account 13 | ===================================== 14 | 15 | If you don't have a github account, go to the github page, and make one. 16 | 17 | You then need to configure your account to allow write access |emdash| see 18 | the ``Generating SSH keys`` help on `github help`_. 19 | 20 | Create your own forked copy of `permute`_ 21 | ====================================================== 22 | 23 | #. Log into your github account. 24 | #. Go to the `permute`_ github home at `permute github`_. 25 | #. Click on the *fork* button: 26 | 27 | .. image:: forking_button.png 28 | 29 | Now, after a short pause and some 'Hardcore forking action', you 30 | should find yourself at the home page for your own forked copy of `permute`_. 31 | 32 | .. include:: links.inc 33 | 34 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/git_development.rst: -------------------------------------------------------------------------------- 1 | .. _git-development: 2 | 3 | ===================== 4 | Git for development 5 | ===================== 6 | 7 | Contents: 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | forking_hell 13 | set_up_fork 14 | configure_git 15 | development_workflow 16 | maintainer_workflow 17 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/git_install.rst: -------------------------------------------------------------------------------- 1 | .. _install-git: 2 | 3 | ============= 4 | Install git 5 | ============= 6 | 7 | Overview 8 | ======== 9 | 10 | ================ ============= 11 | Debian / Ubuntu ``sudo apt-get install git`` 12 | Fedora ``sudo yum install git`` 13 | Windows Download and install msysGit_ 14 | OS X Use the git-osx-installer_ 15 | ================ ============= 16 | 17 | In detail 18 | ========= 19 | 20 | See the git page for the most recent information. 21 | 22 | Have a look at the github install help pages available from `github help`_ 23 | 24 | There are good instructions here: http://book.git-scm.com/2_installing_git.html 25 | 26 | .. include:: links.inc 27 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/git_intro.rst: -------------------------------------------------------------------------------- 1 | ============== 2 | Introduction 3 | ============== 4 | 5 | These pages describe a git_ and github_ workflow for the `permute`_ 6 | project. 7 | 8 | There are several different workflows here, for different ways of 9 | working with *permute*. 10 | 11 | This is not a comprehensive git reference, it's just a workflow for our 12 | own project. It's tailored to the github hosting service. You may well 13 | find better or quicker ways of getting stuff done with git, but these 14 | should get you started. 15 | 16 | For general resources for learning git, see :ref:`git-resources`. 17 | 18 | .. include:: links.inc 19 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/git_links.inc: -------------------------------------------------------------------------------- 1 | .. This (-*- rst -*-) format file contains commonly used link targets 2 | and name substitutions. It may be included in many files, 3 | therefore it should only contain link targets and name 4 | substitutions. Try grepping for "^\.\. _" to find plausible 5 | candidates for this list. 6 | 7 | .. NOTE: reST targets are 8 | __not_case_sensitive__, so only one target definition is needed for 9 | nipy, NIPY, Nipy, etc... 10 | 11 | .. git stuff 12 | .. _git: http://git-scm.com/ 13 | .. _github: http://github.com 14 | .. _github help: http://help.github.com 15 | .. _msysgit: http://code.google.com/p/msysgit/downloads/list 16 | .. _git-osx-installer: http://code.google.com/p/git-osx-installer/downloads/list 17 | .. _subversion: http://subversion.tigris.org/ 18 | .. _git cheat sheet: http://github.com/guides/git-cheat-sheet 19 | .. _pro git book: http://progit.org/ 20 | .. _git svn crash course: http://git-scm.com/course/svn.html 21 | .. _learn.github: http://learn.github.com/ 22 | .. _network graph visualizer: http://github.com/blog/39-say-hello-to-the-network-graph-visualizer 23 | .. _git user manual: http://schacon.github.com/git/user-manual.html 24 | .. _git tutorial: http://schacon.github.com/git/gittutorial.html 25 | .. _git community book: http://book.git-scm.com/ 26 | .. _git ready: http://www.gitready.com/ 27 | .. _git casts: http://www.gitcasts.com/ 28 | .. _Fernando's git page: http://www.fperez.org/py4science/git.html 29 | .. _git magic: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html 30 | .. _git concepts: http://www.eecs.harvard.edu/~cduan/technical/git/ 31 | .. _git clone: http://schacon.github.com/git/git-clone.html 32 | .. _git checkout: http://schacon.github.com/git/git-checkout.html 33 | .. _git commit: http://schacon.github.com/git/git-commit.html 34 | .. _git push: http://schacon.github.com/git/git-push.html 35 | .. _git pull: http://schacon.github.com/git/git-pull.html 36 | .. _git add: http://schacon.github.com/git/git-add.html 37 | .. _git status: http://schacon.github.com/git/git-status.html 38 | .. _git diff: http://schacon.github.com/git/git-diff.html 39 | .. _git log: http://schacon.github.com/git/git-log.html 40 | .. _git branch: http://schacon.github.com/git/git-branch.html 41 | .. _git remote: http://schacon.github.com/git/git-remote.html 42 | .. _git rebase: http://schacon.github.com/git/git-rebase.html 43 | .. _git config: http://schacon.github.com/git/git-config.html 44 | .. _why the -a flag?: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html 45 | .. _git staging area: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html 46 | .. _tangled working copy problem: http://tomayko.com/writings/the-thing-about-git 47 | .. _git management: http://kerneltrap.org/Linux/Git_Management 48 | .. _linux git workflow: http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html 49 | .. _git parable: http://tom.preston-werner.com/2009/05/19/the-git-parable.html 50 | .. _git foundation: http://matthew-brett.github.com/pydagogue/foundation.html 51 | .. _deleting master on github: http://matthew-brett.github.com/pydagogue/gh_delete_master.html 52 | .. _rebase without tears: http://matthew-brett.github.com/pydagogue/rebase_without_tears.html 53 | .. _resolving a merge: http://schacon.github.com/git/user-manual.html#resolving-a-merge 54 | .. _ipython git workflow: http://mail.scipy.org/pipermail/ipython-dev/2010-October/006746.html 55 | 56 | .. other stuff 57 | .. _python: http://www.python.org 58 | 59 | .. |emdash| unicode:: U+02014 60 | 61 | .. vim: ft=rst 62 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/git_resources.rst: -------------------------------------------------------------------------------- 1 | .. _git-resources: 2 | 3 | ============= 4 | git resources 5 | ============= 6 | 7 | Tutorials and summaries 8 | ======================= 9 | 10 | * `github help`_ has an excellent series of how-to guides. 11 | * `learn.github`_ has an excellent series of tutorials 12 | * The `pro git book`_ is a good in-depth book on git. 13 | * A `git cheat sheet`_ is a page giving summaries of common commands. 14 | * The `git user manual`_ 15 | * The `git tutorial`_ 16 | * The `git community book`_ 17 | * `git ready`_ |emdash| a nice series of tutorials 18 | * `git casts`_ |emdash| video snippets giving git how-tos. 19 | * `git magic`_ |emdash| extended introduction with intermediate detail 20 | * The `git parable`_ is an easy read explaining the concepts behind git. 21 | * `git foundation`_ expands on the `git parable`_. 22 | * Fernando Perez' git page |emdash| `Fernando's git page`_ |emdash| many 23 | links and tips 24 | * A good but technical page on `git concepts`_ 25 | * `git svn crash course`_: git for those of us used to subversion_ 26 | 27 | Advanced git workflow 28 | ===================== 29 | 30 | There are many ways of working with git; here are some posts on the 31 | rules of thumb that other projects have come up with: 32 | 33 | * Linus Torvalds on `git management`_ 34 | * Linus Torvalds on `linux git workflow`_ . Summary; use the git tools 35 | to make the history of your edits as clean as possible; merge from 36 | upstream edits as little as possible in branches where you are doing 37 | active development. 38 | 39 | Manual pages online 40 | =================== 41 | 42 | You can get these on your own machine with (e.g) ``git help push`` or 43 | (same thing) ``git push --help``, but, for convenience, here are the 44 | online manual pages for some common commands: 45 | 46 | * `git add`_ 47 | * `git branch`_ 48 | * `git checkout`_ 49 | * `git clone`_ 50 | * `git commit`_ 51 | * `git config`_ 52 | * `git diff`_ 53 | * `git log`_ 54 | * `git pull`_ 55 | * `git push`_ 56 | * `git remote`_ 57 | * `git status`_ 58 | 59 | .. include:: links.inc 60 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/index.rst: -------------------------------------------------------------------------------- 1 | .. _using-git: 2 | 3 | Working with *permute* source code 4 | ================================================ 5 | 6 | Contents: 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | git_intro 12 | git_install 13 | following_latest 14 | patching 15 | git_development 16 | git_resources 17 | 18 | 19 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/known_projects.inc: -------------------------------------------------------------------------------- 1 | .. Known projects 2 | 3 | .. PROJECTNAME placeholders 4 | .. _PROJECTNAME: http://neuroimaging.scipy.org 5 | .. _`PROJECTNAME github`: http://github.com/nipy 6 | .. _`PROJECTNAME mailing list`: http://projects.scipy.org/mailman/listinfo/nipy-devel 7 | 8 | .. numpy 9 | .. _numpy: hhttp://numpy.scipy.org 10 | .. _`numpy github`: http://github.com/numpy/numpy 11 | .. _`numpy mailing list`: http://mail.scipy.org/mailman/listinfo/numpy-discussion 12 | 13 | .. scipy 14 | .. _scipy: http://www.scipy.org 15 | .. _`scipy github`: http://github.com/scipy/scipy 16 | .. _`scipy mailing list`: http://mail.scipy.org/mailman/listinfo/scipy-dev 17 | 18 | .. nipy 19 | .. _nipy: http://nipy.org/nipy 20 | .. _`nipy github`: http://github.com/nipy/nipy 21 | .. _`nipy mailing list`: http://mail.scipy.org/mailman/listinfo/nipy-devel 22 | 23 | .. ipython 24 | .. _ipython: http://ipython.scipy.org 25 | .. _`ipython github`: http://github.com/ipython/ipython 26 | .. _`ipython mailing list`: http://mail.scipy.org/mailman/listinfo/IPython-dev 27 | 28 | .. dipy 29 | .. _dipy: http://nipy.org/dipy 30 | .. _`dipy github`: http://github.com/Garyfallidis/dipy 31 | .. _`dipy mailing list`: http://mail.scipy.org/mailman/listinfo/nipy-devel 32 | 33 | .. nibabel 34 | .. _nibabel: http://nipy.org/nibabel 35 | .. _`nibabel github`: http://github.com/nipy/nibabel 36 | .. _`nibabel mailing list`: http://mail.scipy.org/mailman/listinfo/nipy-devel 37 | 38 | .. marsbar 39 | .. _marsbar: http://marsbar.sourceforge.net 40 | .. _`marsbar github`: http://github.com/matthew-brett/marsbar 41 | .. _`MarsBaR mailing list`: https://lists.sourceforge.net/lists/listinfo/marsbar-users 42 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/links.inc: -------------------------------------------------------------------------------- 1 | .. compiling links file 2 | .. include:: known_projects.inc 3 | .. include:: this_project.inc 4 | .. include:: git_links.inc 5 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/maintainer_workflow.rst: -------------------------------------------------------------------------------- 1 | .. _maintainer-workflow: 2 | 3 | ################### 4 | Maintainer workflow 5 | ################### 6 | 7 | This page is for maintainers |emdash| those of us who merge our own or other 8 | peoples' changes into the upstream repository. 9 | 10 | Being as how you're a maintainer, you are completely on top of the basic stuff 11 | in :ref:`development-workflow`. 12 | 13 | The instructions in :ref:`linking-to-upstream` add a remote that has read-only 14 | access to the upstream repo. Being a maintainer, you've got read-write access. 15 | 16 | It's good to have your upstream remote have a scary name, to remind you that 17 | it's a read-write remote:: 18 | 19 | git remote add upstream-rw git@github.com:statlab/permute.git 20 | git fetch upstream-rw 21 | 22 | ******************* 23 | Integrating changes 24 | ******************* 25 | 26 | Let's say you have some changes that need to go into trunk 27 | (``upstream-rw/master``). 28 | 29 | The changes are in some branch that you are currently on. For example, you are 30 | looking at someone's changes like this:: 31 | 32 | git remote add someone git://github.com/someone/permute.git 33 | git fetch someone 34 | git branch cool-feature --track someone/cool-feature 35 | git checkout cool-feature 36 | 37 | So now you are on the branch with the changes to be incorporated upstream. The 38 | rest of this section assumes you are on this branch. 39 | 40 | A few commits 41 | ============= 42 | 43 | If there are only a few commits, consider rebasing to upstream:: 44 | 45 | # Fetch upstream changes 46 | git fetch upstream-rw 47 | # rebase 48 | git rebase upstream-rw/master 49 | 50 | Remember that, if you do a rebase, and push that, you'll have to close any 51 | github pull requests manually, because github will not be able to detect the 52 | changes have already been merged. 53 | 54 | A long series of commits 55 | ======================== 56 | 57 | If there are a longer series of related commits, consider a merge instead:: 58 | 59 | git fetch upstream-rw 60 | git merge --no-ff upstream-rw/master 61 | 62 | The merge will be detected by github, and should close any related pull requests 63 | automatically. 64 | 65 | Note the ``--no-ff`` above. This forces git to make a merge commit, rather than 66 | doing a fast-forward, so that these set of commits branch off trunk then rejoin 67 | the main history with a merge, rather than appearing to have been made directly 68 | on top of trunk. 69 | 70 | Check the history 71 | ================= 72 | 73 | Now, in either case, you should check that the history is sensible and you have 74 | the right commits:: 75 | 76 | git log --oneline --graph 77 | git log -p upstream-rw/master.. 78 | 79 | The first line above just shows the history in a compact way, with a text 80 | representation of the history graph. The second line shows the log of commits 81 | excluding those that can be reached from trunk (``upstream-rw/master``), and 82 | including those that can be reached from current HEAD (implied with the ``..`` 83 | at the end). So, it shows the commits unique to this branch compared to trunk. 84 | The ``-p`` option shows the diff for these commits in patch form. 85 | 86 | Push to trunk 87 | ============= 88 | 89 | :: 90 | 91 | git push upstream-rw my-new-feature:master 92 | 93 | This pushes the ``my-new-feature`` branch in this repository to the ``master`` 94 | branch in the ``upstream-rw`` repository. 95 | 96 | .. include:: links.inc 97 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/patching.rst: -------------------------------------------------------------------------------- 1 | ================ 2 | Making a patch 3 | ================ 4 | 5 | You've discovered a bug or something else you want to change 6 | in `permute`_ .. |emdash| excellent! 7 | 8 | You've worked out a way to fix it |emdash| even better! 9 | 10 | You want to tell us about it |emdash| best of all! 11 | 12 | The easiest way is to make a *patch* or set of patches. Here 13 | we explain how. Making a patch is the simplest and quickest, 14 | but if you're going to be doing anything more than simple 15 | quick things, please consider following the 16 | :ref:`git-development` model instead. 17 | 18 | .. _making-patches: 19 | 20 | Making patches 21 | ============== 22 | 23 | Overview 24 | -------- 25 | 26 | :: 27 | 28 | # tell git who you are 29 | git config --global user.email you@yourdomain.example.com 30 | git config --global user.name "Your Name Comes Here" 31 | # get the repository if you don't have it 32 | git clone git://github.com/statlab/permute.git 33 | # make a branch for your patching 34 | cd permute 35 | git branch the-fix-im-thinking-of 36 | git checkout the-fix-im-thinking-of 37 | # hack, hack, hack 38 | # Tell git about any new files you've made 39 | git add somewhere/tests/test_my_bug.py 40 | # commit work in progress as you go 41 | git commit -am 'BF - added tests for Funny bug' 42 | # hack hack, hack 43 | git commit -am 'BF - added fix for Funny bug' 44 | # make the patch files 45 | git format-patch -M -C master 46 | 47 | Then, send the generated patch files to the `permute 48 | mailing list`_ |emdash| where we will thank you warmly. 49 | 50 | In detail 51 | --------- 52 | 53 | #. Tell git who you are so it can label the commits you've 54 | made:: 55 | 56 | git config --global user.email you@yourdomain.example.com 57 | git config --global user.name "Your Name Comes Here" 58 | 59 | #. If you don't already have one, clone a copy of the 60 | `permute`_ repository:: 61 | 62 | git clone git://github.com/statlab/permute.git 63 | cd permute 64 | 65 | #. Make a 'feature branch'. This will be where you work on 66 | your bug fix. It's nice and safe and leaves you with 67 | access to an unmodified copy of the code in the main 68 | branch:: 69 | 70 | git branch the-fix-im-thinking-of 71 | git checkout the-fix-im-thinking-of 72 | 73 | #. Do some edits, and commit them as you go:: 74 | 75 | # hack, hack, hack 76 | # Tell git about any new files you've made 77 | git add somewhere/tests/test_my_bug.py 78 | # commit work in progress as you go 79 | git commit -am 'BF - added tests for Funny bug' 80 | # hack hack, hack 81 | git commit -am 'BF - added fix for Funny bug' 82 | 83 | Note the ``-am`` options to ``commit``. The ``m`` flag just 84 | signals that you're going to type a message on the command 85 | line. The ``a`` flag |emdash| you can just take on faith |emdash| 86 | or see `why the -a flag?`_. 87 | 88 | #. When you have finished, check you have committed all your 89 | changes:: 90 | 91 | git status 92 | 93 | #. Finally, make your commits into patches. You want all the 94 | commits since you branched from the ``master`` branch:: 95 | 96 | git format-patch -M -C master 97 | 98 | You will now have several files named for the commits:: 99 | 100 | 0001-BF-added-tests-for-Funny-bug.patch 101 | 0002-BF-added-fix-for-Funny-bug.patch 102 | 103 | Send these files to the `permute mailing list`_. 104 | 105 | When you are done, to switch back to the main copy of the 106 | code, just return to the ``master`` branch:: 107 | 108 | git checkout master 109 | 110 | Moving from patching to development 111 | =================================== 112 | 113 | If you find you have done some patches, and you have one or 114 | more feature branches, you will probably want to switch to 115 | development mode. You can do this with the repository you 116 | have. 117 | 118 | Fork the `permute`_ repository on github |emdash| :ref:`forking`. 119 | Then:: 120 | 121 | # checkout and refresh master branch from main repo 122 | git checkout master 123 | git pull origin master 124 | # rename pointer to main repository to 'upstream' 125 | git remote rename origin upstream 126 | # point your repo to default read / write to your fork on github 127 | git remote add origin git@github.com:your-user-name/permute.git 128 | # push up any branches you've made and want to keep 129 | git push origin the-fix-im-thinking-of 130 | 131 | Then you can, if you want, follow the 132 | :ref:`development-workflow`. 133 | 134 | .. include:: links.inc 135 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/pull_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/statlab/permute/ef72da3394ca82c04a035c5fcdefe524eea62c45/doc/source/dev/gitwash/pull_button.png -------------------------------------------------------------------------------- /doc/source/dev/gitwash/set_up_fork.rst: -------------------------------------------------------------------------------- 1 | .. _set-up-fork: 2 | 3 | ================== 4 | Set up your fork 5 | ================== 6 | 7 | First you follow the instructions for :ref:`forking`. 8 | 9 | Overview 10 | ======== 11 | 12 | :: 13 | 14 | git clone git@github.com:your-user-name/permute.git 15 | cd permute 16 | git remote add upstream git://github.com/statlab/permute.git 17 | 18 | In detail 19 | ========= 20 | 21 | Clone your fork 22 | --------------- 23 | 24 | #. Clone your fork to the local computer with ``git clone 25 | git@github.com:your-user-name/permute.git`` 26 | #. Investigate. Change directory to your new repo: ``cd permute``. Then 27 | ``git branch -a`` to show you all branches. You'll get something 28 | like:: 29 | 30 | * master 31 | remotes/origin/master 32 | 33 | This tells you that you are currently on the ``master`` branch, and 34 | that you also have a ``remote`` connection to ``origin/master``. 35 | What remote repository is ``remote/origin``? Try ``git remote -v`` to 36 | see the URLs for the remote. They will point to your github fork. 37 | 38 | Now you want to connect to the upstream `permute github`_ repository, so 39 | you can merge in changes from trunk. 40 | 41 | .. _linking-to-upstream: 42 | 43 | Linking your repository to the upstream repo 44 | -------------------------------------------- 45 | 46 | :: 47 | 48 | cd permute 49 | git remote add upstream git://github.com/statlab/permute.git 50 | 51 | ``upstream`` here is just the arbitrary name we're using to refer to the 52 | main `permute`_ repository at `permute github`_. 53 | 54 | Note that we've used ``git://`` for the URL rather than ``git@``. The 55 | ``git://`` URL is read only. This means we that we can't accidentally 56 | (or deliberately) write to the upstream repo, and we are only going to 57 | use it to merge into our own code. 58 | 59 | Just for your own satisfaction, show yourself that you now have a new 60 | 'remote', with ``git remote -v show``, giving you something like:: 61 | 62 | upstream git://github.com/statlab/permute.git (fetch) 63 | upstream git://github.com/statlab/permute.git (push) 64 | origin git@github.com:your-user-name/permute.git (fetch) 65 | origin git@github.com:your-user-name/permute.git (push) 66 | 67 | .. include:: links.inc 68 | 69 | -------------------------------------------------------------------------------- /doc/source/dev/gitwash/this_project.inc: -------------------------------------------------------------------------------- 1 | .. permute 2 | .. _`permute`: https://github.com/statlab/permute 3 | .. _`permute github`: http://github.com/statlab/permute 4 | 5 | .. _`permute mailing list`: http://groups.google.com/group/permute 6 | -------------------------------------------------------------------------------- /doc/source/dev/index.rst: -------------------------------------------------------------------------------- 1 | Developer Guide 2 | =============== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | contribute 8 | gitwash/index.rst 9 | -------------------------------------------------------------------------------- /doc/source/index.rst: -------------------------------------------------------------------------------- 1 | Permutation tests and confidence sets 2 | ===================================== 3 | 4 | .. only:: latex 5 | 6 | .. toctree:: 7 | :maxdepth: 3 8 | 9 | user/index.rst 10 | api/index.rst 11 | 12 | .. only:: html 13 | 14 | ``permute`` provides permutation tests and confidence sets for a variety of 15 | nonparametric testing and estimation problems and for a variety of 16 | randomization designs. 17 | 18 | Benefits of Permutation Tests 19 | ----------------------------- 20 | 21 | - Gives a test with correct type 1 error rate, without needing 22 | uncheckable assumptions 23 | - We can get confidence intervals for the p-value---this tells us how 24 | many iterations we need to achieve a certain precision 25 | - Choice of test statistic is flexible---choose one that makes sense 26 | for your data, gives high power 27 | 28 | Documentation 29 | ------------- 30 | 31 | A PDF version of our documentation is available 32 | `here `_. 33 | 34 | .. toctree:: 35 | :maxdepth: 1 36 | 37 | user/index.rst 38 | dev/index.rst 39 | api/index.rst 40 | 41 | 42 | -------------------------------------------------------------------------------- /doc/source/permute.bib: -------------------------------------------------------------------------------- 1 | @article{1977:corrain, 2 | title={F. and Scardellato, U.(1977). Il valore discriminativo di alcuni fattori Gm, tra le popolazioni pastorali del Kenya}, 3 | author={Corrain, C and Mezzavilla, F Pesarin}, 4 | journal={Atti e Memorie dell’Accademia Patavina di Scienze, Lettere ed Arti, LXXXIX, Parte II: Classe di Scienze Matematiche e Naturali. University of Padua}, 5 | pages={55--63}, 6 | year=1977 7 | } 8 | 9 | @article{davies1982measuring, 10 | title={Measuring agreement for multinomial data}, 11 | author={Davies, Mark and Fleiss, Joseph L}, 12 | journal={Biometrics}, 13 | pages={1047--1051}, 14 | year={1982}, 15 | publisher={JSTOR} 16 | } 17 | 18 | @article{macnell2014s, 19 | title={What's in a Name: Exposing Gender Bias in Student Ratings of Teaching}, 20 | author={MacNell, Lillian and Driscoll, Adam and Hunt, Andrea N}, 21 | journal={Innovative Higher Education}, 22 | pages={1--13}, 23 | year={2014}, 24 | publisher={Springer} 25 | } 26 | 27 | @book{lehmann2006nonparametrics, 28 | title={Nonparametrics: statistical methods based on ranks.}, 29 | author={Lehmann, Erich L and D'Abrera, Howard JM}, 30 | year={2006}, 31 | publisher={Springer New York} 32 | } 33 | 34 | 35 | @article{romano1989bootstrap, 36 | title={Bootstrap and randomization tests of some nonparametric hypotheses.}, 37 | author={Romano, Joseph P}, 38 | journal={The Annals of Statistics}, 39 | volume={17}, 40 | number={1}, 41 | pages={141--159}, 42 | year={1989}, 43 | publisher={Institute of Mathematical Statistics} 44 | } 45 | 46 | @article{romano1988bootstrap, 47 | title={A bootstrap revival of some nonparametric distance tests.}, 48 | author={Romano, Joseph P}, 49 | journal={Journal of the American Statistical Association}, 50 | volume={83}, 51 | number={403}, 52 | pages={698--708}, 53 | year={1988}, 54 | publisher={Taylor \& Francis Group} 55 | } 56 | 57 | @book{fisher1935design, 58 | title={The design of experiments.}, 59 | author={Fisher, Ronald A}, 60 | year={1935}, 61 | publisher={Oliver \& Boyd} 62 | } 63 | 64 | 65 | @article{pitman1937, 66 | title = {Significance tests which may be applied to samples from any populations (Parts I and II).}, 67 | author = {Pitman, Edwin JG}, 68 | journal = {Supplement to the Journal of the Royal Statistical Society}, 69 | volume = {4}, 70 | number = {1}, 71 | pages = {{119--130; 225--232}}, 72 | year = {1937}, 73 | publisher = {Wiley for the Royal Statistical Society}, 74 | } 75 | 76 | 77 | @article{pitman1937II, 78 | title = {Significance Tests Which May be Applied to Samples from any Populations. II. The Correlation Coefficient Test.}, 79 | author = {Pitman, Edwin JG}, 80 | journal = {Supplement to the Journal of the Royal Statistical Society}, 81 | volume = {4}, 82 | number = {2}, 83 | pages = {225-232}, 84 | year = {1937}, 85 | publisher = {Wiley for the Royal Statistical Society}, 86 | } 87 | 88 | @article{pitman1938significance, 89 | title={Significance tests which may be applied to samples from any populations: III. The analysis of variance test.}, 90 | author={Pitman, Edwin JG}, 91 | journal={Biometrika}, 92 | pages={322--335}, 93 | year={1938}, 94 | publisher={JSTOR} 95 | } 96 | 97 | -------------------------------------------------------------------------------- /doc/source/user/index.rst: -------------------------------------------------------------------------------- 1 | User Guide 2 | ========== 3 | 4 | Permutation tests (sometimes referred to as randomization, re-randomization, or 5 | exact tests) are a nonparametric approach to statistical significance testing. 6 | They were first introduced by R. A. Fisher in 1935 :cite:`fisher1935design` and 7 | further developed by E. J. G. Pitman 8 | :cite:`pitman1937,pitman1938significance`. After the introduction of the 9 | bootstrap, the ideas were extended in the 1980's by J. Romano 10 | :cite:`romano1988bootstrap,romano1989bootstrap`. 11 | 12 | Permutation tests were developed to test hypotheses for which relabeling the 13 | observed data was justified by 14 | exchangeability [#f1]_ 15 | of the observed random variables. In these situations, the 16 | conditional distribution of the test statistic under the null hypothesis is completely 17 | determined by the fact that all relabelings of the data are equally likely. 18 | That distribution might be calculable in closed form; if not, it can be simulated 19 | with arbitrary accuracy by generating relabelings uniformly at random. 20 | In contrast to approximate parametric methods or asymptotic methods, the accuracy 21 | of the simulation for any finite (re)sample size is known, and can be made 22 | arbitrarily small at the expense of computing time. 23 | 24 | More generally, permutation tests are possible whenever the null 25 | distribution of the data is invariant under the action of some group 26 | (see Appendix [app:def] for background). Then, a subset of outcomes is 27 | conditionally equally likely, given that the data fall in a particular 28 | *orbit* of the group (all potential observations that result from 29 | applying elements of the group to the observed value of the data). That 30 | makes it possible to determine the conditional distribution of any test 31 | statistic, given the orbit of the data. Since the conditional 32 | distribution is uniform on the orbit of the original data, the 33 | probability of any event is the proportion of possible outcomes that lie 34 | in the event. If tests are performed conditionally at level 35 | :math:`\alpha` regardless of the observed data, the resulting overall 36 | test has unconditional level :math:`\alpha`, by the law of total 37 | probability. 38 | 39 | .. toctree:: 40 | :maxdepth: 2 41 | 42 | one-sample.rst 43 | two-sample.rst 44 | regression.rst 45 | npc/index.rst 46 | references.rst 47 | 48 | .. rubric:: Footnotes 49 | 50 | 51 | .. [#f1] A sequence $X_1, X_2, X_3, \dots, X_n$ of random variables is 52 | *exchangeable* if their joint distribution is invariant to 53 | permutations of the indices; that is, 54 | 55 | .. math:: 56 | p(x_1, \dots, x_n) = p(x_{\pi(1)}, \dots, x_{\pi(n)}) 57 | 58 | for all permutations $\pi$ of $\{1, 2, \dots, n\}$. It is closely related to the 59 | notion of *independent and identically-distributed* random variables. 60 | Independent and identically-distributed random variables are exchangeable. 61 | However, simple random sampling *without* replacement produces an 62 | exchangeable, but not independent, sequence of random variables. 63 | -------------------------------------------------------------------------------- /doc/source/user/npc/chap1-4.rst: -------------------------------------------------------------------------------- 1 | Chapter 1-4 examples 2 | ==================== 3 | 4 | IPAT Data 5 | --------- 6 | 7 | This example is shown in Chapter 1.9, page 33-34. 8 | 9 | .. nbplot:: 10 | 11 | >>> import permute.data as data 12 | >>> from permute.core import one_sample, two_sample 13 | >>> from permute.ksample import k_sample, bivariate_k_sample 14 | >>> from permute.utils import get_prng 15 | >>> import numpy as np 16 | 17 | >>> prng = get_prng(2019426) 18 | >>> ipat = data.ipat() 19 | >>> ipat_res = one_sample(ipat.ya, ipat.yb, stat='mean', alternative='greater', seed=prng) 20 | >>> print("P-value:", round(ipat_res[0], 4)) 21 | P-value: 0.0002 22 | 23 | Job Satisfaction Data 24 | --------------------- 25 | 26 | This example is shown in Chapter 1.10.3, page 41-42. 27 | 28 | .. nbplot:: 29 | 30 | >>> job = data.job() 31 | >>> job_res = two_sample(job.x[job.y == 1], job.x[job.y == 2], stat='mean', reps = 10**5, alternative='greater', seed=prng) 32 | >>> print("P-value:", round(job_res[0], 4)) 33 | P-value: 0.0003 34 | 35 | Worms Data 36 | ---------- 37 | 38 | This example is shown in Chapter 1.11.12, page 47-48. 39 | 40 | .. nbplot:: 41 | 42 | >>> worms = data.worms() 43 | >>> res = k_sample(worms.x, worms.y, stat='one-way anova', seed=prng) 44 | >>> print("ANOVA p-value:", round(res[0], 4)) 45 | ANOVA p-value: 0.0107 46 | 47 | Testosterone Data 48 | ----------------- 49 | 50 | This example is shown in Chapter 2.6.1, page 92-93. 51 | 52 | .. nbplot:: 53 | 54 | >>> testosterone = data.testosterone() 55 | >>> x = np.hstack(testosterone.tolist()) 56 | >>> group1 = np.hstack([[i]*5 for i in range(len(testosterone))]) 57 | >>> group2 = np.array(list(range(5))*len(testosterone)) 58 | >>> print(len(group1), len(group2), len(x)) 59 | 55 55 55 60 | >>> res = bivariate_k_sample(x, group1, group2, reps=5000, seed=prng) 61 | >>> print("ANOVA p-value:", round(res[0], 4)) 62 | ANOVA p-value: 0.0002 63 | 64 | 65 | Massaro-Blair Data 66 | ------------------ 67 | This example is shown in Chapter 4.6, page 240. 68 | 69 | .. nbplot:: 70 | 71 | >>> from permute.npc import npc 72 | >>> mb = data.massaro_blair() 73 | >>> sam1 = mb.y[mb.group == 1] 74 | >>> sam2 = mb.y[mb.group == 2] 75 | >>> first_moment = two_sample(sam1, sam2, alternative='two-sided', reps=5000, keep_dist=True, seed=42) 76 | >>> second_moment = two_sample(sam1**2, sam2**2, alternative='two-sided', reps=5000, keep_dist=True, seed=423) 77 | >>> partial_pvalues = np.array([first_moment[0], second_moment[0]]) 78 | >>> print("Partial p-values:", round(first_moment[0], 3), round(second_moment[0], 3)) 79 | Partial p-values: 0.022 0.01 80 | 81 | >>> npc_distr = np.vstack([first_moment[2], second_moment[2]]).T 82 | >>> global_p = npc(partial_pvalues, np.abs(npc_distr)) 83 | >>> print("Global p-value:", round(global_p, 4)) 84 | Global p-value: 0.002 85 | 86 | Fly Data 87 | -------- 88 | 89 | This example is shown in Chapter 4.6, page 253. 90 | 91 | :: 92 | 93 | fly = data.fly() 94 | vars = fly.dtype.names[1:] 95 | results = {} 96 | for col in vars: 97 | sam1 = fly[col][fly.group == 0] 98 | sam2 = fly[col][fly.group == 1] 99 | if col == 'x7': 100 | results[str(col)] = two_sample(sam1, sam2, keep_dist=True, seed=prng, plus1=True, reps=10**4) 101 | else: 102 | results[str(col)] = two_sample(sam1, sam2, keep_dist=True, alternative = 'less', seed=prng, plus1=True, reps=10**4) 103 | partial_pvalues = np.array(list(map(lambda col: results[col][0], vars))) 104 | print(np.round(partial_pvalues, 3)) 105 | [0.027 0.226 0. 0.391 0. 0.413 0.098] 106 | 107 | npc_distr = np.array(list(map(lambda col: results[col][2], vars))).T 108 | npc_distr.shape 109 | (10000, 7) 110 | alternatives = ['greater']*6 + ['less']*1 111 | fisher = npc(partial_pvalues, npc_distr, alternatives=alternatives) 112 | liptak = npc(partial_pvalues, npc_distr, alternatives=alternatives, combine = 'liptak') 113 | tippett = npc(partial_pvalues, npc_distr, alternatives=alternatives, combine='tippett') 114 | print("Fisher combined p-value:", fisher) 115 | Fisherer combined p-value: 0.0 116 | print("Liptak combined p-value:", liptak) 117 | Liptak combined p-value: 0.0 118 | print("Tippett combined p-value:", tippett) 119 | Tippett combined p-value: 0.0 120 | 121 | 122 | Post-hoc conditional power analysis 123 | ----------------------------------- 124 | 125 | These examples come from Chapter 3.2.1, pages 139-141. 126 | 127 | :: 128 | 129 | # IPAT data 130 | alpha = 0.01 131 | prng = get_prng(78943501) 132 | effect_est = ipat_res[1] 133 | print("Estimated difference in means:", effect_est) 134 | Estimated difference in means: 3.1 135 | 136 | z = ipat.ya - ipat.yb - effect_est 137 | simulated_pvalues = np.zeros(1000) 138 | for i in range(1000): 139 | prng.shuffle(z) 140 | sim_sam = z.copy() + effect_est 141 | simulated_pvalues[i] = one_sample(sim_sam, stat='mean', alternative='greater', seed=1234, reps=1000)[0] 142 | power = np.mean(simulated_pvalues <= alpha) 143 | print("Estimated power:", power) 144 | Estimated power: 1.0 145 | 146 | # Job data 147 | effect_est = job_res[1] 148 | print("Estimated difference in means:", effect_est) 149 | Estimated difference in means: 17.29166666666667 150 | 151 | xnorm = job.x 152 | xnorm[job.y == 1] = job.x[job.y == 1] - effect_est 153 | simulated_pvalues = np.zeros(1000) 154 | for i in range(1000): 155 | prng.shuffle(xnorm) 156 | sim_sam = xnorm.copy() 157 | sim_sam[job.y==1] = sim_sam[job.y==1] + effect_est 158 | simulated_pvalues[i] = two_sample(sim_sam[job.y == 1], sim_sam[job.y == 2], stat='mean', reps = 10**3, alternative='greater', seed=1234)[0] 159 | power = np.mean(simulated_pvalues <= alpha) 160 | print("Estimated power:", power) 161 | Estimated power: 0.96 162 | -------------------------------------------------------------------------------- /doc/source/user/npc/index.rst: -------------------------------------------------------------------------------- 1 | Permutation Tests for Complex Data 2 | ================================== 3 | 4 | Examples from "Permutation Tests for Complex Data: Theory, Applications and 5 | Software" by F. Pesarin and L. Salmaso. 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | kenya.rst 11 | chap1-4.rst 12 | westfall-wolfinger.rst 13 | -------------------------------------------------------------------------------- /doc/source/user/npc/kenya.rst: -------------------------------------------------------------------------------- 1 | Kenya 2 | ===== 3 | 4 | The Kenya dataset :cite:`1977:corrain` contains 16 observations and two variables 5 | in total. It concerns an anthropological study on the "Ol Molo" and "Kamba" 6 | populations described above. Table 1 shows the sample frequencies of the 16 7 | phenotypic combinations in the samples selected from the two populations. 8 | 9 | Given :math:`X_1, X_2, \dots, X_n` and ... 10 | 11 | 12 | .. nbplot:: 13 | 14 | >>> from __future__ import print_function 15 | >>> from matplotlib import mlab 16 | >>> import numpy as np 17 | >>> from permute.data import kenya 18 | >>> d = kenya() 19 | >>> for i in range(len(d)): 20 | ... if i == 0: 21 | ... print(d.dtype.names) 22 | ... print(d[i]) 23 | ('classes', 'ol_molo', 'kamba') 24 | (1, 12, 0) 25 | (2, 1, 0) 26 | (3, 8, 6) 27 | (4, 2, 1) 28 | (5, 0, 0) 29 | (6, 1, 0) 30 | (7, 1, 0) 31 | (8, 0, 0) 32 | (9, 0, 0) 33 | (10, 2, 0) 34 | (11, 8, 15) 35 | (12, 6, 0) 36 | (13, 0, 0) 37 | (14, 0, 0) 38 | (15, 3, 1) 39 | (16, 1, 0) 40 | >>> import matplotlib.pyplot as plt 41 | >>> plt.plot(d['ol_molo']) 42 | [] 43 | >>> plt.plot(d['kamba']) 44 | [] 45 | >>> plt.legend(['ol_molo', 'kamba']) 46 | 47 | >>> plt.show() 48 | 49 | -------------------------------------------------------------------------------- /doc/source/user/npc/westfall-wolfinger.rst: -------------------------------------------------------------------------------- 1 | Westfall-Wolfinger "mult" data 2 | =============================== 3 | 4 | This example comes from Chapter 5.5. 5 | 6 | When running the two sample test, use the same initial PRNG seed in order to keep permutations correlated for each test. This is crucial for NPC. 7 | 8 | .. nbplot:: 9 | 10 | >>> import permute.data as data 11 | >>> from permute.core import two_sample 12 | >>> from permute.npc import fwer_minp 13 | >>> import numpy as np 14 | 15 | >>> ww = data.mult() 16 | >>> p1 = two_sample(ww.y1[ww.x == 0], ww.y1[ww.x == 1], alternative="two-sided", seed=40929102, keep_dist=True, reps=5000) 17 | >>> p2 = two_sample(ww.y2[ww.x == 0], ww.y2[ww.x == 1], alternative="two-sided", seed=40929102, keep_dist=True, reps=5000) 18 | >>> p3 = two_sample(ww.y3[ww.x == 0], ww.y3[ww.x == 1], alternative="two-sided", seed=40929102, keep_dist=True, reps=5000) 19 | 20 | >>> pvalues = np.array([p1[0], p2[0], p3[0]]) 21 | >>> distr = np.abs(np.vstack([p1[2], p2[2], p3[2]]).T) 22 | >>> pvalues_adj_fisher = fwer_minp(pvalues, distr, combine="fisher") 23 | >>> pvalues_adj_liptak = fwer_minp(pvalues, distr, combine="liptak") 24 | >>> pvalues_adj_tippett = fwer_minp(pvalues, distr, combine="tippett") 25 | 26 | 27 | :: 28 | 29 | print("Adjusted p-values \nFisher:", pvalues_adj_fisher, "\nLiptak:", pvalues_adj_liptak, "\nTippett:", pvalues_adj_tippett) 30 | Adjusted p-values 31 | Fisher: [0.08758248 0.04819036 0.0219956 ] 32 | Liptak: [0.08758248 0.0459908 0.02339532] 33 | Tippett: [0.08758248 0.06258748 0.02359528] 34 | -------------------------------------------------------------------------------- /doc/source/user/one-sample.rst: -------------------------------------------------------------------------------- 1 | Paired permutation tests 2 | ======================== 3 | 4 | To illustrate the paired two-sample permutation test, consider the following 5 | randomized, controlled experiment. You suspect a specific treatment will 6 | increase the growth rate of a certain type of cell. To test this hypothesis, 7 | you clone 100 cells. Now there are 200 cells composed of 100 pairs of identical 8 | clones. For each cloned pair you randomly assign one to treatment, with 9 | probability 1/2, independently across the 100 pairs. At the end of the 10 | treatment, you measure the growth rate for all the cells. The null hypothesis 11 | is that treatment has no effect. If that is true, then the assignment of a 12 | clone to treatment amounts to an arbitrary label that has nothing to do with 13 | the measured response. So, given the responses within each pair (but not the 14 | knowledge of which clone in each pair had which response), it would have been 15 | just as likely to observe the same *numbers* but with flipped labels within 16 | each pair. We could generate new hypothetical datasets from the observed data 17 | by assigning the treatment and control labels for all the cloned pairs 18 | independently. This yields a total of :math:`2^{100}` total datasets 19 | (including the observed data and all the hypothetical datasets that you 20 | generated), all equally likely to have occurred under the null, conditioning on 21 | the observed data (but not the labeling). 22 | 23 | The standard parametric approach to this problem is the paired :math:`t`-test, 24 | since the cloned cells are presumably more similar to each other than to 25 | another randomly chosen cell (and thus more readily compared). The paired 26 | :math:`t`-test assumes that, if the null hypothesis is true, the differences in 27 | response between each pair of clones are independently and identically (iid) 28 | normally distributed with mean zero and unknown variance. The test statistic is 29 | the mean of the differences between each cloned pair divided by the standard 30 | error of these differences. Under these assumptions, the test statistic is 31 | distributed as a :math:`t`-distribution with :math:`n-1` degrees of freedom. 32 | This means you can calculate the test statistic and then read off the from the 33 | :math:`t`-distribution. If the is below some prespecified critical value 34 | :math:`\alpha`, then you reject the null. If the true generative model for the 35 | data is not iid normal, however, the probability of rejecting the null 36 | hypothesis can be quite different from :math:`\alpha` even if treatment has no 37 | effect. 38 | 39 | A permutation version of the :math:`t`-test can avoid that vulnerability: one 40 | can use the :math:`t`-statistic as the test statistic, but instead of selecting 41 | the critical value on the basis of Student’s :math:`t`-distribution, one uses 42 | the distribution of the statistic under the permutation distribution. Of 43 | course, other test statistics could be used instead; the test statistic should 44 | be sensitive to the nature of the alternative hypothesis, to ensure that the 45 | test has power against the alternatives the science suggests are relevant. 46 | 47 | Regardless of which test statistic you choose for your permutation test, if the 48 | problem size is not too large then you enumerate all equally likely 49 | possibilities under the null given the observed data. If the problem is too 50 | large to feasibly enumerate, then you use a suitably large, iid random sample 51 | from the exact distribution just described, by selecting permutations uniformly 52 | at random and applying the test statistic to those permutations. As you 53 | increase the number of samples, you will get increasingly better (in 54 | probability) approximations of the exact distribution of the test statistic 55 | under the null. The null conditional probability of any event can be estimated 56 | as the proportion of random permutations for which the event occurs, and the 57 | sampling variability of that estimate can be characterized exactly, for 58 | instance, using binomial tests (since the distribution of the number of times 59 | the event occurs is Binomial with :math:`n` equal to the number of samples and 60 | :math:`p` the unknown probability to be estimated). 61 | 62 | Example 63 | ------- 64 | 65 | We'll generate some fake data to demonstrate the paired two-sample problem. 66 | We'll follow the cloned cells example above. The controls have a response that 67 | is distributed uniformly between 0 and 10. There is random variation among the 68 | cells, so the difference between responses in a pair is normally distributed 69 | with 0 mean. In the first case, suppose we give the treatment group an 70 | ineffective treatment, so there is no treatment effect. The treated cell is 71 | equally likely to have a response that is larger or smaller than it's clone's 72 | response. 73 | 74 | .. code:: 75 | 76 | >>> from __future__ import print_function 77 | >>> import numpy as np 78 | >>> from numpy.random import RandomState 79 | >>> from permute.core import one_sample 80 | 81 | >>> prng = RandomState(42) 82 | >>> control = prng.uniform(low = 0, high=10, size=100) 83 | >>> ineffective_treatment = control + prng.normal(loc=0, scale=1, size=100) 84 | >>> (p, diff_means) = one_sample(ineffective_treatment, control, stat='mean', seed=prng) 85 | >>> print("P-value: ", p) 86 | P-value: 0.50726 87 | >>> print("Difference in means:", diff_means) 88 | Difference in means: -0.00108036016736 89 | 90 | Now, suppose we give a new treatment that has a constant effect that increases 91 | the cell's response by 1. 92 | 93 | .. code:: 94 | 95 | >>> good_treatment = control + prng.normal(loc=1, scale=1, size=100) 96 | >>> (p, diff_means) = one_sample(good_treatment, control, stat='mean', seed=prng) 97 | >>> print("P-value: ", p) 98 | P-value: 0.0 99 | >>> print("Difference in means:", diff_means) 100 | Difference in means: 1.08009705107 101 | 102 | `one_sample` is written to either take in two arguments and test the difference 103 | between pairs as we've done above, or to take in a single argument and test 104 | whether that variable is centered around 0. Below, we call `one_sample` in that 105 | manner, supplying the difference in response within pairs, and get the same 106 | results. 107 | 108 | .. code:: 109 | 110 | >>> paired_differences = good_treatment - control 111 | >>> (p, diff_means) = one_sample(paired_differences, stat='mean', seed = prng) 112 | >>> print("P-value: ", p) 113 | P-value: 0.0 114 | >>> print("Difference in means:", diff_means) 115 | Difference in means: 1.08009705107 116 | 117 | -------------------------------------------------------------------------------- /doc/source/user/references.rst: -------------------------------------------------------------------------------- 1 | .. only:: html 2 | 3 | References 4 | ========== 5 | 6 | .. bibliography:: 7 | -------------------------------------------------------------------------------- /doc/source/user/regression.rst: -------------------------------------------------------------------------------- 1 | Regression 2 | ---------- 3 | 4 | Given :math:`n` observations of two scalars :math:`(x_i, y_i)` for 5 | :math:`i = 1, 2, \dots, n`, consider the simple linear regression model 6 | 7 | .. math:: 8 | 9 | y_i = a + bx_i + \epsilon_i. 10 | 11 | Assume that :math:`\{\epsilon_i\}_{i=1}^{n}` are exchangeable. 12 | 13 | You are interested in testing whether the slope of the population 14 | regression line is non-zero; hence, your null hypothesis is 15 | :math:`b = 0`. If :math:`b = 0`, then the model reduces to 16 | :math:`y_i = a + \epsilon_i` for all :math:`i`. If this is true, the 17 | :math:`\{y_i\}_{i=1}^{n}` are exchangeable since they are just shifted 18 | versions of the exchangeable :math:`\{\epsilon_i\}_{i=1}^{n}`. Thus 19 | every permutation of the :math:`\{y_i\}_{i=1}^{n}` has the same 20 | conditional probability regardless of the :math:`x`\ s. Hence every 21 | pairing :math:`(x_i, y_j)` for any fixed :math:`i` and for 22 | :math:`j = 1, 2, \dots, n` is equally likely. 23 | 24 | Using the least squares estimate of the slope as the test statistic, you can 25 | find its exact distribution under the null given the observed data by computing 26 | the test statistic on all possible pairs formed by permuting the :math:`y` 27 | values, keeping the original order of the :math:`x` values. From the 28 | distribution of the test statistic under the null conditioned on the observed 29 | data, the is the ratio of the count of the *as extreme* or *more extreme* test 30 | statistics to the total number of such test statistics. You might in principle 31 | enumerate all :math:`n!` equally likely pairings and then compute the exact p-value. 32 | For sufficiently large :math:`n`, enumeration becomes infeasible; in which 33 | case, you could approximate the exact p-value using a uniform random sample of the 34 | equally likely pairings. 35 | 36 | A parametric approach to this problem would begin by imposing additional 37 | assumptions on the noise :math:`\epsilon`. For example, if we assume 38 | that :math:`\{\epsilon_i\}` are iid Gaussians with mean zero, then the 39 | the least squares estimate of the slope normalized by its standard 40 | error has a :math:`t`-distribution with :math:`n-2` degrees of 41 | freedom. If this additional assumption holds, then we can read the off a 42 | table. Note that, unlike in the permutation test, we were only able to 43 | calculate the p-value (even with the additional assumptions) because we happened 44 | to be able to derive the distribution of this specific test statistic. 45 | 46 | Derivation 47 | ~~~~~~~~~~ 48 | 49 | Given $n$ observations 50 | 51 | .. math:: 52 | 53 | y_i = a + bx_i + \epsilon_i, 54 | 55 | the least square solution is 56 | 57 | .. math:: 58 | 59 | \min_{a, b} \sum_{i=1}^n \left(y_i - a - bx_i \right)^2 60 | 61 | 62 | Taking the partial derivative with respect to $a$ 63 | 64 | .. math:: 65 | 66 | \frac{\partial }{\partial b} \sum_{i=1}^n \left(y_i - a - bx_i \right)^2 67 | &= -2 \sum_{i=1}^n \left(y_i - a - bx_i \right) \\ 68 | &= -2 \left(\sum_{i=1}^n y_i - na - b \sum_{i=1}^n x_i \right) \\ 69 | &= -2n \left( \bar{y} - a - b \bar{x} \right). 70 | 71 | Setting this to $0$ and solving for $a$ yields our estimate $\hat{a}$ 72 | 73 | .. math:: 74 | 75 | \hat{a} = \bar{y} - b \bar{x}. 76 | 77 | Taking the partial derivative with respect to $b$ 78 | 79 | .. math:: 80 | 81 | \frac{\partial }{\partial b} \sum_{i=1}^n \left(y_i - a - bx_i \right)^2 82 | &= -2 \sum_{i=1}^n \left(y_i - a - bx_i \right) x_i \\ 83 | &= -2 \left(\sum_{i=1}^n y_ix_i - a \sum_{i=1}^n x_i - b \sum_{i=1}^n x_ix_i \right) \\ 84 | &= -2n \left( \overline{xy} - a \bar{x} - b \overline{xx} \right). 85 | 86 | Plugging in $\hat{a}$, setting the result to $0$, and solving for $b$ yields 87 | 88 | .. math:: 89 | 90 | \hat{b} &= \frac{\overline{xy} - \bar{x}\bar{y}}{\overline{xx} - \bar{x}\bar{x}} 91 | = \frac{\mathrm{Cov}(x, y)}{\mathrm{Var}(x)} = \mathrm{Cor}(x, y)\left(\frac{\mathrm{Std}(y)}{\mathrm{Std}(x)}\right). 92 | 93 | Since $\frac{\mathrm{Std}(y)}{\mathrm{Std}(x)}$ is constant under the 94 | permutation of $y$, we can calculate the p-value using the permutation 95 | test of the correlation. 96 | 97 | .. code:: 98 | 99 | >>> from __future__ import print_function 100 | >>> import numpy as np 101 | 102 | >>> X = np.array([np.ones(10), np.random.random_integers(1, 4, 10)]).T 103 | >>> beta = np.array([1.2, 2]) 104 | >>> epsilon = np.random.normal(0, .15, 10) 105 | >>> y = X.dot(beta) + epsilon 106 | 107 | >>> from permute.core import corr 108 | >>> t, pv_left, pv_right, pv_both, dist = corr(X[:, 1], y) 109 | >>> print(t) 110 | 0.998692462616 111 | >>> print(pv_both) 112 | 0.0007 113 | >>> print(pv_right) 114 | 0.0007 115 | >>> print(pv_left) 116 | 1.0 117 | 118 | >>> t, pv_both, dist = corr(X[:, 1], y) 119 | >>> print(t) 120 | 0.103891027265 121 | >>> print(pv_both) 122 | 0.765 123 | >>> print(pv_right) 124 | 0.3818 125 | >>> print(pv_left) 126 | 0.619 127 | -------------------------------------------------------------------------------- /permute/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | ``permute`` provides permutation tests and confidence intervals for a variety 3 | of nonparametric testing and estimation problems, for a variety of 4 | randomization designs. 5 | 6 | * Stratified and unstratified tests 7 | * Test statistics in each stratum 8 | * Methods of combining tests across strata 9 | * Nonparametric combinations of tests 10 | 11 | Problems/Methods: 12 | ----------------- 13 | 14 | 1. The 2-sample problem 15 | 2. The *n*-sample problem 16 | 3. Tests for the slope in linear regression 17 | 4. Tests for quantiles 18 | 5. Tests of independence and association: runs tests, permutation association 19 | 6. Tests of exchangeability 20 | 7. Tests of symmetry: reflection, spherical 21 | 8. Permutation ANOVA 22 | 9. Goodness of fit tests 23 | 24 | 25 | Confidence sets 26 | --------------- 27 | 28 | 1. Constant shifts 29 | 2. Proportional shifts 30 | 3. Monotone shifts 31 | 32 | 33 | Links 34 | ----- 35 | 36 | UC Berkeley's Statistics 240: Nonparametric and Robust Methods. 37 | 38 | * `2015 course 39 | website `_ 40 | * `Philip Stark's lecture 41 | notes `_ 42 | 43 | "Permutation Tests for Complex Data: Theory, Applications and Software" 44 | by Fortunato Pesarin, Luigi Salmaso 45 | 46 | 47 | * `Publisher's 48 | website `_ 49 | * `Supplementary Material (i.e., code and 50 | data) `_ 51 | * `NPC test code `_ 52 | 53 | "Stochastic Ordering and ANOVA: Theory and Applications with R" 54 | by Basso D., Pesarin F., Salmaso L., Solari A. 55 | 56 | * `R code `_ 57 | """ 58 | 59 | import os.path as _osp 60 | import importlib as _imp 61 | import functools as _functools 62 | import warnings as _warnings 63 | 64 | pkg_dir = _osp.abspath(_osp.dirname(__file__)) 65 | data_dir = _osp.join(pkg_dir, 'data') 66 | 67 | __version__ = "0.3rc1.dev0" 68 | 69 | 70 | try: 71 | _imp.import_module('pytest') 72 | except ImportError: 73 | def test(verbose=False): 74 | """This would run all unit tests, but pytest couldn't be 75 | imported so the test suite can not run. 76 | """ 77 | raise ImportError("Could not load pytest. Unit tests not available.") 78 | 79 | def _doctest(verbose=False): 80 | """This would run all doc tests, but pytest couldn't be 81 | imported so the test suite can not run. 82 | """ 83 | raise ImportError("Could not load pytest. Doctests not available.") 84 | else: 85 | def test(doctest=False, verbose=False, dry_run=False, run_all=True): 86 | """Run all unit tests.""" 87 | import pytest 88 | 89 | pytest_args = ["-l"] 90 | 91 | if verbose: 92 | pytest_args += ["-v"] 93 | 94 | if dry_run: 95 | pytest_args += ["--collect-only"] 96 | 97 | if run_all: 98 | pytest_args += ["--runslow"] 99 | 100 | if doctest: 101 | pytest_args += ["--doctest-modules"] 102 | 103 | pytest_args += ["--pyargs", "permute"] 104 | 105 | try: 106 | code = pytest.main(pytest_args) 107 | except SystemExit as exc: 108 | code = exc.code 109 | 110 | return code == 0 111 | -------------------------------------------------------------------------------- /permute/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | 4 | def pytest_addoption(parser): 5 | parser.addoption( 6 | "--runslow", action="store_true", default=False, help="run slow tests" 7 | ) 8 | 9 | 10 | def pytest_configure(config): 11 | config.addinivalue_line("markers", "slow: mark test as slow to run") 12 | 13 | 14 | def pytest_collection_modifyitems(config, items): 15 | if config.getoption("--runslow"): 16 | # --runslow given in cli: do not skip slow tests 17 | return 18 | skip_slow = pytest.mark.skip(reason="need --runslow option to run") 19 | for item in items: 20 | if "slow" in item.keywords: 21 | item.add_marker(skip_slow) 22 | -------------------------------------------------------------------------------- /permute/data/MacNell2014.csv: -------------------------------------------------------------------------------- 1 | group,professional,respect,caring,enthusiastic,communicate,helpful,feedback,prompt,consistent,fair,responsive,praised,knowledgeable,clear,overall,gender,age,tagender,taidgender 2 | 3,5,5,4,4,4,3,4,4,4,4,4,4,3,5,4,2,1990,0,1 3 | 3,4,4,4,4,5,5,5,5,3,4,5,5,5,5,4,1,1992,0,1 4 | 3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,2,1991,0,1 5 | 3,5,5,5,5,5,3,5,5,5,5,3,5,5,5,5,2,1991,0,1 6 | 3,5,5,5,5,5,5,5,3,4,5,5,5,5,5,5,2,1992,0,1 7 | 3,4,4,4,4,4,4,3,4,3,3,5,5,3,3,4,1,1991,0,1 8 | 3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,1984,0,1 9 | 3,5,5,5,4,5,4,5,5,5,5,5,5,5,5,5,1,1990,0,1 10 | 3,4,4,3,4,4,4,5,4,4,4,3,5,4,4,4,2,1989,0,1 11 | 3,4,4,3,3,3,3,3,4,2,4,3,3,3,3,3,1,2012,0,1 12 | 3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1990,0,1 13 | 3,5,5,4,4,3,3,4,4,3,4,3,4,4,4,4,1,1985,0,1 14 | 4,5,5,5,5,5,5,5,5,5,5,3,5,5,5,5,2,1986,1,1 15 | 4,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,2,1993,1,1 16 | 4,5,5,4,4,4,3,4,4,3,4,3,5,5,2,4,2,1986,1,1 17 | 4,5,5,5,4,4,5,4,4,4,5,3,4,4,2,4,2,1992,1,1 18 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,1991,1,1 19 | 4,5,4,3,4,5,2,2,5,5,4,3,5,5,2,3,1,1991,1,1 20 | 4,5,5,5,4,4,5,4,4,4,4,4,5,5,4,4,1,1992,1,1 21 | 4,4,5,4,4,3,4,4,4,4,4,4,4,4,4,4,1,1990,1,1 22 | 4,4,4,2,3,3,3,3,4,2,3,3,3,3,2,3,1,1991,1,1 23 | 4,5,5,4,4,4,3,4,5,4,4,3,5,4,4,4,2,1990,1,1 24 | 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,2,1990,1,1 25 | 5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1990,0,0 26 | 5,1,1,1,1,1,1,1,1,1,4,3,4,4,1,1,2,1990,0,0 27 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1989,0,0 28 | 5,5,5,4,4,4,3,4,3,3,3,4,4,5,4,4,1,1992,0,0 29 | 5,5,5,3,4,3,2,4,5,4,3,4,4,4,4,4,2,1991,0,0 30 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,2,1990,0,0 31 | 5,4,4,5,5,4,3,4,5,5,3,3,4,4,3,4,1,1993,0,0 32 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,2,1990,0,0 33 | 6,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,2,1990,1,0 34 | 6,5,5,5,5,5,5,5,4,4,4,5,5,5,5,5,1,1988,1,0 35 | 6,5,5,3,4,5,4,5,4,5,5,3,4,5,5,5,2,1992,1,0 36 | 6,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,1991,1,0 37 | 6,4,4,4,4,4,4,5,4,4,4,4,4,4,4,4,2,1990,1,0 38 | 6,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,2,1990,1,0 39 | 6,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1986,1,0 40 | 6,5,5,4,4,4,4,4,3,3,3,4,4,4,4,4,2,1991,1,0 41 | 6,1,1,2,1,1,3,1,1,1,1,1,1,1,1,1,2,1989,1,0 42 | 6,4,5,4,3,4,3,4,4,3,3,4,4,5,4,4,1,1990,1,0 43 | 6,5,5,4,3,4,4,2,2,2,2,4,4,4,1,4,2,1991,1,0 44 | 6,4,4,3,3,3,4,4,4,4,4,4,4,3,3,3,2,1982,1,0 -------------------------------------------------------------------------------- /permute/data/__init__.py: -------------------------------------------------------------------------------- 1 | """Standard test data. 2 | 3 | For more information, see 4 | 5 | - http://www.wiley.com/legacy/wileychi/pesarin/material.html 6 | 7 | """ 8 | 9 | 10 | import os as _os 11 | 12 | import numpy as np 13 | 14 | from .. import data_dir 15 | 16 | 17 | __all__ = ['load', 18 | 'kenya', ] 19 | 20 | 21 | def load(f): 22 | r"""Load a data file located in the data directory. 23 | 24 | Parameters 25 | ---------- 26 | f : string 27 | File name. 28 | 29 | Returns 30 | ------- 31 | x : array like 32 | Data loaded from permute.data_dir. 33 | """ 34 | return np.recfromcsv(_os.path.join(data_dir, f), delimiter=",", encoding=None) 35 | 36 | 37 | def nsgk(): 38 | r"""NSGK test data for irr. 39 | 40 | Notes 41 | ----- 42 | 43 | Here is first 5 lines of `nsgk.csv`:: 44 | 45 | time_stamp,domain,video,rater 46 | 1,8,1,1 47 | 1,12,1,1 48 | 1,15,1,1 49 | 1,20,1,1 50 | 51 | """ 52 | nz = np.loadtxt(_os.path.join(data_dir, "nsgk.csv"), 53 | delimiter=',', skiprows=1, dtype=np.int32) 54 | shape = tuple(nz.max(axis=0)) 55 | x = np.zeros(shape, dtype=np.int32) 56 | nz -= 1 57 | for r in nz: 58 | x[tuple(r)] = 1 59 | 60 | # given order: time_stamp,domain,video,rater 61 | # desired order: domain,video,rater,time_stamp 62 | x = x.transpose(1, 2, 3, 0) 63 | # hardcoding the number of timestamps per video 64 | time_stamps = [36, 32, 35, 37, 31, 35, 40, 32] 65 | p1 = [[m[:, :time_stamps[i]] for i, m in enumerate(n)]for n in x] 66 | 67 | ## Alternatively, I could return a 2D object array with 68 | ## rater x time_stamp(video) matrices as entries 69 | ## Not sure which is better, so I will wait to see how I use it. 70 | # p1 = np.zeros(x.shape[:2], dtype=object) 71 | # for i, n in enumerate(x): 72 | # for j, m in enumerate(n): 73 | # p1[i, j] = m 74 | 75 | return p1 76 | 77 | 78 | def macnell2014(): 79 | r"""Data from MacNell et al. 2014 80 | 81 | .. Lillian MacNell, Adam Driscoll, and Andrea N Hunt, "What's 82 | in a Name: Exposing Gender Bias in Student Ratings of Teaching," 83 | Innovative Higher Education, pp. 1-13, 2014. 84 | """ 85 | return load("MacNell2014.csv") 86 | 87 | 88 | def clinical_trial(): 89 | r"""Data from Ottoboni et al. 2018 90 | 91 | .. Kellie Ottoboni, Fraser Lewis, and Luigi Salmaso, "An Empirical 92 | Comparison of Parametric and Permutation Tests for Regression 93 | Analysis of Randomized Experiments," Statistics in 94 | Biopharmaceutical Research, 2018. 95 | """ 96 | return load("rb_clinical_trial.csv") 97 | 98 | 99 | # def another_poss(): 100 | # nz = np.loadtxt(_os.path.join(data_dir, "nsgk.csv"), 101 | # delimiter=',', skiprows=1, dtype=np.int) 102 | # _, nd, nv, nr = tuple(nz.max(axis=0)) 103 | # dv = np.zeros((nd, nv), dtype=object) 104 | # time_stamps = [36, 32, 35, 37, 31, 35, 40, 32] 105 | # for n in range(nd): 106 | # for v in range(nv): 107 | # dv[n, v] = np.zeros((nr, time_stamps[v]), dtype=np.int) 108 | # nz -= 1 109 | # for _ts, _d, _v, _r in nz: 110 | # dv[_d, _v][_r, _ts] = 1 111 | # 112 | 113 | def botulinum(): 114 | r"""The 115 | 116 | """ 117 | return load(_os.path.join("npc", "botulinum.csv")) 118 | 119 | 120 | def chrom17m(): 121 | r"""The 122 | 123 | """ 124 | return load(_os.path.join("npc", "chrom17m.csv")) 125 | 126 | 127 | def confocal(): 128 | """The 129 | 130 | """ 131 | return load(_os.path.join("npc", "confocal.csv")) 132 | 133 | 134 | def germina(): 135 | """The 136 | 137 | """ 138 | return load(_os.path.join("npc", "germina.csv")) 139 | 140 | 141 | def kenya(): 142 | """The Kenya dataset contains 16 observations and two variables in total. 143 | It concerns an anthropological study on the "Ol Molo" and "Kamba" 144 | populations. 145 | 146 | """ 147 | return load(_os.path.join("npc", "kenya.csv")) 148 | 149 | 150 | def massaro_blair(): 151 | """The 152 | 153 | """ 154 | return load(_os.path.join("npc", "massaro_blair.csv")) 155 | 156 | 157 | def monachus(): 158 | """The 159 | 160 | """ 161 | return load(_os.path.join("npc", "monachus.csv")) 162 | 163 | 164 | def mult(): 165 | """The 166 | 167 | """ 168 | return load(_os.path.join("npc", "mult.csv")) 169 | 170 | 171 | def perch(): 172 | """The 173 | 174 | """ 175 | return load(_os.path.join("npc", "perch.csv")) 176 | 177 | 178 | def rats(): 179 | """The 180 | 181 | """ 182 | return load(_os.path.join("npc", "rats.csv")) 183 | 184 | 185 | def setig(): 186 | """The 187 | 188 | """ 189 | return load(_os.path.join("npc", "setig.csv")) 190 | 191 | 192 | def urology(): 193 | """The 194 | 195 | """ 196 | return load(_os.path.join("npc", "urology.csv")) 197 | 198 | 199 | def washing_test(): 200 | """The 201 | 202 | """ 203 | return load(_os.path.join("npc", "washing_test.csv")) 204 | 205 | 206 | def waterfalls(): 207 | """The 208 | 209 | """ 210 | return load(_os.path.join("npc", "waterfalls.csv")) 211 | 212 | 213 | def ipat(): 214 | """The IPAT dataset from Pesarin and Salmaso Chapter 1 215 | """ 216 | return load(_os.path.join("npc", "examples_chapters_1-4", "ipat.csv")) 217 | 218 | 219 | def job(): 220 | """The job satisfaction dataset from Pesarin and Salmaso Chapter 1 221 | """ 222 | return load(_os.path.join("npc", "examples_chapters_1-4", "job.csv")) 223 | 224 | 225 | def fly(): 226 | """The fly dataset from Pesarin and Salmaso Chapter 4 227 | """ 228 | return load(_os.path.join("npc", "examples_chapters_1-4", "fly.csv")) 229 | 230 | 231 | def testosterone(): 232 | """The testosterone dataset from Pesarin and Salmaso Chapter 2 233 | """ 234 | return load(_os.path.join("npc", "examples_chapters_1-4", "testosterone.csv")) 235 | 236 | 237 | def worms(): 238 | """The worms dataset from Pesarin and Salmaso Chapter 1 239 | """ 240 | return load(_os.path.join("npc", "examples_chapters_1-4", "worms.csv")) 241 | -------------------------------------------------------------------------------- /permute/data/npc/README.md: -------------------------------------------------------------------------------- 1 | The datasets in this directory are from "Permutation Tests for Complex Data: 2 | Theory, Applications and Software" by Fortunato Pesarin, Luigi Salmaso. 3 | 4 | For more details see: 5 | http://www.wiley.com/legacy/wileychi/pesarin/material.html 6 | -------------------------------------------------------------------------------- /permute/data/npc/autofluorescence/autofl.csv: -------------------------------------------------------------------------------- 1 | AF1280,AF1530,AF1790,AF2040,AF2300,AF2550,AF2800,AF3060,AF3300,AF3570,AF3820,AF12830,AF15330,AF17930,AF20430,AF23030,AF25530,AF28030,AF30630,AF33030,AF35730,AF38230,AF12860,AF15360,AF17960,AF20460,AF23060,AF25560,AF28060,AF30660,AF33060,AF35760,AF38260,AF12890,AF15390,AF17990,AF20490,AF23090,AF25590,AF28090,AF30690,AF33090,AF35790,AF38290,AF128120,AF153120,AF179120,AF204120,AF230120,AF255120,AF280120,AF306120,AF330120,AF357120,AF382120,AF128150,AF153150,AF179150,AF204150,AF230150,AF255150,AF280150,AF306150,AF330150,AF357150,AF382150 2 | 0,0,1,1,1,0,0,0,2,0,2,1,2,2,0,0,0,0,1,0,0,2,0,0,0,0,0,0,2,0,2,0,0,0,0,2,0,0,0,2,0,2,2,0,0,0,0,2,0,0,0,2,1,0,0,0,0,2,2,0,0,1,0,0,0,1 3 | 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4 | 0,0,2,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,2,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,2,2,0,0,0,2,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6 | 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0 9 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1 10 | 0,0,2,1,1,0,0,0,0,0,0,0,0,2,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,2,2,0,0,0,0,2,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,1,1,0,0,0,0,0,0,0,2,2,1,1,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0 13 | 0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0 14 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0 15 | -------------------------------------------------------------------------------- /permute/data/npc/autofluorescence/drusen.csv: -------------------------------------------------------------------------------- 1 | DRU1280,DRU1530,DRU1790,DRU2040,DRU2300,DRU2550,DRU2800,DRU3060,DRU3300,DRU3570,DRU3820,DRU12830,DRU15330,DRU17930,DRU20430,DRU23030,DRU25530,DRU28030,DRU30630,DRU33030,DRU35730,DRU38230,DRU12860,DRU15360,DRU17960,DRU20460,DRU23060,DRU25560,DRU28060,DRU30660,DRU33060,DRU35760,DRU38260,DRU12890,DRU15390,DRU17990,DRU20490,DRU23090,DRU25590,DRU28090,DRU30690,DRU33090,DRU35790,DRU38290,DRU128120,DRU153120,DRU179120,DRU204120,DRU230120,DRU255120,DRU280120,DRU306120,DRU330120,DRU357120,DRU382120,DRU128150,DRU153150,DRU179150,DRU204150,DRU230150,DRU255150,DRU280150,DRU306150,DRU330150,DRU357150,DRU382150 2 | 0,0,3,0,0,0,0,3,3,3,3,0,3,3,0,1,0,0,3,3,3,0,0,3,3,2,0,0,3,3,3,3,0,1,3,3,0,1,0,3,3,0,3,0,0,3,3,3,2,0,3,3,0,0,0,0,3,3,3,0,0,0,3,0,0,0 3 | 0,3,0,3,3,3,3,0,0,1,1,0,0,0,3,3,3,3,1,1,0,1,1,3,3,3,3,3,3,0,0,0,2,0,0,3,0,3,3,3,3,0,1,0,0,0,0,3,3,3,3,0,1,0,0,0,0,0,0,3,3,3,3,0,3,0 4 | 3,3,3,3,0,0,3,3,3,3,0,3,3,3,3,0,0,0,0,3,0,0,0,3,3,3,0,0,0,0,3,0,0,3,3,3,3,0,0,0,3,0,0,0,0,0,3,3,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,3,0,0 5 | 0,3,3,0,0,0,0,0,0,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,3,0 6 | 0,0,3,3,3,3,3,3,0,0,2,1,0,0,3,3,3,3,3,3,3,0,1,0,0,0,3,3,3,3,0,0,1,2,3,0,0,3,3,3,3,2,0,1,3,0,3,3,3,3,3,0,0,1,0,0,3,3,3,3,3,3,3,2,0,0 7 | 0,0,0,0,0,0,1,0,0,0,0,0,0,0,3,0,0,3,0,0,0,0,0,3,1,3,0,0,0,3,0,0,0,0,2,0,0,0,0,0,3,3,0,0,0,0,3,2,2,0,1,1,2,1,0,0,3,0,3,0,0,3,1,2,0,0 8 | 0,0,0,1,0,0,0,3,0,3,0,0,3,3,3,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,3,0,0,0,0,0,0,0,0,0,3,0,3,0,0,0,3,3,3,0,0,3,0,0,0,0 9 | 0,3,0,3,3,2,2,0,0,0,0,3,3,0,0,3,2,0,0,0,0,0,0,3,0,0,2,2,3,0,3,3,0,3,3,0,0,0,2,3,0,0,3,0,3,3,0,0,3,2,3,3,0,0,3,0,0,0,0,3,2,3,0,0,0,3 10 | 0,0,3,3,3,0,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,2,0,0,0,3,3,0,0,0,0,0,0,2,0,0,0,0,3,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,3 11 | 3,3,0,3,0,0,0,3,3,0,3,3,3,3,3,0,0,3,3,3,0,0,3,0,3,3,3,0,3,0,3,2,0,3,3,3,3,0,0,0,3,3,0,3,0,0,2,0,0,0,0,3,3,3,3,0,3,0,0,0,0,0,3,3,0,3 12 | 3,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,3,0,3,3,0,0,0,2,0,0,0,2,0,0 13 | 3,3,0,0,0,0,0,0,0,2,0,3,3,3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0,3,0,3,0,0,0,0,3,3,0,0,0,0,0,0,3,3,3,0,3 14 | 1,0,3,0,3,0,0,0,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,3,0,3,0,2,3,0,1,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,3,0,0,0,3,3,0,0,3 15 | -------------------------------------------------------------------------------- /permute/data/npc/autofluorescence/micro.csv: -------------------------------------------------------------------------------- 1 | MICRO1280,MICRO1530,MICRO1790,MICRO2040,MICRO2300,MICRO2550,MICRO2800,MICRO3060,MICRO3300,MICRO3570,MICRO3820,MICRO12830,MICRO15330,MICRO17930,MICRO20430,MICRO23030,MICRO25530,MICRO28030,MICRO30630,MICRO33030,MICRO35730,MICRO38230,MICRO12860,MICRO15360,MICRO17960,MICRO20460,MICRO23060,MICRO25560,MICRO28060,MICRO30660,MICRO33060,MICRO35760,MICRO38260,MICRO12890,MICRO15390,MICRO17990,MICRO20490,MICRO23090,MICRO25590,MICRO28090,MICRO30690,MICRO33090,MICRO35790,MICRO38290,MICRO128120,MICRO153120,MICRO179120,MICRO204120,MICRO230120,MICRO255120,MICRO280120,MICRO306120,MICRO330120,MICRO357120,MICRO382120,MICRO128150,MICRO153150,MICRO179150,MICRO204150,MICRO230150,MICRO255150,MICRO280150,MICRO306150,MICRO330150,MICRO357150,MICRO382150 2 | 13,11,12,14,8,14,8,9,11,10,13,17,13,14,15,13,14,15,16,11,18,16,16,20,18,15,12,14,11,11,10,9,15,17,18,17,9,11,14,8,12,6,14,10,19,16,14,9,8,14,7,13,10,11,14,16,18,9,9,8,14,5,14,14,15,12 3 | 16,14,10,6,8,10,10,14,14,14,14,18,16,16,8,10,10,12,14,14,10,14,14,14,14,10,6,10,10,12,12,14,16,14,16,12,12,6,10,11,10,14,12,14,12,14,16,12,6,10,10,14,12,14,12,12,16,16,12,12,10,11,12,14,16,16 4 | 12,8,8,11,9,11,15,13,10,17,13,14,4,8,7,9,11,12,12,10,15,15,14,11,4,10,11,11,3,17,14,13,16,14,13,0,12,15,11,13,13,11,12,13,13,16,9,7,11,11,11,7,11,12,14,13,16,11,16,11,11,11,8,11,9,17 5 | 17,20,18,19,14,19,20,20,20,19,20,19,20,20,20,18,19,20,20,20,20,20,20,20,20,15,19,19,17,18,19,19,15,20,18,20,19,20,19,17,14,19,20,16,19,19,20,20,19,19,18,14,18,19,16,20,20,20,20,20,19,12,17,19,19,18 6 | 20,16,17,8,5,5,6,15,18,18,19,19,18,19,13,7,6,3,13,17,16,17,17,19,18,13,12,6,6,7,16,15,15,18,12,14,13,10,6,3,7,17,16,17,20,17,15,13,9,6,5,10,15,17,19,18,18,14,9,7,6,5,6,13,16,18 7 | 18,20,16,20,20,20,20,20,16,18,18,20,10,10,14,16,20,20,16,18,20,20,18,16,18,16,20,20,20,18,16,16,14,20,18,20,20,16,20,12,14,16,20,14,16,18,20,18,16,20,14,14,18,20,16,20,20,20,18,20,20,16,16,18,18,18 8 | 20,20,13,7,1,5,2,12,20,20,19,20,20,10,3,3,5,10,15,19,20,20,20,17,14,7,6,5,11,16,17,19,18,20,20,17,17,5,5,6,16,20,20,17,20,20,20,14,6,5,5,12,14,18,20,20,19,15,17,10,5,4,8,19,20,20 9 | 16,17,18,12,5,12,12,18,18,19,18,16,18,19,18,6,12,10,16,13,18,16,16,16,15,19,9,12,9,7,5,5,7,0,0,3,8,13,12,8,10,10,8,12,10,12,15,16,18,12,9,7,12,8,0,15,18,16,17,15,12,4,18,13,14,7 10 | 9,8,4,3,1,5,11,18,16,16,12,11,13,8,4,3,5,15,15,15,13,14,2,10,10,8,4,5,9,13,15,11,10,12,8,8,0,6,5,12,11,11,10,7,11,13,14,11,7,5,5,11,12,9,5,14,17,14,15,12,5,0,6,9,12,10 11 | 12,7,4,0,2,4,7,9,14,14,13,13,0,0,2,4,4,6,8,4,17,10,9,9,5,0,7,4,8,6,11,11,12,6,0,0,0,6,4,2,2,4,4,10,10,6,0,6,2,4,7,1,2,8,10,14,11,4,12,6,4,7,5,0,10,9 12 | 17,20,20,20,20,19,20,20,20,20,20,20,18,20,20,20,19,20,19,20,20,20,16,20,17,17,20,19,19,14,20,19,10,13,13,13,18,20,19,17,20,19,18,16,17,19,16,14,20,19,18,20,19,17,14,15,20,20,17,20,19,20,20,19,17,18 13 | 14,9,12,7,10,10,15,15,17,15,18,12,12,9,10,8,10,17,16,17,16,18,17,18,13,15,9,10,14,16,16,14,18,14,16,18,14,8,10,8,13,13,16,13,15,18,20,14,10,10,9,10,10,11,11,14,17,16,18,15,10,2,6,8,13,9 14 | 17,18,15,16,14,10,12,15,16,14,18,17,16,15,16,14,10,16,15,16,17,16,17,18,18,17,11,10,11,17,17,15,16,18,18,16,14,12,10,16,15,15,14,11,18,18,15,15,11,10,10,14,14,14,14,15,14,13,16,9,10,12,14,17,15,13 15 | -------------------------------------------------------------------------------- /permute/data/npc/autofluorescence/oct.csv: -------------------------------------------------------------------------------- 1 | OCT1280,OCT1530,OCT1790,OCT2040,OCT2300,OCT2550,OCT2800,OCT3060,OCT3300,OCT3570,OCT3820,OCT12830,OCT15330,OCT17930,OCT20430,OCT23030,OCT25530,OCT28030,OCT30630,OCT33030,OCT35730,OCT38230,OCT12860,OCT15360,OCT17960,OCT20460,OCT23060,OCT25560,OCT28060,OCT30660,OCT33060,OCT35760,OCT38260,OCT12890,OCT15390,OCT17990,OCT20490,OCT23090,OCT25590,OCT28090,OCT30690,OCT33090,OCT35790,OCT38290,OCT128120,OCT153120,OCT179120,OCT204120,OCT230120,OCT255120,OCT280120,OCT306120,OCT330120,OCT357120,OCT382120,OCT128150,OCT153150,OCT179150,OCT204150,OCT230150,OCT255150,OCT280150,OCT306150,OCT330150,OCT357150,OCT382150 2 | 302,300,246,242,246,205,224,175,189,205,189,298,259,234,271,216,199,259,283,269,255,271,281,326,320,281,240,203,236,244,234,246,246,287,281,224,212,207,175,138,248,248,236,263,289,289,210,173,195,152,162,214,279,322,333,312,328,257,167,193,203,234,312,328,326,320 3 | 287,294,294,269,193,99,181,236,265,267,261,277,281,281,234,191,101,187,255,259,277,279,261,281,291,287,158,105,244,263,285,265,263,259,281,273,246,203,105,167,236,261,277,279,250,267,273,269,140,99,185,250,253,285,283,251,259,267,177,113,107,199,216,279,289,287 4 | 246,251,236,236,246,242,234,255,275,267,259,261,273,257,259,255,236,234,257,269,271,267,289,302,248,304,261,238,242,269,259,263,246,250,236,244,244,250,248,234,248,267,257,244,257,279,273,277,271,253,236,244,261,285,273,265,269,275,273,246,257,259,257,238,261,257 5 | 259,265,269,269,201,132,234,271,285,277,267,251,251,250,269,248,173,148,240,269,281,281,251,267,285,279,228,136,201,267,271,275,267,250,269,275,273,218,136,197,267,275,281,275,259,269,273,271,197,134,201,269,267,269,263,269,275,279,281,242,146,166,263,267,265,259 6 | 263,265,234,222,193,134,167,208,257,253,234,257,265,259,207,128,103,138,224,251,250,246,250,265,265,244,175,111,132,201,250,255,250,234,246,269,251,177,97,148,248,271,257,244,214,220,228,212,183,152,205,248,255,267,255,238,242,251,248,214,158,216,236,265,259,253 7 | 296,291,281,259,191,173,203,232,240,251,246,298,292,246,228,166,162,214,271,279,279,263,296,289,291,263,185,179,242,263,294,281,267,283,289,279,251,181,193,251,291,302,294,285,267,279,279,267,214,173,228,269,289,287,287,251,271,281,271,232,171,177,242,283,292,296 8 | 251,255,224,162,132,185,208,248,287,281,273,269,275,253,212,144,156,203,253,289,289,272,261,275,259,232,169,126,222,261,275,283,269,246,277,279,251,216,187,218,279,292,279,263,261,281,283,251,183,167,187,250,263,255,251,273,281,291,259,185,152,150,244,250,263,261 9 | 242,220,167,126,156,197,226,244,251,250,246,261,242,228,207,199,207,222,234,234,234,236,257,267,244,210,148,117,128,191,226,248,236,230,242,251,246,228,195,152,134,169,214,236,242,246,251,242,222,164,125,119,181,236,228,255,257,263,257,234,203,132,130,181,238,273 10 | 250,246,240,214,156,156,230,273,289,291,289,261,267,257,234,197,140,179,257,279,289,283,244,271,285,265,201,154,191,263,279,279,275,251,275,277,273,220,164,187,253,269,277,283,269,283,281,263,230,142,158,246,265,265,253,285,289,279,257,197,142,156,216,240,253,248 11 | 253,240,265,240,226,283,322,285,298,292,287,257,275,259,263,289,236,304,281,285,298,285,257,296,337,347,341,335,314,304,396,292,281,351,365,369,361,371,330,318,314,296,285,259,347,369,367,376,357,244,298,285,279,263,244,296,298,306,349,341,205,281,269,267,273,263 12 | 269,281,275,240,199,169,199,236,251,251,238,318,304,267,242,191,167,193,236,253,255,246,255,257,248,216,173,167,216,257,263,269,253,224,242,253,234,179,162,216,255,287,294,285,240,248,244,240,183,167,203,257,375,302,279,265,275,248,216,183,187,232,257,277,277,267 13 | 261,265,273,255,275,306,308,314,298,291,289,257,275,296,296,316,316,322,324,306,306,277,251,300,318,348,375,298,312,310,310,320,310,269,296,296,294,294,312,308,310,308,285,263,257,279,287,383,285,304,302,294,277,271,253,294,300,283,298,296,306,306,300,273,267,267 14 | 250,253,257,271,238,189,207,251,259,275,273,240,265,273,265,210,171,205,259,287,287,277,250,273,281,279,226,228,253,267,281,277,273,265,281,281,285,179,181,246,271,277,265,236,269,279,283,259,179,169,242,277,283,269,253,271,281,275,277,207,158,216,244,257,253,242 15 | -------------------------------------------------------------------------------- /permute/data/npc/autofluorescence/pigment.csv: -------------------------------------------------------------------------------- 1 | PIG1280,PIG1530,PIG1790,PIG2040,PIG2300,PIG2550,PIG2800,PIG3060,PIG3300,PIG3570,PIG3820,PIG12830,PIG15330,PIG17930,PIG20430,PIG23030,PIG25530,PIG28030,PIG30630,PIG33030,PIG35730,PIG38230,PIG12860,PIG15360,PIG17960,PIG20460,PIG23060,PIG25560,PIG28060,PIG30660,PIG33060,PIG35760,PIG38260,PIG12890,PIG15390,PIG17990,PIG20490,PIG23090,PIG25590,PIG28090,PIG30690,PIG33090,PIG35790,PIG38290,PIG128120,PIG153120,PIG179120,PIG204120,PIG230120,PIG255120,PIG280120,PIG306120,PIG330120,PIG357120,PIG382120,PIG128150,PIG153150,PIG179150,PIG204150,PIG230150,PIG255150,PIG280150,PIG306150,PIG330150,PIG357150,PIG382150 2 | 1,1,1,1,0,1,1,1,1,1,0,0,1,1,0,0,1,1,0,1,0,1,1,0,0,0,1,1,0,1,1,1,0,0,0,0,1,0,1,0,1,0,0,1,0,1,1,1,0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,0 3 | 0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0,1,0 4 | 1,1,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,1,0,0,0 5 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1 6 | 0,1,1,1,1,1,1,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,0,1,1,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,1,0,0,1,1,1,1,1,1,0 7 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8 | 0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,0 9 | 0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0 10 | 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 11 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 13 | 0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0 14 | 0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 15 | -------------------------------------------------------------------------------- /permute/data/npc/botulinum.csv: -------------------------------------------------------------------------------- 1 | paz,tempo,Time,farmaco,LTA,RTA,LTP,RTP,LMM,RMM,LTA11,RTA11,LMM11,RMM11,LTA11c,RTA11c,LMM11c,RMM11c,CM,DM,DF,DR,LF,Mas,Maf,Mp,Mld,Mls 2 | Paz. 1,time 0,0,botox,7.9,10.1,10.2,8.8,14.6,4.7,140,114,186,110,154,123,219,144,10,9,3,0,2,50,54,5,9,8 3 | Paz. 2,time 0,0,sol_fisio,6.8,5.2,3.8,4.4,4.5,5.1,255,292,258,284,232,271,242,257,9,8,0,5,2,35,41,8,9,8 4 | Paz. 3,time 0,0,botox,5.9,6.3,9.5,6.3,3.1,3.3,139,94,95,108,84,53,66,61,5,6,4,0,2,28,38,7,13,12 5 | Paz. 4,time 0,0,botox,5,4.3,11,14,2.6,4.7,155,161,139,146,72,126,100,195,5,7,8,7,2,40,45,2,12,11 6 | Paz. 5,time 0,0,sol_fisio,17,7.6,4.1,2,3.6,2.7,77,134,166,101,108,211,258,219,6,5,0,7,2,40,47,5,9,11 7 | Paz. 6,time 0,0,sol_fisio,1.9,4.1,3.3,3,2,3.3,128,125,101,97,142,137,122,158,10,5,3,0,1,47,50,9,11,10 8 | Paz. 7,time 0,0,sol_fisio,3.3,4.6,2.4,3.2,3.8,3.6,173,157,218,180,198,176,303,286,7,5,2,6,2,38,42,7,8,8 9 | Paz. 8,time 0,0,botox,5.3,7.6,6,11.8,5.1,2,53,83,63,43,,,,,10,0,0,0,1,49,50,6,12,8 10 | Paz. 9,time 0,0,botox,3.9,4,17.1,10.2,1.8,6.8,20,29,23,54,16,31,26,62,5,6,4,5,3,52,56,4,10,6 11 | Paz. 10,time 0,0,sol_fisio,2.7,3.8,10.3,2,4.6,2.9,76,86,144,157,58,59,87,172,6,7,4,5,3,34,39,5,7,6 12 | Paz. 11,time 0,0,sol_fisio,3.3,2.9,10.1,5.1,1.9,2.2,127,201,130,136,146,217,141,167,8,2,2,5,1,39,42,4,8,8 13 | Paz. 12,time 0,0,botox,3.4,3.7,4.4,7.8,7.5,4.4,96,104,69,74,58,55,64,61,8,4,0,8,2,44,50,0,15,14 14 | Paz. 13,time 0,0,botox,4.7,5,8.8,6.3,2.9,2.6,106,180,299,267,130,248,325,294,8,8,9,9,3,40,46,10,9,11 15 | Paz. 14,time 0,0,botox,5.3,4.6,19.7,16.6,3.2,4.2,293,251,217,280,349,323,201,341,10,10,0,6,2,50,54,7,9,11 16 | Paz. 15,time 0,0,sol_fisio,5.9,1.5,4.1,4,1.8,2.7,188,138,300,322,180,137,333,337,10,0,0,0,0,65,68,7,8,7 17 | Paz. 16,time 0,0,botox,5.7,3.4,4.9,2.8,4.1,3.1,169,207,217,169,194,154,221,189,6,6,6,8,4,50,52,11,10,11 18 | Paz. 17,time 0,0,sol_fisio,8.1,4.8,8.4,8.5,4.8,2.9,150,92,85,108,137,82,108,118,7,2,2,1,1,50,53,5,10,8 19 | Paz. 18,time 0,0,sol_fisio,19.3,11.4,34.3,13.4,2.3,5.1,83,85,113,98,81,86,88,90,10,0,0,8,3,50,54,6,9,11 20 | Paz. 19,time 0,0,sol_fisio,3,6.9,4.5,11.2,11.7,9.8,22,36,74,70,53,61,82,68,7,7,0,2,4,40,44,6,9,9 21 | Paz. 20,time 0,0,botox,4.2,9.5,13.3,5.6,2,1.7,125,189,157,165,129,216,219,222,10,6,0,7,2,60,62,2,10,9 22 | Paz. 1,1 week,1,botox,8.5,10.4,10.4,6.6,2.5,8.6,19,59,41,32,20,69,57,39,9,5,0,0,1,51,57,5,9,9 23 | Paz. 2,1 week,1,sol_fisio,6,3.8,3.8,3.8,5.3,3.9,190,202,250,154,146,197,238,200,9,6,0,5,1,37,41,8,9,9 24 | Paz. 3,1 week,1,botox,5.4,2.9,7.4,14.6,1.5,1.9,89,73,30,44,,,,,6,6,4,0,1,26,32,7,15,16 25 | Paz. 4,1 week,1,botox,5.4,4.1,6.9,5.3,3.2,8.5,109,142,85,168,,,,,6,7,6,4,3,38,45,0,10,8 26 | Paz. 5,1 week,1,sol_fisio,14.5,6.9,3.7,3.7,2.1,2.5,75,71,94,50,155,203,185,165,6,4,0,5,2,42,47,6,9,10 27 | Paz. 6,1 week,1,sol_fisio,3.1,6.5,4.4,1.6,1.7,2.2,95,121,99,59,136,181,207,159,10,5,2,0,1,46,49,10,11,9 28 | Paz. 7,1 week,1,sol_fisio,3.1,3.8,3,3.5,3.7,3.7,93,94,191,185,75,53,211,212,5,6,2,5,2,35,40,7,8,7 29 | Paz. 8,1 week,1,botox,2.4,17.7,14.7,6,2.2,3,74,113,18,27,,,,,10,0,0,0,0,48,50,7,14,10 30 | Paz. 9,1 week,1,botox,3.5,3.7,12.7,7.6,2.5,2.4,19,31,0,23,,,,,4,6,6,6,2,55,57,6,12,8 31 | Paz. 10,1 week,1,sol_fisio,4.9,2.8,7.3,2.3,4.3,4.6,80,104,82,60,68,92,130,87,6,7,4,5,3,33,39,5,6,6 32 | Paz. 11,1 week,1,sol_fisio,2,1.1,17.2,8.4,1.1,3.1,78,201,114,131,131,288,161,207,8,2,2,3,1,37,41,4,8,7 33 | Paz. 12,1 week,1,botox,3.7,2.2,10.3,6.8,4.7,2.6,12,9,0,15,14,9,0,14,4,0,0,4,3,43,52,0,15,16 34 | Paz. 13,1 week,1,botox,2.6,2.3,13.6,3.9,0.9,1.9,91,82,107,131,63,46,79,111,8,6,6,8,3,43,48,14,13,12 35 | Paz. 14,1 week,1,botox,4.6,4.8,9.4,11.2,2.6,2.5,199,106,181,201,152,77,160,170,9,10,0,10,2,50,53,7,10,9 36 | Paz. 15,1 week,1,sol_fisio,4.4,2.7,4.7,4.3,1.6,1.4,252,168,310,337,212,163,277,282,9,0,0,0,1,63,65,8,11,9 37 | Paz. 16,1 week,1,botox,5.1,2.6,8.7,2,2.7,2.4,69,34,31,38,67,33,30,45,5,6,6,7,4,51,52,10,9,10 38 | Paz. 17,1 week,1,sol_fisio,3.2,4.7,9.7,6.4,2.8,7.7,139,155,55,90,119,122,96,113,7,1,1,1,1,50,54,5,10,9 39 | Paz. 18,1 week,1,sol_fisio,20.3,9.9,27.1,6.8,2.1,4.8,45,109,32,32,112,121,71,47,10,0,0,6,3,50,53,6,9,10 40 | Paz. 19,1 week,1,sol_fisio,3.5,2.4,3.6,7.9,2.6,2.5,15,26,17,18,31,41,19,18,7,7,0,0,3,41,44,7,9,9 41 | Paz. 20,1 week,1,botox,4.9,6.9,9.7,3.8,2.5,1.6,42,41,83,93,50,39,97,116,10,6,0,7,2,62,64,4,10,9 42 | Paz. 1,1 month,2,botox,4.6,6.2,4,2,3.2,2.4,19,42,42,22,21,48,52,34,10,0,0,0,0,51,59,6,15,12 43 | Paz. 2,1 month,2,sol_fisio,6,5,7.6,4.6,4.5,3.7,113,137,154,96,129,158,207,140,9,8,0,5,2,34,40,7,9,9 44 | Paz. 3,1 month,2,botox,3.5,2.9,7.2,10.4,1.3,2.5,50,32,27,26,,,,,8,5,2,0,0,27,38,7,14,16 45 | Paz. 4,1 month,2,botox,3.2,4.8,12.2,6.3,2.2,2.6,78,129,89,126,,,,,5,4,2,6,2,37,43,2,8,9 46 | Paz. 5,1 month,2,sol_fisio,13.7,9.3,2.6,3.8,3,6.5,135,145,103,67,162,195,174,114,6,5,0,7,2,39,46,5,8,9 47 | Paz. 6,1 month,2,sol_fisio,1.5,3.4,2.5,2.2,1.4,1.4,91,183,49,75,160,275,75,133,10,4,2,0,1,48,50,10,10,10 48 | Paz. 7,1 month,2,sol_fisio,4.7,4.3,5.3,1.9,2.2,2.9,170,221,207,282,119,144,214,254,8,4,0,6,2,39,43,7,9,7 49 | Paz. 8,1 month,2,botox,2.3,3.3,6.3,2.7,4.2,3.6,48,34,19,25,,,,,8,2,0,0,1,42,47,8,10,8 50 | Paz. 9,1 month,2,botox,3.3,4.4,2.5,4.6,2.6,1.3,27,30,0,15,,,,,3,5,3,4,2,53,55,3,12,7 51 | Paz. 10,1 month,2,sol_fisio,3.3,6.3,3.5,3.9,5.4,4.2,291,293,283,275,199,238,183,218,7,5,4,5,3,35,38,5,7,7 52 | Paz. 11,1 month,2,sol_fisio,3.9,4.3,11.6,6.5,1.3,1.8,190,202,250,154,146,197,238,200,8,2,2,5,1,40,42,4,8,8 53 | Paz. 12,1 month,2,botox,2.5,1.9,7.3,10.7,3.6,2.3,10,7,10,11,9,9,8,10,6,0,0,0,2,45,54,0,15,15 54 | Paz. 13,1 month,2,botox,1.9,2.6,5.6,3.8,2.7,2.7,79,17,17,14,66,13,24,19,5,5,4,6,2,48,51,12,12,15 55 | Paz. 14,1 month,2,botox,2.3,2.7,24.8,24.6,2,1.8,95,39,42,82,107,39,43,91,7,3,0,0,1,50,55,9,11,10 56 | Paz. 15,1 month,2,sol_fisio,4.3,1.8,6.9,6.9,2.4,4.1,222,139,317,313,208,116,334,316,9,0,0,0,1,64,65,8,11,10 57 | Paz. 16,1 month,2,botox,1.4,1.2,7.3,6.5,1.7,1.1,48,30,13,9,61,21,43,17,4,7,7,4,3,51,53,10,9,10 58 | Paz. 17,1 month,2,sol_fisio,4.6,4.4,10.7,6.5,6.9,4.4,75,79,87,125,71,82,107,123,7,2,2,2,1,49,55,6,10,8 59 | Paz. 18,1 month,2,sol_fisio,15.3,9.2,32.6,8.8,2.5,3.1,49,67,31,35,68,90,52,56,10,0,0,6,2,51,54,7,10,11 60 | Paz. 19,1 month,2,sol_fisio,2.5,3.6,12.9,9.6,4.5,3.7,60,57,17,22,76,83,24,30,8,7,0,1,3,40,44,7,10,9 61 | Paz. 20,1 month,2,botox,5.8,3.3,10.7,3.3,3.1,2.7,37,28,74,76,,,,,8,5,0,5,2,62,65,5,10,10 62 | Paz. 1,6 months,3,botox,4.9,6.6,5.7,5.6,3.3,2.6,97,131,133,111,94,125,152,135,10,0,0,0,1,50,58,5,12,10 63 | Paz. 2,6 months,3,sol_fisio,8.4,4.4,5.5,4.5,5.7,4.7,293,251,277,290,349,323,291,321,9,8,0,5,2,35,39,6,9,8 64 | Paz. 3,6 months,3,botox,4.5,5.1,6,3.5,2.7,3.3,88,93,130,128,,,,,7,5,0,3,1,33,37,9,11,13 65 | Paz. 4,6 months,3,botox,5.8,7.6,11.8,5.7,5.4,2.2,78,115,62,144,,,,,5,6,5,4,3,40,47,0,9,9 66 | Paz. 5,6 months,3,sol_fisio,5.9,6.2,9.6,12.2,3,4.4,62,118,28,60,58,110,51,65,6,6,0,7,2,40,47,6,9,11 67 | Paz. 6,6 months,3,sol_fisio,1.2,1.5,2.3,3.8,1.5,1.3,115,88,54,80,137,157,141,117,10,5,2,0,1,46,49,9,11,10 68 | Paz. 7,6 months,3,sol_fisio,6,3.3,3,3.1,3.2,4.2,138,171,243,263,116,160,265,272,5,6,2,7,3,38,42,7,9,8 69 | Paz. 8,6 months,3,botox,3.1,4.3,8.9,6.7,5.4,4,78,61,24,27,127,118,97,82,9,1,0,0,0,48,50,7,13,10 70 | Paz. 9,6 months,3,botox,3.2,2.6,1.8,9.8,3.3,1.3,93,187,172,21,90,161,93,17,4,4,4,5,3,56,59,8,11,9 71 | Paz. 10,6 months,3,sol_fisio,2.4,2.4,4,4.7,3,1.8,131,67,93,101,97,43,82,82,5,7,4,7,3,33,37,4,6,6 72 | Paz. 11,6 months,3,sol_fisio,4.8,1.7,7.2,3.9,1.8,1.9,113,137,154,96,129,158,207,140,8,4,2,5,1,38,42,4,7,8 73 | Paz. 12,6 months,3,botox,3.7,6.9,5.6,4.4,4.2,3.9,62,118,28,60,58,110,51,65,8,0,0,5,1,46,50,0,15,15 74 | Paz. 13,6 months,3,botox,4.7,3.7,3.3,2.1,2.7,2.8,57,123,98,169,17,63,67,137,8,5,4,4,2,49,55,12,12,15 75 | Paz. 14,6 months,3,botox,4.9,3.5,9.6,8.4,2.2,2,230,140,183,225,327,283,261,305,9,4,0,0,2,52,56,10,11,10 76 | Paz. 15,6 months,3,sol_fisio,5.2,2,6.6,5.7,3.3,1.8,247,311,350,360,257,298,347,348,9,0,0,0,0,63,65,8,11,9 77 | Paz. 16,6 months,3,botox,4.9,4.9,4.6,2.4,2.2,2.8,108,210,191,233,96,199,179,235,6,6,6,7,4,50,52,10,10,11 78 | Paz. 17,6 months,3,sol_fisio,3.4,4.4,11.1,9.1,2.7,4.5,106,138,85,118,109,143,89,129,6,4,2,2,1,50,53,5,10,9 79 | Paz. 18,6 months,3,sol_fisio,18,5.9,12.8,2.5,2.4,1.7,89,111,22,44,,,,,10,0,0,6,2,51,52,7,9,10 80 | Paz. 19,6 months,3,sol_fisio,5.8,4.6,12.5,8.6,3.8,4.1,49,67,31,35,68,90,52,56,7,7,0,2,4,41,44,7,8,9 81 | Paz. 20,6 months,3,botox,6.6,6.4,8.1,11.2,3.9,3.7,74,106,140,128,70,124,158,157,8,5,0,8,2,60,61,5,10,8 82 | -------------------------------------------------------------------------------- /permute/data/npc/chrom17m.csv: -------------------------------------------------------------------------------- 1 | Groups,Cases,Controls 2 | A,19,35 3 | B,1,1 4 | C,51,29 5 | D,3,6 6 | E,4,5 7 | F,6,3 8 | G,29,29 9 | H,25,38 10 | I,6,5 11 | J,0,2 12 | -------------------------------------------------------------------------------- /permute/data/npc/confocal.csv: -------------------------------------------------------------------------------- 1 | PAT_ID,FU_BA,T_NT,CELLULAR_DENSITY,POLIMEGATISM,PLEOMORPHISM,dens,P F,PBE,PBI,PT,EPITHELIUM_THICKNESS,1to10,11to33,34to66,67to90,91to100 2 | 1,FU,T,2734,31.9,57.3,9931.409091,5,14,2,1,53,345,413,437,399,367 3 | 2,FU,T,2226,26.3,62.5,9422.636364,4,13,1,1,51,338,353,352,398,275 4 | 3,FU,T,3338,35.5,44.3,5472.409091,2,5,1,2,51,422,359,337,392,276 5 | 4,FU,T,2394,27.9,73.3,10258.18182,5,10,1,2,54,400,393,336,351,330 6 | 5,FU,T,2531,24.9,60.5,2237.772727,1,7,1,2,53,443,398,436,413,306 7 | 6,FU,T,2842,25.5,50.5,4868.5,3,8,1,2,54,346,420,377,336,289 8 | 7,FU,T,3130,34.5,41.7,3706.181818,1,9,1,1,47,398,352,313,359,224 9 | 8,FU,T,2830,38.3,44.6,7077.318182,3,5,1,1,52,383,359,367,315,276 10 | 9,FU,T,2578,36.5,53.1,6705.045455,3,6,0,2,58,359,353,345,359,330 11 | 10,FU,T,2919,38.2,46.8,7408.227273,2,11,2,2,57,330,359,405,406,299 12 | 11,FU,T,2615,36.2,36.5,6924.272727,2,11,1,2,52,452,306,336,300,270 13 | 12,FU,T,2755,36,34.1,5393.818182,3,12,1,1,51,399,383,359,336,268 14 | 13,FU,T,2709,34.8,34.5,5819.863636,1,10,1,2,50,344,359,397,368,222 15 | 14,FU,T,2979,30.3,54.6,3875.772727,1,8,1,2,55,428,443,474,405,375 16 | 15,FU,T,3629,31.5,52.5,9621.181818,2,9,2,3,51,390,398,406,291,280 17 | 16,FU,T,2689,30.1,60.2,,,,,,57,436,428,443,332,293 18 | 17,FU,T,2539,27.2,57,5124.954545,2,7,1,1,52,391,321,346,392,367 19 | 18,FU,T,2712,31,54,12454.59091,7,11,1,1,53,361,329,337,407,291 20 | 19,FU,T,2743,39.7,42.5,4368,2,12,2,3,52,445,407,421,436,337 21 | 20,FU,T,2641,22.4,66.3,4798.181818,2,13,1,2,54,398,467,443,352,199 22 | 21,FU,T,2651,32.7,56,4016.409091,6,13,1,2,55,384,421,453,352,390 23 | 22,FU,T,2802,35.4,47.2,8496.090909,4,10,1,1,57,528,443,459,466,375 24 | 23,FU,T,2655,30.3,52.4,6680.227273,2,8,1,2,50,466,489,428,283,270 25 | 24,FU,T,3054,43.8,33.7,9464,6,12,2,1,50,268,336,268,352,283 26 | 25,FU,T,3479,30.1,60.5,6725.727273,3,13,2,2,65,367,382,382,392,284 27 | 26,FU,T,2579,26.7,60.7,,,,,,50,459,444,460,543,498 28 | 27,FU,T,3101,33,51.5,6188,3,8,2,1,52,413,382,375,405,336 29 | 28,FU,T,2662,31.4,55.7,9703.909091,4,12,1,2,57,329,321,421,360,275 30 | 1,FU,NT,2684,33.3,52.9,7883.909091,5,11,1,1,60,414,392,405,452,437 31 | 2,FU,NT,2573,28,63.3,6791.909091,3,13,1,1,59,359,405,378,414,336 32 | 3,FU,NT,3213,40.5,33.6,3114.681818,2,7,2,2,50,414,337,313,375,275 33 | 4,FU,NT,2461,26.9,64.9,5265.590909,2,6,1,2,50,376,359,330,345,269 34 | 5,FU,NT,2552,31.1,55.1,6729.863636,3,8,1,3,54,329,336,360,360,344 35 | 6,FU,NT,2660,24.4,61.4,2328.772727,1,5,1,1,55,414,393,399,299,275 36 | 7,FU,NT,2751,32.7,47.8,2548,1,9,1,1,53,383,346,338,352,270 37 | 8,FU,NT,2840,39.7,38.8,5327.636364,3,6,1,1,53,361,346,398,375,275 38 | 9,FU,NT,2617,27.7,48.2,2804.454545,1,6,0,2,54,383,386,359,376,283 39 | 10,FU,NT,3063,35.1,55,4740.272727,2,12,1,1,52,375,336,313,397,269 40 | 11,FU,NT,2813,35.2,40.2,3172.590909,1,6,0,1,50,336,321,330,321,283 41 | 12,FU,NT,2648,28.9,41.8,7747.409091,2,9,1,1,56,367,374,398,391,330 42 | 13,FU,NT,2685,35.5,47.6,4901.590909,2,9,2,1,55,352,375,329,291,275 43 | 14,FU,NT,2828,29.6,56.8,4099.136364,30,7,1,2,55,330,390,436,414,361 44 | 15,FU,NT,3362,31.1,43.4,11143.36364,4,9,2,1,59,377,383,382,392,283 45 | 16,FU,NT,2785,32.2,71.1,2498.363636,1,6,0,2,54,459,399,430,393,188 46 | 17,FU,NT,2595,31.7,54.8,3453.863636,2,7,1,2,52,391,377,352,291,276 47 | 18,FU,NT,2645,29.2,62.4,11921,4,13,2,2,55,370,353,390,398,268 48 | 19,FU,NT,2688,37.4,44.8,5733,3,11,2,3,56,387,374,369,330,291 49 | 20,FU,NT,2672,28,50.6,10729.72727,5,13,2,2,54,528,482,490,429,329 50 | 21,FU,NT,2704,29.6,58.3,3991.590909,3,8,1,3,52,423,389,428,443,390 51 | 22,FU,NT,2773,33.2,37.6,11226.09091,4,9,1,2,58,482,428,451,467,405 52 | 23,FU,NT,2403,26,61.5,10862.09091,6,11,1,2,52,398,405,474,436,428 53 | 24,FU,NT,3062,33.8,49,5067.045455,2,12,1,2,55,344,298,298,275,268 54 | 25,FU,NT,3587,29.8,52.5,7751.545455,2,12,2,2,51,367,352,367,366,283 55 | 26,FU,NT,2604,24.4,69.1,,,,,,56,443,460,436,482,413 56 | 27,FU,NT,2856,32.9,49.5,6084.590909,3,14,1,2,56,436,421,421,421,475 57 | 28,FU,NT,2707,38,47.7,4715.454545,3,15,1,1,60,382,359,375,362,307 58 | 1,BASELINE,T,3274,41.1,35.9,10589.09091,5,15,2,2,51,359,352,451,459,596 59 | 2,BASELINE,T,3074,35,36.8,15374.86364,7,16,1,1,45,413,421,405,406,443 60 | 3,BASELINE,T,3080,39.7,37,9745.272727,4,10,2,1,49,512,512,520,536,558 61 | 4,BASELINE,T,3129,46.1,47.1,11767.95455,4,14,1,1,47,461,471,476,483,536 62 | 5,BASELINE,T,3143,41.1,51.5,9037.954545,2,14,2,1,53,398,435,414,437,459 63 | 6,BASELINE,T,2864,42,49.5,14121.54545,9,12,1,1,55,413,468,466,428,428 64 | 7,BASELINE,T,2694,30.1,46.6,5526.181818,2,13,2,2,56,398,359,392,398,505 65 | 8,BASELINE,T,2870,28.1,71.1,4641,2,13,1,3,55,358,344,358,379,428 66 | 9,BASELINE,T,3168,45.6,47.1,4570.681818,2,11,1,2,48,398,367,405,420,444 67 | 10,BASELINE,T,2791,38.9,53.8,11610.77273,4,13,1,2,52,412,405,414,429,501 68 | 11,BASELINE,T,2832,36,45.1,8760.818182,3,15,1,3,50,391,383,375,375,428 69 | 12,BASELINE,T,2856,31.7,63,8570.545455,3,14,1,1,55,338,352,345,345,422 70 | 13,BASELINE,T,2771,38.3,49.4,11110.27273,4,13,1,1,58,315,323,324,330,405 71 | 14,BASELINE,T,3549,25.7,65.7,9401.954545,4,15,1,1,51,359,344,345,352,367 72 | 15,BASELINE,T,3314,33,64.2,9546.727273,4,11,2,2,48,367,360,367,382,438 73 | 16,BASELINE,T,2323,32.8,58.1,10088.59091,4,11,2,2,53,331,329,337,328,421 74 | 17,BASELINE,T,2918,35.4,38.5,9559.136364,4,13,1,3,47,421,405,408,443,474 75 | 18,BASELINE,T,2997,46.4,46,8661.545455,3,10,1,1,40,360,352,374,397,443 76 | 19,BASELINE,T,2812,34.2,49.4,12467,5,14,2,1,50,306,337,345,352,475 77 | 20,BASELINE,T,2598,44,56.5,10647,5,13,2,1,56,313,313,336,375,421 78 | 21,BASELINE,T,2827,35,49.4,8305.818182,5,14,2,2,51,288,248,275,281,309 79 | 22,BASELINE,T,3173,39.2,52.3,7743.272727,4,12,1,1,48,316,323,337,351,484 80 | 23,BASELINE,T,3145,38.7,45.3,9666.681818,4,15,1,1,54,375,359,382,382,444 81 | 24,BASELINE,T,3449,32.3,53.9,7689.5,3,14,1,1,57,338,398,375,375,518 82 | 25,BASELINE,T,2453,36.2,41.3,10808.31818,3,14,1,1,54,352,336,345,368,428 83 | 26,BASELINE,T,3406,34.2,50,15106,6,11,1,2,48,260,302,309,316,415 84 | 27,BASELINE,T,3150,38.6,36.4,3292.545455,3,10,0,2,56,359,352,359,375,407 85 | 28,BASELINE,T,2570,34.5,57.6,12487.68182,4,13,2,2,52,330,368,361,368,472 86 | 1,BASELINE,NT,2278,35.3,55.6,14948.81818,5,13,1,2,57,367,352,353,384,504 87 | 2,BASELINE,NT,2738,33.5,65.1,8760.818182,5,10,1,1,50,413,474,451,466,565 88 | 3,BASELINE,NT,2874,41.6,39.1,13195,5,12,2,2,53,459,467,459,452,507 89 | 4,BASELINE,NT,3439,43.1,40,9517.772727,4,15,2,2,52,520,505,535,543,591 90 | 5,BASELINE,NT,2930,34.9,47.2,13993.31818,5,11,1,2,50,458,513,504,489,513 91 | 6,BASELINE,NT,3123,41.1,41.9,6816.727273,3,12,0,1,50,405,398,398,405,535 92 | 7,BASELINE,NT,3110,38.2,48.5,5153.909091,3,12,1,1,53,375,413,443,436,466 93 | 8,BASELINE,NT,2864,25.7,55.6,6953.227273,5,10,1,1,54,416,401,405,420,451 94 | 9,BASELINE,NT,3489,35.1,38.3,3780.636364,2,10,1,1,47,308,313,328,331,389 95 | 10,BASELINE,NT,3011,42.7,45.3,11474.27273,1,12,1,2,52,360,367,375,375,391 96 | 11,BASELINE,NT,2087,32.6,56.6,8041.090909,4,11,2,1,54,390,375,383,390,399 97 | 12,BASELINE,NT,2822,28.1,54.9,14435.90909,6,9,2,2,50,344,375,406,414,573 98 | 13,BASELINE,NT,2791,32.5,62.6,15887.77273,5,13,1,1,54,391,352,398,413,507 99 | 14,BASELINE,NT,2940,34.8,62,17087.31818,7,15,1,2,58,359,391,398,398,558 100 | 15,BASELINE,NT,2704,26.6,48.2,6663.681818,4,10,1,2,47,375,367,398,405,475 101 | 16,BASELINE,NT,3209,35.6,42,15879.5,7,16,2,2,52,359,398,398,405,484 102 | 17,BASELINE,NT,2948,48.6,28.7,13480.40909,4,14,2,3,50,309,337,339,351,471 103 | 18,BASELINE,NT,2743,33.5,65.1,8760.818182,4,9,1,1,52,313,322,344,405,451 104 | 19,BASELINE,NT,2513,43.1,49.4,13960.22727,4,11,2,1,49,330,330,345,352,480 105 | 20,BASELINE,NT,3070,37.6,54.6,16566.13636,5,12,2,1,52,367,360,375,382,520 106 | 21,BASELINE,NT,3178,36.6,50,14890.90909,5,12,2,1,51,313,329,367,367,489 107 | 22,BASELINE,NT,2538,34,33.8,12218.81818,4,12,2,3,47,359,360,365,390,443 108 | 23,BASELINE,NT,2765,36.5,62.2,12280.86364,5,11,0,2,49,343,322,344,351,394 109 | 24,BASELINE,NT,2633,32.1,42.2,11205.40909,4,14,1,1,51,352,329,353,385,436 110 | 25,BASELINE,NT,2956,38.4,43.8,13625.18182,5,12,2,2,53,305,299,306,306,398 111 | 26,BASELINE,NT,2295,22,63.5,12016.13636,4,14,1,1,57,298,336,345,345,405 112 | 27,BASELINE,NT,2629,36.1,61.7,12545.59091,5,17,1,1,53,329,337,359,361,421 113 | 28,BASELINE,NT,2823,33.9,43.8,3714.454545,2,14,0,1,53,309,309,323,337,442 -------------------------------------------------------------------------------- /permute/data/npc/examples_chapters_1-4/fly.csv: -------------------------------------------------------------------------------- 1 | group,X1,X2,X3,X4,X5,X6,X7 2 | 0,85,41,31,13,25,9,8 3 | 0,87,38,32,14,22,13,13 4 | 0,94,44,36,15,27,8,9 5 | 0,92,43,32,17,28,9,9 6 | 0,96,43,35,14,26,10,10 7 | 0,91,44,36,12,24,9,9 8 | 0,90,42,36,16,26,9,9 9 | 0,92,43,36,17,26,9,9 10 | 0,91,41,36,14,23,9,9 11 | 0,87,38,35,11,24,9,10 12 | 0,97,45,39,17,27,9,10 13 | 0,89,38,36,13,22,9,9 14 | 0,94,45,37,13,26,9,9 15 | 0,96,44,37,14,24,9,10 16 | 0,104,49,35,14,21,10,10 17 | 0,94,41,31,17,26,10,9 18 | 0,99,44,31,18,28,10,9 19 | 0,94,38,32,13,22,9,9 20 | 0,94,43,37,16,26,9,10 21 | 0,93,43,38,14,28,10,10 22 | 0,95,44,37,18,27,10,10 23 | 0,95,45,39,13,27,10,10 24 | 0,96,39,37,12,26,8,8 25 | 0,103,46,34,18,26,10,10 26 | 0,108,44,37,14,25,11,11 27 | 0,106,47,38,15,26,10,10 28 | 0,105,46,34,14,31,10,11 29 | 0,103,44,34,15,23,10,10 30 | 0,100,41,35,14,24,10,10 31 | 0,109,44,36,13,27,11,10 32 | 0,104,45,36,15,30,10,10 33 | 0,95,40,35,14,23,9,10 34 | 0,104,44,34,15,29,9,10 35 | 0,90,40,37,12,22,9,10 36 | 0,104,46,37,14,30,10,10 37 | 1,86,19,37,11,25,9,9 38 | 1,94,40,38,14,31,6,7 39 | 1,103,48,39,14,33,10,10 40 | 1,82,41,35,12,25,9,8 41 | 1,103,43,42,15,32,9,9 42 | 1,101,43,40,15,25,9,9 43 | 1,103,45,44,14,29,11,11 44 | 1,100,43,40,18,31,11,10 45 | 1,99,41,42,15,31,10,10 46 | 1,100,44,43,16,34,10,10 47 | 1,112,47,44,16,38,12,11 48 | 1,99,48,37,14,32,10,9 49 | 1,98,45,41,19,31,9,8 50 | 1,101,46,42,14,24,11,10 51 | 1,99,45,37,13,28,10,9 52 | 1,103,47,44,15,20,8,9 53 | 1,98,40,38,12,32,9,8 54 | 1,101,46,36,14,28,10,10 55 | 1,101,46,40,17,32,9,9 56 | 1,98,47,39,15,33,10,10 57 | 1,99,45,42,15,32,10,9 58 | 1,102,45,44,15,30,10,10 59 | 1,97,45,37,15,32,10,9 60 | 1,96,39,40,14,20,9,9 61 | 1,89,39,33,12,20,9,8 62 | 1,99,42,38,14,33,9,9 63 | 1,110,45,41,17,36,9,10 64 | 1,99,44,35,16,31,10,10 65 | 1,103,43,38,14,32,10,10 66 | 1,95,46,36,15,31,8,8 67 | 1,101,47,38,14,37,11,11 68 | 1,103,47,40,15,32,11,11 69 | 1,99,43,37,14,23,11,10 70 | 1,105,50,40,16,33,12,11 71 | 1,99,47,39,14,34,7,7 72 | -------------------------------------------------------------------------------- /permute/data/npc/examples_chapters_1-4/ipat.csv: -------------------------------------------------------------------------------- 1 | YA,YB 2 | 19,14 3 | 22,23 4 | 18,13 5 | 18,17 6 | 24,20 7 | 30,22 8 | 26,30 9 | 28,21 10 | 15,11 11 | 30,29 12 | 16,17 13 | 25,20 14 | 22,18 15 | 19,17 16 | 27,22 17 | 23,21 18 | 24,21 19 | 18,15 20 | 28,24 21 | 27,22 22 | -------------------------------------------------------------------------------- /permute/data/npc/examples_chapters_1-4/job.csv: -------------------------------------------------------------------------------- 1 | Y,X 2 | 1,66 3 | 1,57 4 | 1,81 5 | 1,62 6 | 1,61 7 | 1,60 8 | 1,73 9 | 1,59 10 | 1,80 11 | 1,55 12 | 1,67 13 | 1,70 14 | 2,64 15 | 2,58 16 | 2,45 17 | 2,43 18 | 2,37 19 | 2,56 20 | 2,44 21 | 2,42 22 | -------------------------------------------------------------------------------- /permute/data/npc/examples_chapters_1-4/testosterone.csv: -------------------------------------------------------------------------------- 1 | h8.00,h8.30,h9.00,h10.00,h15.00 2 | 320,278,236,222,232 3 | 478,513,415,359,292 4 | 921,701,645,526,458 5 | 213,230,261,253,199 6 | 273,338,323,332,222 7 | 392,302,289,305,172 8 | 469,443,292,235,233 9 | 422,389,359,331,185 10 | 613,649,626,588,636 11 | 395,318,298,269,328 12 | 462,400,360,247,284 13 | -------------------------------------------------------------------------------- /permute/data/npc/examples_chapters_1-4/worms.csv: -------------------------------------------------------------------------------- 1 | Y,X 2 | 1,10.2 3 | 1,8.2 4 | 1,8.9 5 | 1,8 6 | 1,8.3 7 | 1,8 8 | 2,12.2 9 | 2,10.6 10 | 2,9.9 11 | 2,13 12 | 2,8.1 13 | 2,10.8 14 | 2,11.5 15 | 3,9.2 16 | 3,10.5 17 | 3,9.2 18 | 3,8.7 19 | 3,9 20 | -------------------------------------------------------------------------------- /permute/data/npc/germina.csv: -------------------------------------------------------------------------------- 1 | Fertilizer,Germinated,Weight,Surface,Surface2 2 | 0,1,6.03,12.54,157.2516 3 | 0,1,4.2,14.81,219.3361 4 | 0,1,4.49,16.71,279.2241 5 | 0,1,2,7.53,56.7009 6 | 0,1,2.84,7.02,49.2804 7 | 0,1,3.88,8.09,65.4481 8 | 0,1,2.04,5.76,33.1776 9 | 0,1,5.48,18.01,324.3601 10 | 0,1,2.31,8.81,77.6161 11 | 0,1,1.9,8.17,66.7489 12 | 0,1,1.75,6.62,43.8244 13 | 0,1,3.02,7.69,59.1361 14 | 0,0,,, 15 | 0,0,,, 16 | 0,0,,, 17 | 0,0,,, 18 | 0,0,,, 19 | 0,0,,, 20 | 0,0,,, 21 | 0,0,,, 22 | 1,1,3.31,18.49,341.8801 23 | 1,1,6.56,19.2,368.64 24 | 1,1,3.16,9.85,97.0225 25 | 1,1,4.07,15.83,250.5889 26 | 1,1,2.09,6.16,37.9456 27 | 1,1,6.72,17.58,309.0564 28 | 1,1,3.93,19.29,372.1041 29 | 1,1,2.56,10.77,115.9929 30 | 1,1,8.3,18.81,353.8161 31 | 1,1,4.21,10.56,111.5136 32 | 1,1,1.86,9.48,89.8704 33 | 1,1,3.09,12.54,157.2516 34 | 1,1,5.09,18.35,336.7225 35 | 1,1,4.08,11.84,140.1856 36 | 1,1,3.63,11.44,130.8736 37 | 1,1,2.61,7.66,58.6756 38 | 1,1,5.21,12,144 39 | 1,0,,, 40 | 1,0,,, 41 | 1,0,,, 42 | -------------------------------------------------------------------------------- /permute/data/npc/kenya.csv: -------------------------------------------------------------------------------- 1 | Classes,Ol_Molo,Kamba 2 | 1,12,0 3 | 2,1,0 4 | 3,8,6 5 | 4,2,1 6 | 5,0,0 7 | 6,1,0 8 | 7,1,0 9 | 8,0,0 10 | 9,0,0 11 | 10,2,0 12 | 11,8,15 13 | 12,6,0 14 | 13,0,0 15 | 14,0,0 16 | 15,3,1 17 | 16,1,0 18 | -------------------------------------------------------------------------------- /permute/data/npc/massaro_blair.csv: -------------------------------------------------------------------------------- 1 | group,Y 2 | 1,7 3 | 1,3 4 | 1,3 5 | 1,7 6 | 1,3 7 | 1,7 8 | 1,3 9 | 1,10 10 | 1,1 11 | 1,7 12 | 1,4 13 | 1,1 14 | 1,3 15 | 1,2 16 | 1,1 17 | 1,2 18 | 1,9 19 | 1,4 20 | 1,2 21 | 2,15 22 | 2,32 23 | 2,1 24 | 2,13 25 | 2,14 26 | 2,11 27 | 2,1 28 | 2,3 29 | 2,2 30 | 2,7 31 | -------------------------------------------------------------------------------- /permute/data/npc/monachus.csv: -------------------------------------------------------------------------------- 1 | group,bregma_x,bregma_y,rhinion_x,rhinion_y,ns_x,ns_y,pr_x,pr_y,cb_x,cb_y,ct_x,ct_y,au_x,au_y,ms_x,ms_y 2 | 1,0.3406,0.2909,-0.1585,0.1398,-0.2488,0.0232,-0.3203,-0.0326,-0.2369,-0.0213,-0.2720,-0.1198,0.4479,-0.0997,0.4479,-0.1806 3 | 1,0.3624,0.3206,-0.1658,0.1366,-0.2368,0.0254,-0.3149,-0.0578,-0.2395,-0.0344,-0.2690,-0.0956,0.4272,-0.1017,0.4363,-0.1931 4 | 1,0.3274,0.3217,-0.1650,0.1399,-0.2486,0.0281,-0.3187,-0.0402,-0.2206,-0.0263,-0.2624,-0.1088,0.4372,-0.1188,0.4508,-0.1956 5 | 1,0.3021,0.3235,-0.1758,0.1388,-0.2525,0.0304,-0.3102,-0.0273,-0.2228,-0.0455,-0.2497,-0.0892,0.4559,-0.1281,0.4528,-0.2025 6 | 0,0.3653,0.2305,-0.1401,0.1433,-0.2767,0.0297,-0.3188,-0.0167,-0.2563,-0.0420,-0.2764,-0.1295,0.4608,-0.0742,0.4422,-0.1410 7 | 0,0.3534,0.2142,-0.1565,0.1342,-0.2670,0.0275,-0.3292,-0.0097,-0.2563,-0.0296,-0.2681,-0.1252,0.4713,-0.0654,0.4522,-0.1461 8 | 0,0.2644,0.2402,-0.1353,0.1524,-0.2729,0.0430,-0.3195,-0.0125,-0.2411,-0.0148,-0.2621,-0.1326,0.4849,-0.1009,0.4815,-0.1748 9 | 0,0.3085,0.2349,-0.1246,0.1405,-0.2676,0.0240,-0.3192,-0.0195,-0.2608,-0.0142,-0.2806,-0.1217,0.4747,-0.0861,0.4696,-0.1578 10 | 0,0.3986,0.2399,-0.1491,0.1312,-0.2763,0.0176,-0.3130,-0.0261,-0.2555,-0.0261,-0.2796,-0.1273,0.4254,-0.0618,0.4495,-0.1474 11 | 0,0.3593,0.2469,-0.1742,0.1483,-0.2607,0.0303,-0.3335,-0.0275,-0.2357,-0.0177,-0.2551,-0.1370,0.4558,-0.0855,0.4440,-0.1577 12 | 0,0.3258,0.2237,-0.1250,0.1381,-0.2757,0.0261,-0.3120,-0.0319,-0.2693,-0.0252,-0.2831,-0.1039,0.4754,-0.0740,0.4638,-0.1529 13 | 0,0.4154,0.2320,-0.1544,0.1243,-0.2914,0.0112,-0.3167,-0.0198,-0.2483,-0.0459,-0.2726,-0.1084,0.4442,-0.0568,0.4237,-0.1366 14 | -------------------------------------------------------------------------------- /permute/data/npc/mult.csv: -------------------------------------------------------------------------------- 1 | X,Y1,Y2,Y3 2 | 0,14.4,7,4.3 3 | 0,14.6,7.09,3.88 4 | 0,13.8,7.06,5.34 5 | 0,10.1,4.26,4.26 6 | 0,11.1,5.49,4.52 7 | 0,12.4,6.13,5.69 8 | 0,12.7,6.69,4.45 9 | 1,11.8,5.44,3.94 10 | 1,18.3,1.28,0.67 11 | 1,18,1.5,0.67 12 | 1,20.8,1.51,0.72 13 | 1,18.3,1.14,0.67 14 | 1,14.8,2.74,0.67 15 | 1,13.8,7.08,3.43 16 | 1,11.5,6.37,5.64 17 | 1,10.9,6.26,3.47 18 | -------------------------------------------------------------------------------- /permute/data/npc/perch.csv: -------------------------------------------------------------------------------- 1 | rat,dose,testtime,lacrimation,palp_closure,salivation,urination,defecation,pupil,approach,touch,click,tail_pinch,removal,handling,clonic_mvts,tonic_mvts,arousal,vocalizations,hc_posture,rears,motor_activity,gait,mobility,righting,foot_splay,forelimb_grip,hindlimb_grip,piloerection,weight,temperature 2 | 1,150,0,1,1,1,0,0,1,2,2,3,4,4,3,0,0,4,0,2,11,0,1,1,1,21.5,0.805,0.32,0,151.5,37.6 3 | 1,150,4,1,1,1,0,0,1,2,2,3,2,3,2,2,0,3,0,3,2,20,2,1,1,16.5,0.8,0.295,0,150.4,36.8 4 | 1,150,24,2,1,1,1,0,2,1,2,3,4,1,2,2,0,2,0,6,0,34,2,1,1,20.5,0.43,0.2,1,140.7,37.6 5 | 2,1500,0,1,1,1,0,0,1,2,4,4,4,4,2,0,0,3,0,1,4,0,1,1,1,36,0.655,0.55,0,150.8,37.5 6 | 2,1500,4,1,1,1,1,1,1,4,4,3,4,4,3,2,0,3,0,2,0,92,1,1,1,34,0.84,0.355,0,147.1,37.7 7 | 2,1500,24,2,1,1,0,0,1,1,4,3,4,2,4,2,0,2,0,2,0,13,1,1,1,35,0.81,0.245,0,144.6,38.1 8 | 3,150,0,2,1,1,0,0,1,2,2,3,4,5,2,0,0,4,0,3,6,0,1,1,1,28,0.59,0.34,0,151.6,37.5 9 | 3,150,4,2,1,1,0,0,1,2,2,3,4,4,4,0,0,3,0,3,4,262,1,1,1,17,0.74,0.28,0,149.8,38 10 | 3,150,24,1,1,1,0,0,1,1,3,3,4,1,2,0,0,3,0,3,3,174,1,1,1,25.5,0.86,0.295,0,151.7,37.8 11 | 4,150,0,1,1,1,1,0,1,2,2,3,4,4,3,0,0,4,0,1,16,0,1,1,1,28,0.98,0.31,0,165.8,37.5 12 | 4,150,4,1,1,1,0,0,1,2,4,3,4,2,3,0,0,3,0,3,2,106,1,1,1,26,0.935,0.225,0,163.7,37.7 13 | 4,150,24,1,1,1,1,0,1,1,2,3,4,2,2,2,0,2,0,3,0,210,1,1,1,22,0.65,0.365,0,161.1,38 14 | 5,0,0,1,1,1,0,0,1,1,2,3,4,2,2,2,0,3,0,3,4,0,1,1,1,53.5,0.59,0.215,0,151.7,37.4 15 | 5,0,4,1,1,1,1,0,1,2,2,3,4,1,2,0,0,4,0,3,7,290,1,1,1,29,0.685,0.295,0,148.5,37.5 16 | 5,0,24,1,1,1,1,0,1,1,2,3,2,1,2,2,0,3,0,1,3,64,1,1,2,31,0.71,0.295,0,144.8,37.3 17 | 6,5000,0,1,1,1,0,0,1,2,4,3,4,4,2,0,0,3,0,3,6,0,1,1,1,33,0.76,0.34,0,153.4,37.6 18 | 6,5000,4,2,1,1,0,0,2,1,1,1,1,1,1,0,0,1,0,5,0,0,3,3,4,56.5,0,0,0,150.5,35.2 19 | 6,5000,24,2,3,2,0,0,2,1,1,1,1,1,1,0,0,1,0,4,0,46,4,4,4,43,0,0,0,143.8,34.2 20 | 7,0,0,1,1,1,0,1,1,1,2,3,4,2,2,0,0,4,0,3,5,0,1,1,1,34,0.565,0.29,0,156.7,37 21 | 7,0,4,1,1,1,0,0,1,2,2,3,2,2,2,0,0,2,0,3,5,275,1,1,1,40,0.705,0.34,0,154.3,37.6 22 | 7,0,24,1,1,1,0,0,1,1,2,2,2,1,2,2,0,2,0,3,0,220,1,1,1,32,0.425,0.415,0,154,37.5 23 | 8,150,0,1,1,1,1,0,1,1,2,3,4,2,2,0,0,3,0,3,5,0,1,1,1,22.5,0.83,0.42,0,156.1,37.2 24 | 8,150,4,1,1,1,0,0,2,2,4,4,4,1,2,0,0,3,0,1,4,85,1,1,1,24.5,0.875,0.355,0,155.4,38 25 | 8,150,24,1,1,1,2,2,1,1,2,3,4,1,2,2,0,3,0,3,3,21,1,1,1,34,0.715,0.395,0,152.1,37.6 26 | 9,1500,0,1,1,1,1,0,1,2,2,3,4,2,2,0,0,3,0,3,3,0,1,1,1,41.5,0.725,0.255,0,150.8,37.3 27 | 9,1500,4,1,1,1,2,0,2,2,2,3,4,5,3,2,0,5,0,2,2,114,1,1,3,27,0.465,0.21,0,148.5,37.3 28 | 9,1500,24,1,1,1,0,0,1,2,2,3,4,2,2,2,0,2,0,2,0,146,1,1,1,26,0.475,0.215,0,147,37.6 29 | 10,500,0,1,1,1,1,0,1,2,4,3,4,5,2,0,0,4,0,3,13,0,1,1,1,36.5,0.78,0.315,0,167.8,37.2 30 | 10,500,4,1,1,1,0,0,1,1,2,2,2,2,2,2,0,3,0,1,4,111,1,1,2,22,0.81,0.47,0,164.1,37.5 31 | 10,500,24,1,1,1,0,0,1,1,2,3,4,1,2,2,0,2,0,1,0,96,1,1,1,39.5,0.84,0.39,0,161.2,37.8 32 | 11,1500,0,1,1,1,1,0,1,2,2,3,4,4,2,0,0,4,0,2,10,0,1,1,1,22.5,0.515,0.295,0,153.8,37.3 33 | 11,1500,4,2,1,1,0,0,1,2,2,3,4,1,3,0,0,3,0,3,5,68,2,1,1,35.5,0.54,0.35,0,152.4,36.3 34 | 11,1500,24,1,1,1,0,3,2,1,2,3,2,2,3,0,0,3,0,2,4,137,1,1,1,39.5,0.525,0.195,0,147.6,37.2 35 | 12,0,0,1,1,1,0,0,1,2,2,3,4,3,2,0,0,4,0,1,9,0,1,1,1,36,0.655,0.265,0,150.5,37.2 36 | 12,0,4,1,1,1,0,0,1,2,2,3,4,4,3,2,0,2,0,3,0,259,1,1,1,27,0.695,0.35,0,151.6,38.2 37 | 12,0,24,1,1,1,1,3,1,1,2,3,4,1,2,2,0,3,0,1,2,81,1,1,1,21,0.49,0.34,0,153.4,37.6 38 | 13,5000,0,1,1,1,1,2,1,2,2,3,4,5,4,0,0,4,0,3,11,0,1,1,1,33.5,0.845,0.23,0,154.5,37.3 39 | 13,5000,4,2,1,1,2,0,2,1,1,2,1,1,1,0,0,1,0,4,4,14,3,3,4,55.5,0,0.01,0,153.1,35.2 40 | 13,5000,24,3,3,1,0,0,2,1,1,1,1,1,1,0,0,1,0,5,0,0,4,4,4,0,0,0,0,147.2,26.8 41 | 14,150,0,1,1,1,1,0,1,1,2,3,4,2,4,2,0,3,0,1,5,0,1,1,1,34,0.64,0.555,0,154.7,37.2 42 | 14,150,4,1,1,1,0,0,1,2,2,3,4,2,4,2,0,3,0,3,3,252,1,1,2,30.5,0.695,0.31,0,152.4,37.8 43 | 14,150,24,1,1,1,0,0,1,1,2,3,4,2,3,2,0,2,0,3,0,216,1,1,1,33,0.635,0.355,0,151.5,37.2 44 | 15,1500,0,1,1,1,1,0,1,2,2,3,4,5,2,0,0,4,0,3,6,0,1,1,1,24,0.72,0.43,0,153.5,37.2 45 | 15,1500,4,1,1,1,0,0,1,2,2,3,2,1,2,0,0,3,0,1,8,120,2,1,2,40.5,0.775,0.335,0,151.5,37.4 46 | 15,1500,24,1,1,1,0,0,1,1,2,3,2,0,2,2,0,2,0,0,0,154,1,1,1,35.5,0.575,0.255,0,149.9,37.5 47 | 16,150,0,1,1,1,0,0,1,2,2,3,4,2,3,0,0,4,0,3,11,0,1,1,1,37,0.74,0.365,0,162.1,37.5 48 | 16,150,4,1,1,1,0,0,1,2,2,3,4,1,4,0,0,4,0,1,6,256,1,1,1,31.5,0.735,0.31,0,159.7,38.4 49 | 16,150,24,1,1,1,1,1,1,1,2,3,4,1,2,2,0,2,0,3,0,221,1,1,1,39,0.84,0.285,0,160.4,37.4 50 | 17,1500,0,1,1,1,1,0,1,2,2,3,4,4,2,0,0,4,0,2,6,0,1,1,1,41,0.795,0.295,0,144.6,37.7 51 | 17,1500,4,2,1,1,0,0,2,1,2,3,2,4,2,2,0,5,0,2,0,62,1,1,1,33,0.595,0.23,0,142.6,37.3 52 | 17,1500,24,2,1,1,1,0,2,1,2,3,2,1,2,0,0,2,0,3,0,45,2,1,2,36,0.635,0.2,0,139.2,37.3 53 | 18,0,0,1,1,1,0,0,1,2,2,3,4,4,2,0,0,4,0,3,8,0,1,1,1,25,0.76,0.295,0,148.8,37.3 54 | 18,0,4,1,1,1,0,0,1,2,2,4,3,1,2,2,0,3,0,1,3,345,1,1,1,36,0.8,0.255,0,147.7,37.3 55 | 18,0,24,1,1,1,0,0,1,1,2,3,4,1,2,2,0,3,0,3,0,146,1,1,1,34,0.595,0.15,0,148.6,37.5 56 | 19,0,0,1,1,1,1,0,1,2,2,3,4,2,3,0,0,4,0,2,8,0,1,1,1,26,0.76,0.21,0,162,37.5 57 | 19,0,4,1,1,1,1,3,1,2,2,3,4,1,2,2,0,3,0,1,1,306,1,1,1,22,0.79,0.245,0,159.7,37.5 58 | 19,0,24,1,1,1,1,3,2,1,2,1,1,1,2,2,0,2,0,1,0,82,1,1,1,29,0.58,0.22,0,158.8,37.8 59 | 20,0,0,1,1,1,0,2,1,1,2,3,3,4,2,0,0,4,0,3,11,0,1,1,1,27.5,0.6,0.26,0,156.9,37.2 60 | 20,0,4,1,1,1,1,0,1,2,2,3,4,4,2,0,0,3,0,3,7,117,1,1,1,19,0.88,0.3,0,153.8,37.6 61 | 20,0,24,1,1,1,1,2,1,1,2,3,4,1,2,2,0,2,0,3,1,155,1,1,1,32.5,0.635,0.195,0,151,37.9 62 | 21,500,0,1,1,1,0,0,1,2,4,3,4,5,2,0,0,4,0,1,9,0,1,1,1,36,0.745,0.36,0,147.9,37.6 63 | 21,500,4,1,1,1,1,0,1,2,2,3,2,1,2,2,0,2,0,1,0,236,1,1,1,31,0.855,0.295,0,145.1,38 64 | 21,500,24,1,1,1,1,6,1,2,2,3,4,1,2,2,0,2,0,1,0,35,1,1,1,36.5,0.76,0.22,0,144.5,38 65 | 22,150,0,1,1,1,0,0,1,2,3,3,4,2,3,0,0,4,0,1,9,0,1,1,1,31,0.845,0.245,0,162.5,37 66 | 22,150,4,1,1,1,0,0,1,2,2,3,4,4,2,0,0,4,0,1,7,144,1,1,1,34.5,0.86,0.335,0,157.5,38 67 | 22,150,24,2,1,1,0,0,1,1,2,3,4,2,2,2,0,2,0,1,0,79,1,1,1,36.5,0.75,0.36,0,150.9,38.4 68 | 23,500,0,1,1,1,1,1,1,2,2,3,4,3,2,0,0,3,0,1,4,0,1,1,1,38.5,0.775,0.265,0,148.2,37.8 69 | 23,500,4,1,1,1,0,0,1,1,2,3,4,1,2,0,0,3,0,6,5,116,1,1,1,32,0.685,0.41,0,146,38.2 70 | 23,500,24,2,1,1,0,0,1,1,2,3,2,0,4,2,0,2,0,0,0,33,1,1,1,34,0.79,0.23,0,142.2,37.5 71 | 24,500,0,1,1,1,1,0,1,1,3,3,4,5,2,0,0,4,0,1,7,0,1,1,1,32,0.78,0.26,0,153.9,37.2 72 | 24,500,4,1,1,1,0,0,1,2,2,3,3,4,2,0,0,4,0,2,5,226,1,1,1,32,0.795,0.38,0,150.4,37.7 73 | 24,500,24,1,1,1,0,0,1,2,2,3,2,2,2,2,0,2,0,2,0,168,1,1,1,38.5,0.465,0.215,0,151,36.8 74 | 25,1500,0,1,1,1,0,0,1,1,2,3,4,3,2,2,0,3,0,1,9,0,1,1,1,37.5,0.68,0.295,0,161,37.5 75 | 25,1500,4,1,1,1,0,0,1,1,2,2,4,2,2,0,0,4,0,1,5,88,2,1,2,37.5,0.555,0.145,0,157.9,37.4 76 | 25,1500,24,1,1,1,0,2,2,1,2,2,2,2,2,2,0,3,0,2,0,74,1,1,1,27.5,0.745,0.11,0,152,38.1 77 | 26,500,0,1,1,1,0,0,1,1,2,3,4,2,3,0,0,3,0,1,6,0,1,1,1,29.5,0.66,0.345,0,156.1,37.2 78 | 26,500,4,1,1,1,0,0,1,2,2,3,4,1,2,0,0,4,0,3,6,194,1,1,1,30.5,0.705,0.315,0,154.6,37.8 79 | 26,500,24,1,1,1,1,0,2,1,2,3,2,1,2,2,0,2,0,1,0,152,1,1,1,30,0.6,0.3,0,152.6,37.7 80 | 27,0,0,1,1,1,1,0,1,2,4,3,4,2,2,0,0,3,0,3,5,0,1,1,1,37,0.645,0.26,0,151.2,37.2 81 | 27,0,4,1,1,1,0,0,1,2,2,3,4,4,2,2,0,2,0,3,1,54,1,1,1,34,0.82,0.225,0,149.6,37.9 82 | 27,0,24,1,1,1,0,1,1,1,2,3,4,1,2,2,0,3,0,1,2,142,1,1,1,33.5,0.81,0.16,0,141.7,38 83 | 28,500,0,1,1,1,2,0,1,2,3,3,4,3,3,0,0,5,0,2,15,0,1,1,1,32.5,0.94,0.28,0,153.1,37.2 84 | 28,500,4,1,1,1,1,0,1,2,2,3,4,1,3,0,0,4,0,6,6,67,1,1,1,35.5,0.695,0.28,0,151.5,37.5 85 | 28,500,24,1,1,1,1,3,1,1,2,3,2,0,4,2,0,2,0,0,1,85,1,1,1,41.5,0.85,0.27,0,143.1,37.9 86 | 29,5000,0,1,1,1,1,0,1,1,3,3,4,3,2,2,0,3,0,3,2,0,1,1,1,44,0.77,0.335,0,166.3,37.6 87 | 29,5000,4,2,1,2,0,0,2,1,1,1,1,4,1,0,0,1,0,1,0,127,4,4,4,45,0,0,0,161.7,34 88 | 29,5000,24,2,3,1,1,0,2,1,1,1,1,1,1,0,0,1,0,3,0,28,4,3,4,39.5,0,0,0,154.3,32.8 89 | 30,0,0,1,1,1,0,1,1,2,2,3,4,3,4,0,0,4,0,2,7,0,1,1,1,25,0.68,0.395,0,156,37.2 90 | 30,0,4,1,1,1,0,0,2,2,2,3,4,2,3,0,0,3,0,3,4,55,1,1,1,24,0.78,0.3,0,154.1,37.4 91 | 30,0,24,1,1,1,0,0,1,1,2,2,4,1,2,2,0,3,0,3,0,34,1,1,1,34,0.83,0.21,0,148.4,37.5 92 | 31,500,0,1,1,1,2,0,1,2,4,3,4,4,2,0,0,4,0,3,12,0,1,1,1,27,0.79,0.24,0,167.6,37.2 93 | 31,500,4,1,1,1,0,0,1,2,2,3,4,1,2,0,0,3,0,4,3,132,1,1,1,45,0.77,0.325,0,163.1,37.2 94 | 31,500,24,1,1,1,2,1,2,1,2,3,3,0,2,2,0,3,0,0,1,101,1,1,1,31.5,0.865,0.315,0,162.8,38.5 95 | 32,1500,0,1,1,1,1,0,1,1,3,3,4,4,3,0,0,3,0,1,3,0,1,1,1,21.5,0.8,0.24,0,163.5,37.8 96 | 32,1500,4,1,1,1,0,0,1,2,4,3,4,3,3,0,0,4,0,2,6,85,2,1,1,33.5,0.765,0.24,0,161.3,38 97 | 32,1500,24,2,1,1,0,0,1,2,2,3,4,4,2,2,0,3,0,1,2,47,1,1,1,36,0.69,0.39,0,152.9,38.1 98 | 33,1500,0,1,1,1,1,0,1,1,2,3,4,3,2,0,0,3,0,1,9,0,1,1,1,30,0.7,0.46,0,160.9,37 99 | 33,1500,4,2,1,1,0,0,2,1,2,3,2,1,2,0,0,4,0,4,9,56,2,1,1,31.5,0.515,0.335,0,156.2,37.4 100 | 33,1500,24,1,1,1,0,0,1,1,2,2,2,1,2,2,0,2,0,4,1,156,1,1,2,44,0.675,0.29,0,152.9,37.8 101 | 34,5000,0,1,1,1,0,0,1,2,3,3,4,4,2,0,0,3,0,3,5,0,1,1,1,27.5,0.69,0.275,0,152.8,36.8 102 | 34,5000,4,2,1,2,0,0,2,1,2,3,1,4,3,2,0,1,0,3,3,70,2,2,3,45.5,0,0.125,1,150.5,36.2 103 | 34,5000,24,2,2,2,0,0,2,1,1,1,1,1,1,0,0,1,0,1,0,1,4,4,4,0,0,0,0,144.8,30 104 | 35,150,0,1,1,1,0,0,1,2,2,3,4,2,2,0,0,3,0,2,4,0,1,1,1,27,0.76,0.41,0,152.5,37.5 105 | 35,150,4,2,1,1,0,4,1,1,3,3,4,1,3,2,0,2,0,1,2,82,1,1,1,35,0.72,0.2,0,148.6,38.3 106 | 35,150,24,1,1,1,1,0,1,1,2,3,2,1,2,0,0,3,0,2,0,96,1,1,1,36,0.585,0.18,0,147.9,37.9 107 | 36,500,0,1,1,1,0,0,1,2,2,3,4,5,2,0,0,4,0,1,7,0,1,1,1,28,0.745,0.27,0,153.3,37.8 108 | 36,500,4,1,1,1,0,0,1,2,2,3,4,1,2,2,0,3,0,6,4,49,1,1,1,32.5,0.785,0.24,0,150.4,38.3 109 | 36,500,24,2,1,1,0,0,1,1,2,3,4,1,3,0,0,2,0,1,1,237,1,1,1,27,0.855,0.22,0,144.6,38.5 110 | -------------------------------------------------------------------------------- /permute/data/npc/rats.csv: -------------------------------------------------------------------------------- 1 | GROUP,T_0,T_1,T_2,T_3,T_4,T_5,T_6,T_7,T_8,T_9,T_10,T_11,T_12,T_13,T_14,T_15,T_16,T_17 2 | 1,1,1.8,0.78,0.87,1.05,1.34,1.6,2.11,2.51,2.35,3.21,3.29,3.57,3.57,3.92,4.67,8.09,9.97 3 | 1,1,1,1.88,2.32,2.87,2.24,2.17,3.16,4.28,3.71,3.59,4.97,4.45,6.32,6.09,9.35,10,13.84 4 | 1,1,1,1.2,1.4,1.5,2.17,2.9,2.54,1.56,2.17,3.48,2.62,3.21,3.47,4.44,5.52,6.96,6.04 5 | 1,1,1.04,1.04,1.73,1.81,2.77,2.81,3.9,2.86,4.68,5.26,4.74,5.73,6.23,7.82,8.43,7.57,9.64 6 | 1,1,1.32,1.92,2.03,2.49,2.77,3.06,4.52,4.06,5.33,5.24,5.25,6.96,9.39,9.84,9.18,13.3,14.37 7 | 1,1,1.03,1.26,1.66,1.1,1.31,1.99,2.41,2.29,2.92,2.71,3.19,4.15,3.98,5.07,5.89,9.36,8.49 8 | 1,1,1.2,1.37,1.64,1.4,1.82,1.38,2.41,2.32,2.18,2.64,3.04,2.79,3.09,4.1,3.46,3.77,5.11 9 | 1,1,1.02,1.15,1.49,1.83,2.32,3.11,5.3,5.3,6.05,7.72,6.53,6.72,7.22,8.88,6.8,12.2,12.12 10 | 1,1,0.17,1.22,2.02,0.96,1.7,1.74,2.76,3.1,3.57,5.14,4.67,5.09,5.83,6.77,7.72,13.7,18.84 11 | 1,1,1.95,2.73,2.34,3.94,4.16,4.5,6.89,8.04,9.4,10.51,9.21,10.47,19.06,36.9,42.88,68.6,81.28 12 | 1,1,1.34,2.66,1.92,3.39,3.7,5.08,4.21,6.11,6.32,10,9.6,13.83,10.8,12.6,17.33,22,28.38 13 | 2,1,0.71,0.99,0.85,1.14,1.18,1.35,1.61,1.52,1.94,3.87,1.95,3.39,3.47,3.75,3.97,5.05,6.33 14 | 2,1,0.86,1.31,1.1,1.32,1.7,2.01,2.4,3.45,3.08,4.46,2.97,6.81,7.53,9.42,8.09,11.72,17 15 | 2,1,0.65,0.75,0.65,1.19,0.92,1.14,0.51,0.96,0.53,1.12,0.68,1.36,1.12,1.51,1.73,1.61,3.06 16 | 2,1,0.65,0.7,0.86,1.26,1.16,1.53,1.36,0.91,0.98,1.05,1.12,1.36,1.59,1.99,2.27,1.67,3 17 | 2,1,0.78,0.9,0.91,0.96,1.38,2.56,1.63,1.09,1.7,1.8,2.39,1.73,2.04,1.84,2.26,4.27,3.47 18 | 2,1,1.74,1.41,1.12,1.63,1.95,3.11,1.7,4.63,3.89,4.55,3.86,5.09,7.06,8.52,8.61,8.61,8.61 19 | 2,1,0.93,0.46,0.47,0.65,1.03,0.7,1.03,0.78,1.26,2.06,2.84,1.77,2.3,2.54,4.05,4.49,8.2 20 | 2,1,0.85,0.94,0.91,1.04,1.55,1.77,1.77,1.66,2.5,3,3.03,3.82,3.95,4.34,4.16,6.41,10.73 21 | 2,1,1.06,1.49,1.35,1.98,2.11,1.41,1.81,1.74,1.46,2.55,2.24,1.84,2.4,3.26,1.86,3.2,3.61 22 | 3,1,1,0.98,1.47,1.07,1.47,1.52,1.47,1.21,1.56,2.29,2.01,2.27,3.1,3.54,2.45,3.43,4.81 23 | 3,1,1,1,1,1,1,1.95,1.95,3.38,3.38,3.38,5.36,5.36,9.2,9,6.28,17.19,22.69 24 | 3,1,1.78,1.04,1.42,0.96,0.97,1.13,1.39,1.92,2.14,1.59,2.41,2.77,3.17,3.67,3.71,5.58,6.73 25 | 3,1,0.95,0.91,0.81,0.86,0.69,0.95,0.74,0.67,0.99,1.5,1.09,1.03,0.97,1.31,1.64,1.79,2.76 26 | 3,1,1.07,0.63,0.84,1.04,1,1.04,0.96,0.97,1.06,1,1.13,1.04,0.72,0.98,0.94,1.41,2.1 27 | 3,1,1.06,0.88,1.18,1.28,0.95,0.86,0.79,1.25,1.59,2.25,2.25,2.42,2.45,3.03,3.05,5.13,6.63 28 | 3,1,0.81,0.82,1.05,0.76,0.74,1.17,0.83,0.55,0.83,1.26,0.97,0.79,1.38,1.51,1.76,2.48,4.07 29 | 4,1,1.12,0.82,1.21,0.61,0.56,0.87,0.23,0.19,0.18,0.11,0.17,0.15,0.22,0.27,0.26,0.49,0.46 30 | 4,1,1.47,1.35,1.06,0.77,0.4,0.66,0.35,0.28,0.37,0.41,0.31,0.46,0.6,0.88,0.8,1.27,1.5 31 | 4,1,1.36,0.88,0.93,0.72,0.65,1.31,0.69,0.77,0.68,0.88,0.81,0.73,0.97,1.01,1.95,2.32,2.24 32 | 4,1,1.26,0.93,0.86,0.91,0.86,1.27,0.93,1.12,0.94,1.17,2.01,1.83,1.26,0.87,1.3,1.79,2.01 33 | 4,1,2.08,1.09,1.25,1.09,1.56,0.88,0.88,0.88,0.88,0.88,0.88,1.44,1.44,2.14,1.88,2.6,2.34 34 | 4,1,1.7,0.72,1.19,0.75,0.78,0.78,0.93,0.57,2.03,1.95,0.85,1.49,2.07,1.31,2.11,3.97,2.79 35 | 4,1,1.27,0.97,1.62,1.33,1.17,1.49,2.14,1.33,2.92,4.04,2,3.16,2.98,3.52,5.21,4.51,6.09 36 | 4,1,0.53,0.4,0.53,0.54,0.9,0.53,0.88,0.48,0.61,0.95,0.95,0.8,0.98,0.95,1.06,1.9,2 37 | 4,1,1.38,1.59,1.01,1,0.44,0.54,0.54,0.44,0.54,0.46,0.42,1.01,0.98,1.52,1.35,2.18,2.89 38 | -------------------------------------------------------------------------------- /permute/data/npc/setig.csv: -------------------------------------------------------------------------------- 1 | STRATA,GROUP,D,R,U,L 2 | 1,1,1,0,0,11 3 | 1,1,0,NaN,0,1 4 | 1,1,0,NaN,1,0 5 | 1,1,0,NaN,1,0 6 | 1,1,1,0,1,19 7 | 1,1,0,NaN,1,0 8 | 1,1,0,NaN,0,1 9 | 1,1,0,NaN,0,1 10 | 1,1,0,1,0,39 11 | 1,1,0,NaN,0,1 12 | 1,1,0,1,1,25 13 | 1,1,0,NaN,0,1 14 | 1,1,1,0,0,10 15 | 1,1,1,0,1,19 16 | 1,1,1,0,1,23 17 | 1,2,0,NaN,0,1 18 | 1,2,0,NaN,0,1 19 | 1,2,0,NaN,0,1 20 | 1,2,0,NaN,1,0 21 | 1,2,0,NaN,1,0 22 | 1,2,0,NaN,1,0 23 | 1,2,1,0,1,23 24 | 1,2,0,1,1,40 25 | 1,2,0,1,1,37 26 | 1,2,0,NaN,0,1 27 | 1,2,0,1,0,8 28 | 1,2,0,NaN,0,1 29 | 1,2,0,1,1,28 30 | 1,2,1,0,0,8 31 | 1,2,0,0,,NaN 32 | 1,2,0,NaN,1,0 33 | 1,2,0,NaN,1,0 34 | 1,2,0,NaN,1,0 35 | 1,2,0,NaN,1,0 36 | 1,2,0,1,0,17 37 | 1,2,0,NaN,1,0 38 | 1,2,0,NaN,0,1 39 | 1,2,0,NaN,1,0 40 | 1,2,0,NaN,0,1 41 | 1,2,0,NaN,1,0 42 | 1,2,0,1,0,25 43 | 1,2,0,1,0,27 44 | 1,2,0,NaN,0,1 45 | 1,2,0,1,1,24 46 | 1,2,0,NaN,0,1 47 | 1,2,0,NaN,0,1 48 | 1,2,0,NaN,0,1 49 | 1,2,0,1,0,14 50 | 1,2,0,1,0,9 51 | 1,2,0,NaN,0,1 52 | 1,2,1,0,1,15 53 | 1,2,0,NaN,0,1 54 | 1,2,0,NaN,1,0 55 | 1,2,0,NaN,0,1 56 | 1,2,0,1,0,10 57 | 1,2,0,1,1,45 58 | 1,2,0,NaN,0,1 59 | 1,2,0,NaN,1,0 60 | 1,2,0,NaN,0,1 61 | 1,2,0,NaN,0,1 62 | 1,2,1,0,0,9 63 | 1,2,0,NaN,0,1 64 | 1,2,0,NaN,1,0 65 | 1,2,0,NaN,0,1 66 | 1,2,0,NaN,0,1 67 | 1,2,0,NaN,1,0 68 | 1,2,0,1,1,55 69 | 1,2,0,NaN,1,0 70 | 1,2,1,0,0,12 71 | 1,2,0,NaN,0,1 72 | 1,2,0,NaN,0,1 73 | 1,2,0,1,0,11 74 | 1,2,0,1,1,25 75 | 1,2,0,NaN,0,1 76 | 1,2,0,NaN,1,0 77 | 1,2,1,0,0,19 78 | 1,2,0,NaN,0,1 79 | 1,2,0,NaN,0,1 80 | 1,2,0,NaN,1,0 81 | 1,2,0,NaN,0,1 82 | 1,2,0,NaN,0,1 83 | 1,2,0,NaN,1,0 84 | 1,2,0,NaN,1,0 85 | 2,1,0,1,0,10 86 | 2,1,0,NaN,1,0 87 | 2,1,0,1,1,45 88 | 2,1,1,0,0,12 89 | 2,1,1,0,0,8 90 | 2,1,0,1,0,13 91 | 2,1,1,0,1,52 92 | 2,1,1,0,1,74 93 | 2,1,0,NaN,0,1 94 | 2,1,0,1,1,22 95 | 2,1,0,NaN,0,1 96 | 2,1,0,1,0,9 97 | 2,1,0,NaN,1,0 98 | 2,1,0,NaN,0,1 99 | 2,1,0,NaN,1,0 100 | 2,1,0,NaN,0,1 101 | 2,1,0,NaN,0,1 102 | 2,1,0,1,1,20 103 | 2,1,0,NaN,1,0 104 | 2,1,0,NaN,0,1 105 | 2,1,0,1,0,10 106 | 2,1,0,NaN,1,0 107 | 2,1,0,1,0,31 108 | 2,1,1,0,0,15 109 | 2,1,1,0,0,7 110 | 2,1,0,NaN,1,0 111 | 2,1,1,0,1,48 112 | 2,1,0,NaN,0,1 113 | 2,1,0,1,0,6 114 | 2,1,0,NaN,0,1 115 | 2,1,1,0,0,6 116 | 2,1,0,NaN,0,1 117 | 2,1,0,NaN,0,1 118 | 2,1,1,0,1,91 119 | 2,1,0,NaN,0,1 120 | 2,2,0,NaN,0,1 121 | 2,2,0,NaN,0,1 122 | 2,2,0,1,0,25 123 | 2,2,0,NaN,1,0 124 | 2,2,0,NaN,1,0 125 | 2,2,0,1,0,3 126 | 2,2,0,1,1,23 127 | 2,2,1,1,0,31 128 | 2,2,0,NaN,0,1 129 | 2,2,0,NaN,1,0 130 | 2,2,0,NaN,0,1 131 | 2,2,0,NaN,0,1 132 | 2,2,0,1,0,11 133 | 2,2,0,NaN,0,1 134 | 2,2,0,NaN,0,1 135 | 2,2,0,1,1,55 136 | 2,2,0,NaN,0,1 137 | 2,2,0,NaN,0,1 138 | 2,2,1,0,0,10 139 | 2,2,0,1,0,42 140 | 2,2,0,NaN,0,1 141 | 2,2,0,1,0,19 142 | 2,2,0,1,0,22 143 | 2,2,0,NaN,0,1 144 | 2,2,1,1,0,17 145 | 2,2,0,NaN,0,1 146 | 2,2,0,NaN,0,1 147 | 2,2,0,NaN,0,1 148 | 2,2,1,0,0,8 149 | 2,2,0,NaN,1,0 150 | 2,2,0,NaN,0,1 151 | 2,2,0,1,1,33 152 | 2,2,0,NaN,0,1 153 | 2,2,0,NaN,1,0 154 | 2,2,0,NaN,0,1 155 | 2,2,0,NaN,1,0 156 | 2,2,0,NaN,0,1 157 | 2,2,0,NaN,1,0 158 | 2,2,0,1,0,8 159 | 2,2,1,0,1,26 160 | 2,2,0,NaN,1,0 161 | 2,2,0,1,0,14 162 | 2,2,0,NaN,0,1 163 | 2,2,0,NaN,0,1 164 | 2,2,1,0,0,15 165 | 2,2,1,0,0,12 166 | 2,2,1,1,0,35 167 | 2,2,0,NaN,0,1 168 | 2,2,0,NaN,0,1 169 | 3,1,0,NaN,0,1 170 | 3,1,0,NaN,0,1 171 | 3,1,0,1,1,21 172 | 3,1,0,NaN,0,1 173 | 3,1,0,1,0,7 174 | 3,1,0,NaN,0,1 175 | 3,1,1,0,0,6 176 | 3,1,1,0,1,34 177 | 3,1,1,0,0,17 178 | 3,1,0,NaN,0,1 179 | 3,1,0,NaN,0,1 180 | 3,1,0,1,0,17 181 | 3,1,0,NaN,0,1 182 | 3,1,0,NaN,1,0 183 | 3,1,0,NaN,1,0 184 | 3,1,0,NaN,0,1 185 | 3,1,0,NaN,0,1 186 | 3,1,0,NaN,1,0 187 | 3,1,0,NaN,0,1 188 | 3,1,0,1,1,43 189 | 3,1,0,1,0,8 190 | 3,1,0,NaN,1,0 191 | 3,1,0,NaN,0,1 192 | 3,1,0,1,1,19 193 | 3,1,0,1,0,9 194 | 3,1,1,0,0,11 195 | 3,1,0,NaN,0,1 196 | 3,1,0,NaN,0,1 197 | 3,1,0,NaN,0,1 198 | 3,1,0,NaN,0,1 199 | 3,1,1,0,1,64 200 | 3,1,0,1,0,28 201 | 3,1,0,1,0,23 202 | 3,1,0,NaN,0,1 203 | 3,1,0,1,0,29 204 | 3,1,1,0,0,17 205 | 3,1,0,NaN,0,1 206 | 3,1,0,1,0,15 207 | 3,1,0,NaN,0,1 208 | 3,1,1,0,1,76 209 | 3,1,1,1,0,70 210 | 3,1,0,NaN,0,1 211 | 3,1,0,1,0,29 212 | 3,1,0,1,0,8 213 | 3,1,1,0,0,15 214 | 3,1,0,NaN,0,1 215 | 3,1,1,0,1,21 216 | 3,2,0,NaN,0,1 217 | 3,2,0,1,1,28 218 | 3,2,0,1,1,31 219 | 3,2,1,0,0,12 220 | 3,2,0,1,0,34 221 | 3,2,1,0,0,18 222 | 3,2,0,NaN,0,1 223 | 3,2,0,1,1,25 224 | 3,2,0,1,0,6 225 | 3,2,0,NaN,1,0 226 | 3,2,0,NaN,1,0 227 | 3,2,0,1,0,40 228 | 3,2,0,NaN,1,0 229 | 3,2,1,0,0,44 230 | 3,2,0,NaN,0,1 231 | 3,2,0,NaN,0,1 232 | 3,2,0,NaN,0,1 233 | 3,2,0,NaN,1,0 234 | 3,2,1,1,0,61 235 | 3,2,0,1,0,13 236 | 3,2,0,NaN,0,1 237 | 3,2,0,1,0,13 238 | 3,2,0,1,1,29 239 | 3,2,0,NaN,0,1 240 | 3,2,0,NaN,0,1 241 | 3,2,0,NaN,0,1 242 | 3,2,0,NaN,0,1 243 | 3,2,1,0,0,17 244 | 3,2,0,1,1,35 245 | 3,2,0,NaN,0,1 246 | 3,2,0,NaN,0,1 247 | 3,2,0,NaN,1,0 248 | 3,2,0,1,0,17 249 | 3,2,1,0,0,8 250 | 3,2,0,0,,15 251 | 3,2,0,1,1,36 252 | 4,1,0,NaN,0,1 253 | 4,1,1,0,0,10 254 | 4,1,0,1,0,13 255 | 4,1,0,1,0,11 256 | 4,1,0,1,0,15 257 | 4,1,0,1,1,26 258 | 4,1,0,NaN,0,1 259 | 4,1,0,NaN,0,1 260 | 4,1,0,NaN,1,0 261 | 4,1,0,1,0,10 262 | 4,1,1,0,0,12 263 | 4,1,0,1,0,8 264 | 4,1,0,1,0,15 265 | 4,1,0,1,1,19 266 | 4,1,0,1,0,12 267 | 4,1,0,1,1,40 268 | 4,1,0,NaN,0,1 269 | 4,1,1,0,0,13 270 | 4,1,0,0,1,24 271 | 4,1,0,1,1,18 272 | 4,1,1,0,1,30 273 | 4,1,0,NaN,0,1 274 | 4,1,0,NaN,0,1 275 | 4,1,0,1,0,35 276 | 4,1,0,1,0,16 277 | 4,1,0,NaN,0,1 278 | 4,1,0,1,0,31 279 | 4,1,0,1,0,32 280 | 4,1,0,NaN,0,1 281 | 4,1,0,NaN,0,1 282 | 4,1,0,1,1,24 283 | 4,1,0,1,1,25 284 | 4,1,0,1,0,7 285 | 4,1,0,NaN,1,0 286 | 4,1,0,NaN,0,1 287 | 4,1,0,1,0,8 288 | 4,1,0,NaN,0,1 289 | 4,1,0,NaN,1,0 290 | 4,1,0,1,1,16 291 | 4,1,1,0,0,23 292 | 4,1,1,0,0,50 293 | 4,1,0,NaN,1,0 294 | 4,1,0,NaN,1,0 295 | 4,1,0,NaN,1,0 296 | 4,1,1,0,0,7 297 | 4,1,1,1,0,38 298 | 4,1,1,0,1,42 299 | 4,1,0,NaN,1,0 300 | 4,1,0,1,0,7 301 | 4,1,1,0,0,12 302 | 4,1,1,0,0,7 303 | 4,1,0,1,0,15 304 | 4,1,0,NaN,0,1 305 | 4,1,0,1,0,16 306 | 4,1,0,NaN,1,0 307 | 4,1,1,0,0,6 308 | 4,1,1,0,0,14 309 | 4,2,0,NaN,0,1 310 | 4,2,0,NaN,0,1 311 | 4,2,0,1,0,10 312 | 4,2,0,NaN,0,1 313 | 4,2,0,NaN,0,1 314 | 4,2,0,NaN,0,1 315 | 4,2,0,NaN,1,0 316 | 4,2,0,1,0,7 317 | 4,2,0,NaN,0,1 318 | 4,2,0,1,0,8 319 | 4,2,0,NaN,0,1 320 | 4,2,0,NaN,0,1 321 | 4,2,0,NaN,0,1 322 | 4,2,0,1,0,12 323 | 4,2,0,NaN,0,1 324 | 4,2,0,1,0,20 325 | 4,2,0,1,0,13 326 | 4,2,0,NaN,0,1 327 | 4,2,0,NaN,0,1 328 | 4,2,0,NaN,0,1 329 | 4,2,0,NaN,1,0 330 | 4,2,0,1,1,30 331 | 4,2,0,1,0,13 332 | 4,2,0,1,0,14 333 | 4,2,0,1,0,13 334 | 4,2,0,1,0,6 335 | 4,2,0,1,0,8 336 | -------------------------------------------------------------------------------- /permute/data/npc/waterfalls.csv: -------------------------------------------------------------------------------- 1 | Panelist,Fragr,Blo_Stren,Blo_Pleas,Blo_Appro,Dry_Stren,Dry_Pleas,Dry_Appro,Lon_Stren,Lon_Pleas,Lon_Appro,Nea_Stren,Nea_Pleas,Nea_Appro,Wet_Stren,Wet_Pleas,Wet_Appro 2 | 1,r,4,4.5,1,4.5,5,2,5,4,1,4.5,3,2,3.5,6,1 3 | 2,r,2.5,5.5,2,5,6,1,4,4,2,5,3.5,2,2,4,2 4 | 3,r,3,4,1,5,5,2,4,3,2,5,3,2,3.5,2,1 5 | 4,r,5,4.5,2,5,4,2,7,6,1,4.5,4.5,2,2,6,2 6 | 5,r,4.5,7,1,4,5,1,5,2,2,6,5,2,2.5,3,1 7 | 6,r,3,4.5,1,4,5,2,5,4,2,7,4,2,3,5,2 8 | 7,r,4,4,1,4.5,4,2,4,3,1,5,3,1,6,3,1 9 | 1,s,1,2,2,4,6,1,6,2,1,5,4,1,6,5,2 10 | 2,s,2.5,2.5,1,3.5,4,2,3,4,1,5,2,1,7,4,1 11 | 3,s,3.5,3,1,5,4,2,4,3,2,6,2,2,5,3,2 12 | 4,s,3,2,1,4,5,2,4,6,2,5.5,5,2,6,4,2 13 | 5,s,4,3,1,5,6,1,3,5,1,7,1,2,6,6,1 14 | 6,s,3,4,2,4,4,1,1,5,1,6,5,2,5,4,2 15 | 7,s,3,2,2,5,2,2,3,3,2,4.5,2,2,4.5,2,2 16 | 1,t,4,2,1,3.5,5,1,7,1,1,6,5,1,5,6,1 17 | 2,t,4,1.5,2,4,4,1,2,4,1,6,2,2,6,1,2 18 | 3,t,3.5,2,2,4.5,4,1,5,3,2,5.5,4,1,5,2,2 19 | 4,t,3,3,2,3.5,5,2,5,6,2,7,7,1,5,3,1 20 | 5,t,3,1.5,1,3,3,2,3,2,2,6,1,2,5,5,2 21 | 6,t,2,2,2,4,4,2,4,5,2,6,5,2,4,6,1 22 | 7,t,3.5,2,2,3.5,5,1,4.5,1,2,4.5,3,2,3.5,3,2 23 | 1,v,4,6,2,4.5,6.5,2,5,3,1,5.5,4,2,6,2,2 24 | 2,v,3,7,1,5,7,2,5,5,1,6,2,2,4.5,6,2 25 | 3,v,4,6,2,6,5.5,1,6,3,1,6,4,1,5,2,2 26 | 4,v,3,5.5,1,5,5,2,4,6,2,4,6,2,5,5,2 27 | 5,v,4.5,6,2,5,6,2,5,6,1,6,2,2,3,6,1 28 | 6,v,3,6,1,5,6,2,4,4,2,6,4,1,3,5,2 29 | 7,v,4.5,5.5,2,4,5,2,3.5,4,2,5,3,2,5.5,4,2 30 | 1,w,4,2,2,4,3,1,7,5,1,5.5,2,2,6,2,2 31 | 2,w,4,2.5,1,3.5,3,1,3,4,2,5,4,2,6,1,2 32 | 3,w,3,3,1,4,4,2,4,3,2,4,2,1,7,4,1 33 | 4,w,5,2.5,2,4,4,2,5,4.5,1,7,6,2,6,5,2 34 | 5,w,3,3.5,1,5,3,1,4,6,1,6,6,2,6,6,2 35 | 6,w,3.5,3,1,4,3,1,3,3,2,7,5,1,6,2,2 36 | 7,w,3,5,2,4,4,1,5,3,2,6,1,2,6,2,2 37 | 1,x,1,3,1,3,5,2,4,2,1,7,1,1,3.5,3,2 38 | 2,x,4.5,2.5,2,3.5,5,2,1,3,2,6,2,1,3.5,5,1 39 | 3,x,4,3,2,1,3.5,1,2.5,3,2,5,2,2,4,6,2 40 | 4,x,1,2,2,2,5,2,5,2,1,7,5,2,5,5,2 41 | 5,x,2,3,1,2,6,2,2,3,1,6,6,1,4,7,1 42 | 6,x,3,2.5,2,3,5,2,1,2,1,6,6,1,4,6,1 43 | 7,x,2,2,2,3,5,1,2,1,2,7,4.5,2,5,3,2 44 | -------------------------------------------------------------------------------- /permute/data/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/statlab/permute/ef72da3394ca82c04a035c5fcdefe524eea62c45/permute/data/tests/__init__.py -------------------------------------------------------------------------------- /permute/data/tests/test_data.py: -------------------------------------------------------------------------------- 1 | import permute.data as data 2 | from numpy.testing import assert_equal 3 | 4 | 5 | def test_botulinum(): 6 | """ Test that "Botulinum" data can be loaded. """ 7 | botulinum = data.botulinum() 8 | assert (botulinum.size, len(botulinum.dtype)) == (80, 28) 9 | 10 | 11 | def test_chrom17m(): 12 | """ Test that "chrom17m" data can be loaded. """ 13 | chrom17m = data.chrom17m() 14 | assert (chrom17m.size, len(chrom17m.dtype)) == (10, 3) 15 | 16 | def test_clinical_trial(): 17 | """ Test that "rb_clinical_trial" data can be loaded. """ 18 | clin = data.clinical_trial() 19 | assert (clin.size, len(clin.dtype)) == (272, 15) 20 | 21 | 22 | def test_confocal(): 23 | """ Test that "confocal" data can be loaded. """ 24 | confocal = data.confocal() 25 | assert (confocal.size, len(confocal.dtype)) == (112, 17) 26 | 27 | 28 | def test_germina(): 29 | """ Test that "germina" data can be loaded. """ 30 | germina = data.germina() 31 | assert (germina.size, len(germina.dtype)) == (40, 5) 32 | 33 | 34 | def test_kenya(): 35 | """ Test that "Kenya" data can be loaded. """ 36 | kenya = data.kenya() 37 | assert (kenya.size, len(kenya.dtype)) == (16, 3) 38 | 39 | 40 | def test_massaro_blair(): 41 | """ Test that "massaro_blair" data can be loaded. """ 42 | massaro_blair = data.massaro_blair() 43 | assert (massaro_blair.size, len(massaro_blair.dtype)) == (29, 2) 44 | 45 | 46 | def test_monachus(): 47 | """ Test that "monachus" data can be loaded. """ 48 | monachus = data.monachus() 49 | assert monachus.size == 12 50 | assert len(monachus.dtype) == 17 51 | 52 | 53 | def test_mult(): 54 | """ Test that "mult" data can be loaded. """ 55 | mult = data.mult() 56 | assert mult.size == 16 57 | assert len(mult.dtype) == 4 58 | 59 | 60 | def test_perch(): 61 | """ Test that "perch" data can be loaded. """ 62 | perch = data.perch() 63 | assert perch.size == 108 64 | assert len(perch.dtype) == 31 65 | 66 | 67 | def test_rats(): 68 | """ Test that "rats" data can be loaded. """ 69 | rats = data.rats() 70 | assert rats.size == 36 71 | assert len(rats.dtype) == 19 72 | 73 | 74 | def test_setig(): 75 | """ Test that "setig" data can be loaded. """ 76 | setig = data.setig() 77 | assert setig.size == 334 78 | assert len(setig.dtype) == 6 79 | 80 | 81 | def test_urology(): 82 | """ Test that "urology" data can be loaded. """ 83 | urology = data.urology() 84 | assert urology.size == 481 85 | assert len(urology.dtype) == 31 86 | 87 | 88 | def test_washing_test(): 89 | """ Test that "washing_test" data can be loaded. """ 90 | washing_test = data.washing_test() 91 | assert washing_test.size == 800 92 | assert len(washing_test.dtype) == 4 93 | 94 | 95 | def test_waterfalls(): 96 | """ Test that "waterfalls" data can be loaded. """ 97 | waterfalls = data.waterfalls() 98 | assert waterfalls.size == 42 99 | assert len(waterfalls.dtype) == 17 100 | 101 | 102 | def test_ipat(): 103 | """ Test that "ipat" data can be loaded. """ 104 | ipat = data.ipat() 105 | assert ipat.size == 20 106 | assert len(ipat.dtype) == 2 107 | 108 | 109 | def test_job(): 110 | """ Test that "job" data can be loaded. """ 111 | job = data.job() 112 | assert job.size == 20 113 | assert len(job.dtype) == 2 114 | 115 | 116 | def test_fly(): 117 | """ Test that "fly" data can be loaded. """ 118 | fly = data.fly() 119 | assert fly.size == 70 120 | assert len(fly.dtype) == 8 121 | 122 | 123 | def test_testosterone(): 124 | """ Test that "testosterone" data can be loaded. """ 125 | testosterone = data.testosterone() 126 | assert testosterone.size == 11 127 | assert len(testosterone.dtype) == 5 128 | 129 | 130 | def test_worms(): 131 | """ Test that "worms" data can be loaded. """ 132 | worms = data.worms() 133 | assert worms.size == 18 134 | assert len(worms.dtype) == 2 135 | -------------------------------------------------------------------------------- /permute/data/tests/test_macnell.py: -------------------------------------------------------------------------------- 1 | import permute.data as data 2 | from numpy.testing import assert_equal 3 | 4 | 5 | def test_macnell2014(): 6 | """ Test that "MacNell2014" data can be loaded. """ 7 | macnell = data.macnell2014() 8 | assert (macnell.size, len(macnell.dtype)) == (43, 20) 9 | -------------------------------------------------------------------------------- /permute/data/tests/test_nsgk.py: -------------------------------------------------------------------------------- 1 | import permute.data as data 2 | import numpy as np 3 | from numpy.testing import assert_equal 4 | 5 | 6 | def test_nsgk(): 7 | """ Test that "NSGK" data can be loaded. """ 8 | nsgk = data.nsgk() 9 | assert len(nsgk) == 183 10 | assert len(nsgk[0]) == 8 11 | assert nsgk[0][0].shape == (10, 36) 12 | assert nsgk[0][5].shape == (10, 35) 13 | assert nsgk[0][0].dtype == np.dtype('int32') 14 | assert nsgk[6][2].dtype == np.dtype('int32') 15 | yy = [x.sum() for y in nsgk for x in y] 16 | assert np.array(yy).sum() == 24713 17 | -------------------------------------------------------------------------------- /permute/ksample.py: -------------------------------------------------------------------------------- 1 | """ 2 | K-sample permutation tests. 3 | """ 4 | 5 | 6 | import numpy as np 7 | from scipy.optimize import brentq, fsolve 8 | from scipy.stats import ttest_ind, ttest_1samp 9 | 10 | from .utils import get_prng, permute, permute_within_groups 11 | 12 | 13 | def k_sample(x, group, reps=10**5, stat='one-way anova', 14 | keep_dist=False, seed=None, plus1=True): 15 | r""" 16 | k-sample permutation test for equality of more than 2 means, 17 | with p-value estimated by simulated random sampling with 18 | reps replications. 19 | 20 | Tests the hypothesis that groupings are a random partition of x 21 | against the alternative that at least one group comes from a 22 | population with mean different from the rest 23 | 24 | If ``keep_dist``, return the distribution of values of the test statistic; 25 | otherwise, return only the number of permutations for which the value of 26 | the test statistic and p-value. 27 | 28 | Parameters 29 | ---------- 30 | x : array-like 31 | Sample values 32 | group : array-like 33 | Group labels for each observation 34 | reps : int 35 | number of repetitions 36 | stat : {'one-way anova'} 37 | The test statistic. 38 | 39 | (a) If stat == 'one-way anova', use the sum of squared 40 | distances between the group means and the overall mean 41 | weighted by group size. 42 | $\sum_{k=1}^K n_k(\overline{X_k} - \overline{X})^2$ 43 | keep_dist : bool 44 | flag for whether to store and return the array of values 45 | of the irr test statistic 46 | seed : RandomState instance or {None, int, RandomState instance} 47 | If None, the pseudorandom number generator is the RandomState 48 | instance used by `np.random`; 49 | If int, seed is the seed used by the random number generator; 50 | If RandomState instance, seed is the pseudorandom number generator 51 | plus1 : bool 52 | flag for whether to add 1 to the numerator and denominator of the 53 | p-value based on the empirical permutation distribution. 54 | Default is True. 55 | 56 | Returns 57 | ------- 58 | float 59 | the estimated p-value 60 | float 61 | the test statistic 62 | list 63 | The distribution of test statistics. 64 | These values are only returned if `keep_dist` == True 65 | """ 66 | 67 | prng = get_prng(seed) 68 | 69 | # If stat is callable, use it as the test function. Otherwise, look in the 70 | # dictionary 71 | stats = { 72 | "one-way anova" : one_way_anova 73 | } 74 | if callable(stat): 75 | tst_fun = stat 76 | else: 77 | tst_fun = stats[stat] 78 | 79 | xbar = np.mean(x) 80 | observed_tst = tst_fun(x, group, xbar) 81 | 82 | if keep_dist: 83 | dist = np.empty(reps) 84 | for i in range(reps): 85 | group_perm = permute(group, prng) 86 | dist[i] = tst_fun(x, group_perm, xbar) 87 | pvalue = (plus1 + np.sum(dist >= observed_tst))/(plus1 + reps) 88 | return pvalue, observed_tst, dist 89 | else: 90 | hits = 0 91 | for i in range(reps): 92 | group_perm = permute(group, prng) 93 | tst = tst_fun(x, group_perm, xbar) 94 | if tst >= observed_tst: 95 | hits += 1 96 | return (plus1 + hits)/(plus1 + reps), observed_tst 97 | 98 | 99 | def one_way_anova(x, group, overall_mean): 100 | r""" 101 | Test statistic for one-way ANOVA 102 | 103 | Parameters 104 | ---------- 105 | x : array-like 106 | Sample values 107 | group : array-like 108 | Group labels for each observation 109 | overall_mean : float 110 | mean of x 111 | 112 | Returns 113 | ------- 114 | float 115 | the one-way ANOVA statistic 116 | $\sum_{k=1}^K n_k(\overline{X_k} - \overline{X})^2$ 117 | where $k$ indexes the groups 118 | """ 119 | x = np.array(x) 120 | tst = 0 121 | for k in np.unique(group): 122 | group_k = x[group == k] 123 | group_mean = np.mean(group_k) 124 | nk = len(group_k) 125 | tst += (group_mean - overall_mean)**2 * nk 126 | return tst 127 | 128 | 129 | def bivariate_k_sample(x, group1, group2, reps=10**5, stat='two-way anova', 130 | keep_dist=False, seed=None, plus1=True): 131 | r""" 132 | k-sample permutation test for equality of more than 2 means, 133 | with p-value estimated by simulated random sampling with 134 | reps replications. 135 | 136 | Tests the hypothesis that within grouping 1, grouping 2 is 137 | a random partition of x against the alternative that at 138 | least one group 2 comes from a population with mean different from the rest 139 | 140 | If ``keep_dist``, return the distribution of values of the test statistic; 141 | otherwise, return only the number of permutations for which the value of 142 | the test statistic and p-value. 143 | 144 | Parameters 145 | ---------- 146 | x : array-like 147 | Sample values 148 | group1 : array-like 149 | Fixed group labels for each observation 150 | group2 : array-like 151 | Group labels that, under the null, are exchangeable for each 152 | level of group1 153 | reps : int 154 | number of repetitions 155 | stat : {'two-way anova'} 156 | The test statistic. 157 | ; 158 | (a) If stat == 'two-way anova', use a simpler statistic that 159 | is permutationally equivalent to the F statistic: 160 | $SSB/(SST - SSB).$ 161 | $SSB$ is the sum of squared deviations from the 162 | overall mean for the group 2 means and $SST$ is 163 | the sum of squared deviations of all observations 164 | keep_dist : bool 165 | flag for whether to store and return the array of values 166 | of the irr test statistic 167 | seed : RandomState instance or {None, int, RandomState instance} 168 | If None, the pseudorandom number generator is the RandomState 169 | instance used by `np.random`; 170 | If int, seed is the seed used by the random number generator; 171 | If RandomState instance, seed is the pseudorandom number generator 172 | plus1 : bool 173 | flag for whether to add 1 to the numerator and denominator of the 174 | p-value based on the empirical permutation distribution. 175 | Default is True. 176 | 177 | Returns 178 | ------- 179 | float 180 | the estimated p-value 181 | float 182 | the test statistic 183 | list 184 | The distribution of test statistics. 185 | These values are only returned if `keep_dist` == True 186 | """ 187 | 188 | prng = get_prng(seed) 189 | 190 | # If stat is callable, use it as the test function. Otherwise, look in the 191 | # dictionary 192 | stats = { 193 | "two-way anova" : two_way_anova 194 | } 195 | if callable(stat): 196 | tst_fun = stat 197 | else: 198 | tst_fun = stats[stat] 199 | 200 | xbar = np.mean(x) 201 | observed_tst = tst_fun(x, group1, group2, xbar) 202 | 203 | if keep_dist: 204 | dist = np.empty(reps) 205 | for i in range(reps): 206 | group2_perm = permute_within_groups(group2, group1, prng) 207 | dist[i] = tst_fun(x, group1, group2_perm, xbar) 208 | pvalue = (plus1 + np.sum(dist >= observed_tst))/(plus1 + reps) 209 | return pvalue, observed_tst, dist 210 | else: 211 | hits = 0 212 | for i in range(reps): 213 | group2_perm = permute_within_groups(group2, group1, prng) 214 | tst = tst_fun(x, group1, group2_perm, xbar) 215 | if tst >= observed_tst: 216 | hits += 1 217 | return (plus1 + hits)/(plus1 + reps), observed_tst 218 | 219 | 220 | def two_way_anova(x, group1, group2, overall_mean): 221 | """ 222 | Test statistic for two-way ANOVA. The test statistic 223 | is permutationally equivalent to the F statistic. 224 | 225 | Parameters 226 | ---------- 227 | x : array-like 228 | Sample values 229 | group1 : array-like 230 | Fixed group labels for each observation 231 | group2 : array-like 232 | Group labels that, under the null, are exchangeable for each 233 | level of group1 234 | overall_mean : float 235 | mean of x 236 | 237 | Returns 238 | ------- 239 | float 240 | the statistic $SSB/(SST - SSB),$ where 241 | $SSB$ is the sum of squared deviations from the 242 | overall mean for the group 2 means and $SST$ is 243 | the sum of squared deviations of all observations 244 | """ 245 | sst = np.sum((x - overall_mean)**2) 246 | ss2 = 0 247 | for g in np.unique(group2): 248 | xx = x[group2 == g] 249 | ss2 += (np.mean(xx) - overall_mean)**2 250 | return ss2/(sst - ss2) 251 | -------------------------------------------------------------------------------- /permute/qa.py: -------------------------------------------------------------------------------- 1 | """ Quality assurance and data cleaning. 2 | """ 3 | 4 | 5 | import numpy as np 6 | 7 | 8 | def find_duplicate_rows(x, as_string=False): 9 | r""" Find rows which are duplicated in x 10 | 11 | Notes 12 | ----- 13 | If you load a file, for example `nsgk.csv`, as a 2D array, say `x`, 14 | then if you found '16,20,2,8' in the list returned by 15 | ``find_duplicate_rows(x, as_string=True)`` you might do something like:: 16 | 17 | $ grep -n --context=1 '16,20,2,8' nsgk.csv 18 | 12512-16,15,2,8 19 | 12513:16,20,2,8 20 | 12514-16,45,2,8 21 | -- 22 | 12532-17,17,2,8 23 | 12533:16,20,2,8 24 | 12534-17,24,2,8 25 | 26 | http://stackoverflow.com/questions/8560440/removing-duplicate-columns-and-rows-from-a-numpy-2d-array 27 | """ 28 | indx = np.lexsort(x.T) 29 | x = x[indx] 30 | diff = np.diff(x, axis=0) 31 | indx = np.any(diff, axis=1) 32 | dups = x[1:, :][~indx, ] 33 | if as_string: 34 | dups = [",".join([str(c) for c in r.tolist()]) for r in dups] 35 | return dups 36 | 37 | 38 | def find_consecutive_duplicate_rows(x, as_string=False): 39 | r""" Find rows which are duplicated in x 40 | """ 41 | indx = [] 42 | prev = x[0] 43 | for i, r in enumerate(x[1:]): 44 | if (r == prev).all(): 45 | indx.append(i) 46 | prev = r 47 | dups = x[indx] 48 | if as_string: 49 | dups = [",".join([str(c) for c in r.tolist()]) for r in dups] 50 | return dups 51 | -------------------------------------------------------------------------------- /permute/sprt.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sequential Probability Ratio Tests 3 | """ 4 | import numpy as np 5 | 6 | def sprt(likelihood_ratio, alpha, beta, x, random_order = True): 7 | """ 8 | Performs sequential probability ratio test with desired likelihood ratio. 9 | Parameters 10 | ---------- 11 | likelihood_ratio : function 12 | likelihood ratio function with one parameter, x, the sample values 13 | alpha : float 14 | Type I Error 15 | beta : float 16 | Type II Error 17 | x : list 18 | list of sample values 19 | random_order : boolean (default : True) 20 | True: sample values in random order 21 | False: sample values not in random order 22 | 23 | Returns 24 | ------- 25 | Array 26 | ordered pair of booleans (reject ho, reject ha) 27 | Float 28 | Likelihood ratio 29 | """ 30 | 31 | # calculate stopping rule values 32 | A, B = beta / (1 - alpha), (1 - beta) / alpha 33 | 34 | ts = 1 35 | index = 0 36 | if random_order: 37 | while (ts > A and ts < B and index < len(x)): 38 | ts = likelihood_ratio(x[0:index]) 39 | index += 1 40 | else: 41 | ts = likelihood_ratio(x) 42 | 43 | # get conclusion of test 44 | if ts >= B: 45 | conclusion = [True, False] 46 | elif ts <= A: 47 | conclusion = [False, True] 48 | else: 49 | conclusion = [False, False] 50 | 51 | return [conclusion, ts] 52 | 53 | 54 | def bernoulli_lh_ratio(x, po, pa): 55 | """ 56 | Returns the likelihood ratio for independently distributed bernoulli random variables. 57 | Parameters 58 | ---------- 59 | x : float or int 60 | sample 61 | po : float 62 | probability of success under null hypothesis 63 | pa : float 64 | probability of success under alternative hypothesis 65 | 66 | Returns 67 | ------- 68 | float 69 | likelihood ratio 70 | """ 71 | return (pa ** np.sum(x)) * (1 - pa)**(len(x) - np.sum(x)) / ((po ** np.sum(x)) * (1 - po)**(len(x) - np.sum(x))) -------------------------------------------------------------------------------- /permute/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/statlab/permute/ef72da3394ca82c04a035c5fcdefe524eea62c45/permute/tests/__init__.py -------------------------------------------------------------------------------- /permute/tests/test_SPRT.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit Tests for sprt.py 3 | """ 4 | import math 5 | import numpy as np 6 | 7 | from ..sprt import (sprt, bernoulli_lh_ratio) 8 | 9 | 10 | def test_sprt(): 11 | np.random.seed(5) 12 | # random_order and do not reject ho 13 | res = sprt(lambda x: bernoulli_lh_ratio(x, .5, .1), .05, .05, [0, 1]*10, True) 14 | assert res[0] == [False, True] 15 | # random_order and do reject ho 16 | res = sprt(lambda x: bernoulli_lh_ratio(x, .1, .5), .05, .05, [0, 1]*10, True) 17 | assert res[0] == [True, False] 18 | # not random_order and do not reject ho 19 | res = sprt(lambda x: bernoulli_lh_ratio(x, .5, .1), .05, .05, [1, 1], False) 20 | assert res[0] == [False, True] 21 | assert res[1] == 0.1**2/0.5**2 22 | # not random_order and inconclusive test 23 | res = sprt(lambda x: bernoulli_lh_ratio(x, .5, .1), .05, .05, [0, 0], False) 24 | assert res[0] == [False, False] 25 | assert res[1] == 0.9**2/0.5**2 26 | -------------------------------------------------------------------------------- /permute/tests/test_importing.py: -------------------------------------------------------------------------------- 1 | import contextlib 2 | import sys 3 | 4 | import pytest 5 | 6 | 7 | class DummyFile: 8 | 9 | def write(self, x): 10 | pass 11 | 12 | 13 | 14 | def test_pytest_import_error1(): 15 | _tmp = sys.modules['pytest'] 16 | sys.modules['pytest'] = None 17 | try: 18 | from .. import test 19 | pytest.raises(ImportError, test) 20 | finally: 21 | sys.modules['pytest'] = _tmp 22 | 23 | 24 | @contextlib.contextmanager 25 | def test_permute_tst(): 26 | from .. import test 27 | save_stderr = sys.stderr 28 | sys.stderr = DummyFile() 29 | test(dry_run=True) 30 | test(doctest=True, dry_run=True) 31 | test(run_all=False, dry_run=True) 32 | test(doctest=True, verbose=True, dry_run=True) 33 | sys.stderr = save_stderr 34 | -------------------------------------------------------------------------------- /permute/tests/test_irr.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import numpy as np 4 | 5 | from ..irr import (compute_ts, 6 | simulate_ts_dist, 7 | simulate_npc_dist) 8 | 9 | from ..data import nsgk 10 | 11 | R = 10 12 | Ns = 35 13 | 14 | from numpy.random import RandomState 15 | RNG = RandomState(42) 16 | res = RNG.binomial(1, .5, (R, Ns)) 17 | 18 | 19 | def test_irr(): 20 | rho_s = compute_ts(res) 21 | np.testing.assert_almost_equal(rho_s, 0.51936507) 22 | 23 | 24 | def test_simulate_ts_dist(): 25 | expected_res1 = {'dist': None, 26 | 'geq': 591, 27 | 'obs_ts': 0.51936507936507936, 28 | 'pvalue': 0.0591, 29 | 'num_perm': 10000} 30 | res1 = simulate_ts_dist(res, seed=42, plus1=False) 31 | np.testing.assert_equal(res1, expected_res1) 32 | expected_res2 = {'geq': 9507, 33 | 'obs_ts': 0.46285714285714286, 34 | 'num_perm': 10000} 35 | res2 = simulate_ts_dist(res[:5], seed=42, keep_dist=True) 36 | assert res2['geq'] == expected_res2['geq'] 37 | assert res2['obs_ts'] == expected_res2['obs_ts'] 38 | assert res2['num_perm'] == expected_res2['num_perm'] 39 | assert res2['dist'].shape == (10000,) 40 | 41 | 42 | def test_with_naomi_data(): 43 | """ Test irr functionality using Naomi data.""" 44 | x = nsgk() 45 | t = x[1] 46 | y = t[0] 47 | res = simulate_ts_dist(y, num_perm=10, keep_dist=True, seed=42, plus1=False) 48 | expected_res = {'dist': np.array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]), 49 | 'geq': 10, 50 | 'num_perm': 10, 51 | 'pvalue': 1, 52 | 'obs_ts': 1.0} 53 | np.testing.assert_equal(res, expected_res) 54 | 55 | 56 | freq = RNG.choice([0.2, 0.8], Ns) 57 | res2 = np.zeros((R, Ns)) 58 | 59 | for i in range(len(freq)): 60 | res2[:, i] = RNG.binomial(1, freq[i], R) 61 | 62 | 63 | def test_irr_concordance(): 64 | rho_s2 = compute_ts(res2) 65 | np.testing.assert_almost_equal(rho_s2, 0.70476190476190481) 66 | 67 | 68 | def test_simulate_ts_dist_concordance(): 69 | expected_res_conc = {'dist': None, 70 | 'geq': 0, 71 | 'obs_ts': 0.70476190476190481, 72 | 'pvalue': 1/10001, 73 | 'num_perm': 10000} 74 | res_conc = simulate_ts_dist(res2, seed=42) 75 | np.testing.assert_equal(res_conc, expected_res_conc) 76 | 77 | 78 | res1 = simulate_ts_dist(res, keep_dist=True, seed=42) 79 | res_conc = simulate_ts_dist(res2, keep_dist=True, seed=42) 80 | true_pvalue = np.array( 81 | [res1['geq'] / res1['num_perm'], res_conc['geq'] / res_conc['num_perm']]) 82 | rho_perm = np.transpose(np.vstack((res1['dist'], res_conc['dist']))) 83 | 84 | 85 | def test_simulate_npc_dist(): 86 | expected_npc_res = {'num_perm': 10000, 87 | 'obs_npc': -0.00998, 88 | 'pvalue': 0.0016} 89 | obs_npc_res = simulate_npc_dist( 90 | rho_perm, size=np.array([Ns, Ns]), pvalues=true_pvalue) 91 | assert obs_npc_res['num_perm'] == expected_npc_res['num_perm'] 92 | np.testing.assert_almost_equal(obs_npc_res['obs_npc'], expected_npc_res['obs_npc'], 3) 93 | np.testing.assert_almost_equal(obs_npc_res['pvalue'], expected_npc_res['pvalue'], 3) 94 | 95 | 96 | def test_simulate_npc_error(): 97 | pytest.raises(ValueError, simulate_npc_dist, rho_perm, size=np.array([Ns, Ns])) 98 | 99 | 100 | def test_simulate_npc_perfect(): 101 | mat1 = np.tile(np.array([1, 0, 1, 0, 0]), (5, 1)) 102 | mat2 = np.tile(np.array([0, 1, 0]), (5, 1)) 103 | videos = [mat1, mat2] 104 | time_stamps = np.array([5, 3]) 105 | d = [] # list of the permutation distributions for each video 106 | tst = [] # list of test statistics for each video 107 | pval = [] 108 | for j in range(len(videos)): # loop over videos 109 | res = simulate_ts_dist(videos[j], keep_dist=True, seed=5) 110 | d.append(res['dist']) 111 | tst.append(res['obs_ts']) 112 | pval.append(res['pvalue']) 113 | perm_distr = np.asarray(d).transpose() 114 | overall1 = simulate_npc_dist( 115 | perm_distr, size=time_stamps, pvalues=np.array(pval), plus1=False) 116 | overall2 = simulate_npc_dist( 117 | perm_distr, size=time_stamps, obs_ts=tst) 118 | expected_overall = {'num_perm': 10000, 119 | 'obs_npc': -0.007709695302872763, 120 | 'pvalue': 0.0} 121 | np.testing.assert_almost_equal(overall1['obs_npc'], expected_overall['obs_npc'], 3) 122 | np.testing.assert_almost_equal(overall2['obs_npc'], expected_overall['obs_npc'], 3) 123 | -------------------------------------------------------------------------------- /permute/tests/test_ksample.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from scipy.stats import hypergeom, binom 3 | from cryptorandom.cryptorandom import SHA256 4 | 5 | from ..ksample import (k_sample, 6 | one_way_anova, 7 | bivariate_k_sample, 8 | two_way_anova) 9 | import permute.data as data 10 | from permute.utils import get_prng 11 | 12 | 13 | def test_worms_ksample(): 14 | worms = data.worms() 15 | res = k_sample(worms.x, worms.y, stat='one-way anova', reps=1000, seed=1234) 16 | np.testing.assert_array_less(0.006, res[0]) 17 | np.testing.assert_array_less(res[0], 0.02) 18 | 19 | 20 | def test_one_way_anova(): 21 | group = np.ones(5) 22 | x = np.array(range(5)) 23 | xbar = np.mean(x) 24 | assert one_way_anova(x, group, xbar) == 0 25 | 26 | group = np.array([1]*3 + [2]*2) 27 | expected = 3*1**2 + 2*1.5**2 28 | assert one_way_anova(x, group, xbar) == expected 29 | 30 | 31 | def test_two_way_anova(): 32 | prng = get_prng(100) 33 | group1 = np.array([1]*5 + [2]*5) 34 | group2 = np.array(list(range(5))*2) 35 | x = prng.randint(1, 10, 10) 36 | xbar = np.mean(x) 37 | val = two_way_anova(x, group1, group2, xbar) 38 | np.testing.assert_almost_equal(val, 0.296, 3) 39 | 40 | x = group2 + 1 41 | xbar = 3 42 | assert two_way_anova(x, group1, group2, xbar) == 1 43 | 44 | 45 | def test_testosterone_ksample(): 46 | testosterone = data.testosterone() 47 | x = np.hstack(testosterone.tolist()) 48 | group1 = np.hstack([[i]*5 for i in range(len(testosterone))]) 49 | group2 = np.array(list(range(5))*len(testosterone)) 50 | assert len(group1) == 55 51 | assert len(group2) == 55 52 | assert len(x) == 55 53 | res = bivariate_k_sample(x, group1, group2, reps=5000, seed=5) 54 | np.testing.assert_array_less(res[0], 0.0002) 55 | -------------------------------------------------------------------------------- /permute/tests/test_npc.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import numpy as np 4 | from numpy.random import RandomState 5 | from scipy.stats import norm 6 | 7 | from ..npc import (fisher, 8 | liptak, 9 | tippett, 10 | inverse_n_weight, 11 | npc, 12 | check_combfunc_monotonic, 13 | sim_npc, 14 | westfall_young, 15 | adjust_p, 16 | fwer_minp, 17 | randomize_group, 18 | Experiment) 19 | 20 | 21 | def test_fisher(): 22 | pvalues = np.linspace(0.05, 0.9, num=5) 23 | np.testing.assert_almost_equal(fisher(pvalues), 11.11546, 5) 24 | np.testing.assert_equal(fisher(1), -0.0) 25 | np.testing.assert_array_less(fisher(10), 0) 26 | 27 | 28 | def test_liptak(): 29 | pvalues = np.linspace(0.05, 0.9, num=5) 30 | np.testing.assert_almost_equal(liptak(pvalues), 0.5728894, 5) 31 | np.testing.assert_equal(liptak(1), norm.ppf(0)) 32 | np.testing.assert_equal(liptak(10), np.nan) 33 | 34 | 35 | def test_tippett(): 36 | pvalues = np.linspace(0.05, 0.9, num=5) 37 | np.testing.assert_almost_equal(tippett(pvalues), 0.95, 5) 38 | np.testing.assert_equal(tippett(1), 0) 39 | np.testing.assert_equal(tippett(10), -9) 40 | 41 | 42 | def test_inverse_n_weight(): 43 | pval = np.array([0.5, 0.25, 0.75]) 44 | size = np.array([2, 4, 6]) 45 | expected_npc = -0.7847396 46 | res_npc = inverse_n_weight(pval, size) 47 | np.testing.assert_almost_equal(expected_npc, res_npc) 48 | 49 | 50 | def test_npc(): 51 | prng = RandomState(55) 52 | pvalues = np.linspace(0.05, 0.9, num=5) 53 | distr = prng.uniform(low=0, high=10, size=500).reshape(100, 5) 54 | res = npc(pvalues, distr, "fisher", plus1=False) 55 | np.testing.assert_almost_equal(res, 0.33) 56 | res = npc(pvalues, distr, "liptak", plus1=False) 57 | np.testing.assert_almost_equal(res, 0.35) 58 | res = npc(pvalues, distr, "tippett", plus1=False) 59 | np.testing.assert_almost_equal(res, 0.25) 60 | 61 | 62 | def test_npc_callable_combine(): 63 | prng = RandomState(55) 64 | pvalues = np.linspace(0.05, 0.9, num=5) 65 | distr = prng.uniform(low=0, high=10, size=500).reshape(100, 5) 66 | size = np.array([2, 4, 6, 4, 2]) 67 | combine = lambda p: inverse_n_weight(p, size) 68 | res = npc(pvalues, distr, combine, plus1=False) 69 | np.testing.assert_equal(res, 0.39) 70 | 71 | 72 | def test_npc_bad_distr(): 73 | prng = RandomState(55) 74 | pvalues = np.linspace(0.05, 0.9, num=5) 75 | distr = prng.uniform(low=0, high=10, size=20).reshape(10, 2) 76 | pytest.raises(ValueError, npc, pvalues, distr, "fisher") 77 | 78 | 79 | def test_npc_single_pvalue(): 80 | pytest.raises(ValueError, npc, np.array([1]), np.array([1, 2, 3])) 81 | 82 | 83 | def test_monotonic_checker(): 84 | pvalues = np.array([0.1, 0.2, 0.3]) 85 | np.testing.assert_equal(check_combfunc_monotonic(pvalues, fisher), True) 86 | np.testing.assert_equal(check_combfunc_monotonic(pvalues, liptak), True) 87 | np.testing.assert_equal(check_combfunc_monotonic(pvalues, tippett), True) 88 | 89 | comb_function = lambda p: inverse_n_weight(p, np.array([2, 4, 6])) 90 | np.testing.assert_equal(check_combfunc_monotonic(pvalues, comb_function), True) 91 | 92 | bad_comb_function = lambda p: -1*fisher(p) 93 | np.testing.assert_equal(check_combfunc_monotonic(pvalues, bad_comb_function), False) 94 | 95 | 96 | def test_mono_checker_in_npc(): 97 | prng = RandomState(55) 98 | pvalues = np.linspace(0.05, 0.9, num=5) 99 | distr = prng.uniform(low=0, high=10, size=500).reshape(100, 5) 100 | bad_comb_function = lambda p: -1*fisher(p) 101 | pytest.raises(ValueError, npc, pvalues, distr, bad_comb_function) 102 | 103 | 104 | def test_minp_bad_distr(): 105 | prng = RandomState(55) 106 | pvalues = np.linspace(0.05, 0.9, num=5) 107 | distr = prng.uniform(low=0, high=10, size=20).reshape(10, 2) 108 | pytest.raises(ValueError, fwer_minp, pvalues, distr, "fisher") 109 | 110 | 111 | def test_minp_one_pvalue(): 112 | prng = RandomState(55) 113 | pvalues = np.array([1]) 114 | distr = prng.uniform(low=0, high=10, size=20).reshape(20, 1) 115 | pytest.raises(ValueError, fwer_minp, pvalues, distr, "fisher") 116 | 117 | 118 | def test_sim_npc(): 119 | prng = RandomState(55) 120 | # test Y always greater than X so p-value should be 1 121 | responses = np.array([[0, 1], [0, 1], [1, 2], [1, 2]]) 122 | group = np.array([1, 1, 2, 2]) 123 | my_randomizer = Experiment.Randomizer(randomize = randomize_group, seed = prng) 124 | data = Experiment(group, responses) 125 | 126 | # create median test statistic to apply to every column 127 | def med_diff(data, resp_index): 128 | # get response variable for that index 129 | resp = np.array([item[resp_index] for item in data.response]) 130 | # get unique groups 131 | groups = np.unique(data.group) 132 | # get mean for each group 133 | mx = np.nanmean(resp[data.group == groups[0]]) 134 | my = np.nanmean(resp[data.group == groups[1]]) 135 | return mx-my 136 | 137 | test_array = Experiment.make_test_array(med_diff, [0, 1]) 138 | res = sim_npc(data, test_array, combine="fisher", seed=None, reps=int(1000)) 139 | np.testing.assert_almost_equal(res[0], 1) 140 | 141 | # test X = Y so p-value should be 1 142 | responses = np.array([[0, 1], [0, 1], [0, 1], [0, 1]]) 143 | group = np.array([1, 1, 2, 2]) 144 | data = Experiment(group, responses, randomizer = my_randomizer) 145 | res = sim_npc(data, test = Experiment.make_test_array(Experiment.TestFunc.mean_diff, [0, 1]), 146 | combine="fisher", seed=None, reps=int(1000)) 147 | np.testing.assert_almost_equal(res[0], 1) 148 | 149 | # test stat for cat_1 is smaller if X all 0s which about 0.015 chance so pvalue should be about 0.985 150 | responses = np.array([[0, 1], [1, 1], [0, 1], [0, 1], [1, 1], [1, 1], [1, 1], [0, 1]]) 151 | group = np.array([1, 1, 1, 1, 2, 2, 2, 2]) 152 | data = Experiment(group, responses, randomizer = my_randomizer) 153 | res = sim_npc(data, test = Experiment.make_test_array(Experiment.TestFunc.mean_diff, [0, 1]), 154 | combine="fisher", seed=None, reps=int(1000)) 155 | np.testing.assert_almost_equal(res[0], 0.985, decimal = 2) 156 | 157 | 158 | def test_westfall_young(): 159 | prng = RandomState(55) 160 | # test from https://support.sas.com/kb/22/addl/fusion22950_1_multtest.pdf 161 | group = np.array([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]) 162 | responses = np.array([[14.4, 7.00, 4.30], [14.6, 7.09, 3.88 ], [13.8, 7.06, 5.34], [10.1, 4.26, 4.26], [11.1, 5.49, 4.52], [12.4, 6.13, 5.69], [12.7, 6.69, 4.45], [11.8, 5.44, 3.94], [18.3, 1.28, 0.67], [18.0, 1.50, 0.67], [20.8, 1.51, 0.72], [18.3, 1.14, 0.67], [14.8, 2.74, 0.67], [13.8, 7.08, 3.43], [11.5, 6.37, 5.64], [10.9, 6.26, 3.47]]) 163 | data = Experiment(group, responses) 164 | test = Experiment.make_test_array(Experiment.TestFunc.ttest, [0, 1, 2]) 165 | result = westfall_young(data, test, method = "minP", alternatives = 'two-sided', seed = prng) 166 | np.testing.assert_almost_equal(result[0][0], 0.1, decimal = 1) 167 | np.testing.assert_almost_equal(result[0][1], 0.05, decimal = 2) 168 | np.testing.assert_almost_equal(result[0][2], 0.02, decimal = 2) 169 | np.testing.assert_almost_equal(result[1][0], 0.1, decimal = 1) 170 | np.testing.assert_almost_equal(result[1][1], 0.03, decimal = 2) 171 | np.testing.assert_almost_equal(result[1][2], 0.01, decimal = 2) 172 | 173 | 174 | def test_adjust_p(): 175 | pvalues = np.array([0.1, 0.2, 0.3, 0.4]) 176 | # bonferroni 177 | res = adjust_p(pvalues, adjustment = 'bonferroni') 178 | np.testing.assert_almost_equal(res, np.array([0.4, 0.8, 1, 1]), decimal = 2) 179 | # holm-bonferroni 180 | pvalues = np.array([0.01, 0.04, 0.03, 0.005]) 181 | res = adjust_p(pvalues, adjustment = 'holm-bonferroni') 182 | np.testing.assert_almost_equal(res, np.array([0.03, 0.06, 0.06, 0.02]), decimal = 2) 183 | # benjamini hochberg 184 | res = adjust_p(pvalues, adjustment = 'benjamini-hochberg') 185 | np.testing.assert_almost_equal(res, np.array([0.02, 0.04, 0.04, 0.02]), decimal = 2) 186 | # raises value error for nonsense correction 187 | pytest.raises(ValueError, adjust_p, pvalues, 'nonsense') 188 | 189 | 190 | def test_fwer_minp(): 191 | prng = RandomState(55) 192 | pvalues = np.linspace(0.05, 0.9, num=5) 193 | distr = prng.uniform(low=0, high=10, size=100000).reshape(20000, 5) 194 | res = fwer_minp(pvalues, distr, "fisher", plus1=False) 195 | expected_res = np.array([0.348594, 0.744245, 0.874132, 0.915783, 0.915783]) 196 | np.testing.assert_almost_equal(res, expected_res, decimal=2) 197 | res = fwer_minp(pvalues, distr, "tippett", plus1=False) 198 | expected_res = np.array([0.2262191, 0.704166, 0.8552969, 0.9023438, 0.9023438]) 199 | np.testing.assert_almost_equal(res, expected_res, decimal=2) 200 | -------------------------------------------------------------------------------- /permute/tests/test_qa.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | from ..qa import (find_duplicate_rows, 4 | find_consecutive_duplicate_rows) 5 | 6 | 7 | def test_find_duplicate_rows(): 8 | x = np.array([[1, 2, 3], 9 | [2, 3, 1], 10 | [1, 2, 3]]) 11 | res1 = find_duplicate_rows(x) 12 | res2 = find_duplicate_rows(x, as_string=True) 13 | np.testing.assert_equal(res1, np.array([[1, 2, 3]])) 14 | np.testing.assert_equal(res2, ['1,2,3']) 15 | 16 | 17 | def test_find_consecutive_duplicate_rows(): 18 | x = np.array([[1, 2, 3], 19 | [1, 2, 3], 20 | [1, 1, 1], 21 | [1, 1, 1], 22 | [1, 2, 3]]) 23 | res1 = find_consecutive_duplicate_rows(x) 24 | res2 = find_consecutive_duplicate_rows(x, as_string=True) 25 | np.testing.assert_equal(res1, np.array([[1, 2, 3], [1, 1, 1]])) 26 | np.testing.assert_equal(res2, ['1,2,3', '1,1,1']) 27 | -------------------------------------------------------------------------------- /permute/tests/test_stratified.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import math 3 | from numpy.random import RandomState 4 | 5 | import pytest 6 | from cryptorandom.cryptorandom import SHA256 7 | 8 | from ..stratified import stratified_permutationtest as spt 9 | from ..stratified import stratified_permutationtest_mean as sptm 10 | from ..stratified import corrcoef, sim_corr, stratified_two_sample 11 | 12 | 13 | def test_stratified_permutationtest(): 14 | group = np.repeat([1, 2, 3], 9) 15 | condition = np.repeat([1, 2, 3] * 3, 3) 16 | response = np.zeros_like(group) 17 | response[[0, 1, 3, 9, 10, 11, 18, 19, 20]] = 1 18 | 19 | res = spt(group, condition, response, reps=1000, seed=42) 20 | res1 = spt(group, condition, response, alternative='less', reps=1000, seed=42) 21 | assert res[0] < 0.01 22 | assert res[1] == res1[1] 23 | np.testing.assert_almost_equal(res[0], 1-res1[0]) 24 | res2 = spt(group, condition, response, alternative='two-sided', reps=1000, seed=42) 25 | assert res2[0] < 0.02 26 | 27 | group = np.array([1, 1, 1]) 28 | condition = np.array([2, 2, 2]) 29 | response = np.zeros_like(group) 30 | res2 = spt(group, condition, response, reps=1000, seed=42) 31 | assert res2 == (1.0, np.nan, None) 32 | 33 | 34 | def test_stratified_permutationtest_mean(): 35 | group = np.array([1, 2, 1, 2]) 36 | condition = np.array([1, 1, 2, 2]) 37 | response = np.zeros_like(group) 38 | groups = np.unique(group) 39 | conditions = np.unique(condition) 40 | res = sptm(group, condition, response, groups, conditions) 41 | assert res == 0.0 42 | res2 = sptm(group, condition, response) # check defaults work 43 | assert res2 == 0.0 44 | 45 | 46 | def test_stratified_permutationtest_mean_error(): 47 | group = np.array([1, 1, 1]) 48 | condition = np.array([2, 2, 2]) 49 | response = np.zeros_like(group) 50 | groups = np.unique(group) 51 | conditions = np.unique(condition) 52 | pytest.raises(ValueError, sptm, group, condition, response, groups, conditions) 53 | 54 | 55 | def test_corrcoef(): 56 | prng = RandomState(42) 57 | x = prng.rand(10) 58 | y = x 59 | group = prng.randint(3, size=10) 60 | res1 = corrcoef(x, y, group) 61 | res2 = corrcoef(x, y, group) 62 | assert res1 == res2 63 | 64 | 65 | def test_sim_corr(): 66 | prng = SHA256(42) 67 | x = prng.random(10) 68 | y = x 69 | group = prng.randint(0, 3, size=10) 70 | res1 = sim_corr(x, y, group, seed=prng, reps=100) 71 | res2 = sim_corr(x, y, group, seed=prng, alternative='less', reps=100) 72 | res3 = sim_corr(x, y, group, seed=prng, alternative='two-sided', reps=100) 73 | 74 | np.testing.assert_almost_equal(res1[0], 1-res2[0]) 75 | assert res1[1] == res2[1] 76 | assert res1[1] == res3[1] 77 | assert 2*res1[0] == res3[0] 78 | 79 | 80 | def test_strat_tests_equal(): 81 | group = np.repeat([1, 2, 3], 10) 82 | condition = np.repeat([1, 2] * 3, 5) 83 | response = np.zeros_like(group) 84 | response[[0, 1, 3, 9, 10, 11, 18, 19, 20]] = 1 85 | 86 | res1 = spt(group, condition, response, reps=100, seed=42) 87 | res2 = stratified_two_sample(group, condition, response, reps=100, 88 | stat='mean_within_strata', seed=42) 89 | assert res1[1] == res2[1] 90 | assert math.fabs(res1[0]-res2[0]) < 0.05 91 | 92 | def test_stratified_two_sample(): 93 | group = np.repeat([1, 2, 3], 10) 94 | condition = np.repeat([1, 2] * 3, 5) 95 | response = np.zeros_like(group) 96 | response[[0, 1, 3, 9, 10, 11, 18, 19, 20]] = 1 97 | 98 | res = stratified_two_sample(group, condition, response, reps=1000, 99 | stat='mean', seed=42) 100 | np.testing.assert_almost_equal(res[0], 0.245, 2) 101 | assert res[1] == 0.2 102 | 103 | (p, t, dist) = stratified_two_sample(group, condition, response, reps=1000, 104 | stat='mean', seed=42, keep_dist=True) 105 | assert res == (p, t) 106 | 107 | stat_fun = lambda u: sptm(group, condition, u, np.unique(group), np.unique(condition)) 108 | res = stratified_two_sample(group, condition, response, reps=100, 109 | stat=stat_fun, seed=42) 110 | np.testing.assert_almost_equal(res[0], 0.8712, 3) 111 | assert res[1] == 0.30 112 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | -r requirements/default.txt 2 | -r requirements/test.txt 3 | -r requirements/doc.txt 4 | -------------------------------------------------------------------------------- /requirements/README.md: -------------------------------------------------------------------------------- 1 | # pip requirements files 2 | 3 | ## Index 4 | 5 | - [`default.txt`](default.txt) 6 | Default requirements 7 | - [`doc.txt`](doc.txt) 8 | Requirements for building website 9 | - [`test.txt`](test.txt) 10 | Requirements for running test suite 11 | - [`release.txt`](release.txt) 12 | Requirements for making releases 13 | 14 | ## Examples 15 | 16 | ### Installing requirements 17 | 18 | ```bash 19 | $ pip install -U -r requirements/default.txt 20 | ``` 21 | 22 | ### Running the tests 23 | 24 | ```bash 25 | $ pip install -U -r requirements/default.txt 26 | $ pip install -U -r requirements/test.txt 27 | ``` 28 | -------------------------------------------------------------------------------- /requirements/default.txt: -------------------------------------------------------------------------------- 1 | numpy>=1.20,<1.24 2 | scipy>=1.8 3 | cryptorandom>=0.3 4 | -------------------------------------------------------------------------------- /requirements/doc.txt: -------------------------------------------------------------------------------- 1 | Sphinx>=5.3 2 | ghp-import~=2.1 3 | matplotlib>=3.6 4 | sphinx-bootstrap-theme==0.8.1 5 | sphinxcontrib-bibtex~=2.5 6 | numpydoc>=1.5 7 | nb2plots>=0.6.1 8 | texext>=0.6.7 9 | -------------------------------------------------------------------------------- /requirements/release.txt: -------------------------------------------------------------------------------- 1 | wheel>=0.36 2 | twine>=3.4 3 | -------------------------------------------------------------------------------- /requirements/test.txt: -------------------------------------------------------------------------------- 1 | pytest>=7.2 2 | pytest-cov>=4 3 | codecov>=2.1 4 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Permutation tests and confidence sets for Python 3 | """ 4 | 5 | import os 6 | 7 | 8 | DISTNAME = "permute" 9 | DESCRIPTION = "Permutation tests and confidence sets for Python" 10 | AUTHOR = "K. Jarrod Millman, Kellie Ottoboni, and Philip B. Stark" 11 | AUTHOR_EMAIL = "permute@googlegroups.com" 12 | URL = "http://statlab.github.io/permute/" 13 | LICENSE = "BSD License" 14 | DOWNLOAD_URL = "http://github.com/statlab/permute" 15 | 16 | 17 | def parse_requirements_file(filename): 18 | with open(filename, encoding="utf-8") as fid: 19 | requires = [l.strip() for l in fid.readlines() if l] 20 | 21 | return requires 22 | 23 | 24 | INSTALL_REQUIRES = parse_requirements_file("requirements/default.txt") 25 | TESTS_REQUIRE = parse_requirements_file("requirements/test.txt") 26 | 27 | with open("permute/__init__.py") as fid: 28 | for line in fid: 29 | if line.startswith("__version__"): 30 | VERSION = line.strip().split()[-1][1:-1] 31 | break 32 | 33 | with open("README.rst") as fh: 34 | LONG_DESCRIPTION = fh.read() 35 | 36 | 37 | if __name__ == "__main__": 38 | 39 | from setuptools import setup 40 | 41 | setup( 42 | name=DISTNAME, 43 | version=VERSION, 44 | license=LICENSE, 45 | description=DESCRIPTION, 46 | long_description=LONG_DESCRIPTION, 47 | author=AUTHOR, 48 | author_email=AUTHOR_EMAIL, 49 | url=URL, 50 | download_url=DOWNLOAD_URL, 51 | classifiers=[ 52 | "Development Status :: 3 - Alpha", 53 | "Environment :: Console", 54 | "Intended Audience :: Developers", 55 | "Intended Audience :: Science/Research", 56 | "License :: OSI Approved :: BSD License", 57 | "Programming Language :: Python", 58 | "Programming Language :: Python :: 3.8", 59 | "Programming Language :: Python :: 3.9", 60 | "Programming Language :: Python :: 3.10", 61 | "Topic :: Scientific/Engineering", 62 | "Operating System :: Microsoft :: Windows", 63 | "Operating System :: POSIX", 64 | "Operating System :: Unix", 65 | "Operating System :: MacOS", 66 | ], 67 | install_requires=INSTALL_REQUIRES, 68 | tests_require=TESTS_REQUIRE, 69 | python_requires=">=3.8", 70 | packages=["permute", "permute.tests", "permute.data", "permute.data.tests"], 71 | package_data={"permute.data": ["*.csv", "*/*.csv", "*/*/*.csv"]}, 72 | ) 73 | --------------------------------------------------------------------------------