Skip to main content

A python implementation of Manly randomization test

Project description

manly_randomization_test

B. F. J. Manly was a statistician who wrote several influential books and papers on multivariate statistical methods, biostatistics, and methods for randomization tests.

A randomization test is a type of non-parametric test that allows us to test hypotheses without requiring assumptions about the specific distribution of the data. It's also known as a permutation test or re-randomization test.

In the case of comparing means between two groups, a randomization test can be used in place of a traditional t-test when the assumptions of the t-test are not met (for example, if the data do not follow a normal distribution, or if the sample size is very small).

Here is an overview of how a randomization test between means is conducted:

Calculate the observed difference between the two group means. 
    This will serve as your test statistic.
Combine all the observations from both groups into a single group.
Randomly divide this combined group into two new groups, making sure the group sizes match the original group sizes.
Calculate the mean difference for these randomized groups.
Repeat steps 3-4 thousands of times, each time recording the calculated mean difference.
Count the number of times the absolute value of the randomized mean difference is greater than or equal to the absolute value of the observed mean difference. 
    This will give you the p-value, or the probability of observing a mean difference as extreme as, or more extreme than, the observed mean difference under the null hypothesis.

The null hypothesis for this test is that the group labels do not matter; in other words, there is no difference in means between the two groups. If the p-value is less than your predetermined significance level (often 0.05), you would reject the null hypothesis and conclude that there is a statistically significant difference in means between the two groups.

Usage

from manly_randomization_test import RandomizationTest

group1 = np.array([1, 2, 3, 4, 5])
group2 = np.array([2, 3, 4, 5, 6])

test = RandomizationTest(group1, group2)
p_value = test.test()

print('p-value:', p_value)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manly_randomization_test-0.0.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

manly_randomization_test-0.0.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file manly_randomization_test-0.0.1.tar.gz.

File metadata

  • Download URL: manly_randomization_test-0.0.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for manly_randomization_test-0.0.1.tar.gz
Algorithm Hash digest
SHA256 321aab2ce709a518410c011bf29c97415795bccc7e8ad6ebae8beb011d928fdf
MD5 55dcd9655da1d6c99911437567cdcbbf
BLAKE2b-256 0111a871f1e592f0ea64efaaced794b9084fa6cf77e1d947bbaf25e3a59d28ca

See more details on using hashes here.

File details

Details for the file manly_randomization_test-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for manly_randomization_test-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b64152645916adde4d596a1fe74277a9b5ca363fee8694007cf72eb9380e69a0
MD5 f9a1c24462c7e0ff1ba6eab8a239a4f5
BLAKE2b-256 a26ae1c706e78cf764e702af49d6a056631a92522a84dce1cf21a2ac384d6bd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page