Skip to main content

A Monte-Carlo toolkit for educational purposes

Project description

mc-tk

A Monte-Carlo toolkit for educational purposes.

pip install mc-tk

package architecture

experiments
    - classical / typical experiments in probability

distributions 
    - inclulde MC experiments that produce common distributions

samplings
    - sampling distributions of statistic used in hypothesis tests

The class diagram of the mc-tk package

modules and classes

Module Class Description
mc.experiments Pi Perform Buffon’s needle experiment to estimate π .
Parcel Simulate a bi-directional parcel passing game.
Dices Estimate the probabilities of various dice combinations.
Prisoners asymptotic_analysis() The famous locker puzzle(100-prisoner quiz). And the asymptotic_analysis() function will prove that the survival chance limit is 1−ln2 when n approaches +∞ .
Galton_Board Use the classic Galton board experiment to produce a binomial distribution.
Paper_Clips Use the paper clip experiment to produce a Zipf distribution.
Sudden_Death This class simulates a sudden death game to produce the exponential distribution.
mc.distributions Poisson This class will demonstrate that Poisson is a limit distribution of b(n,p) when n is large, and p is small.
Benford Verify Benford’s law using real-life datasets, including the stock market data, international trade data, and the Fibonacci series.
mc.samplings Clt Using various underlying distributions to verify the central limit  theorem. This class provides the following underlying distributions.
’uniform’ - a uniform distribution U(-1,1).
’expon’- an exponential distribution Expon(1).
’poisson’ - poisson distribution π(1).
’coin’- Bernoulli distribution with p = 0.5.
’tampered_coin’ - PMF:{0:0.2,1:0.8}, i.e., head more likely than tail.
’dice’- PMF:{1:1/6,2:1/6,3:1/6,4:1/6,5:1/6,6:1/6}.
’tampereddice’ - PMF: {1:0.1,2:0.1,3:0.1,4:0.1,5:0.1,6:0.5},i.e., 6 is more likely.
T_Test This class constructs an r.v.  (random variable) following the t distribution.
Chisq_Gof_Test Verify the statistic used in Pearson’s Chi-Square Goodness-of-Fit test follows the χ2  distribution.
Fk_Test Verify the Fligner-Killeen Test statistic(FK) follows the χ2  distribution.
Bartlett_Test Verify the Bartlett’s test statistic follows the χ2  distribution.
Anova Verify the statistic of ANOVA follows the F distribution.
Kw_Test Verify the Kruskal-Wallis test statistic (H) is a χ2  r.v.
Sign_Test For the sign test (medium test), verify its N- and N+ statistics both follow b(n,1/2).
Cochrane_Q_Test Verify the statistic T in Cochrane-Q test follows the χ2 distribution.
Hotelling_T2_Test Verify the T2  statistic from two multivariate Gaussian populations follows the Hotelling’s T2  distribution.

This version is major upgrade on the original version.
All the functions were refactored by the OOP (Object Oriented Programming) pattern.
McBase acts as a common base class for all MC derivative classes.

future plan

gui.py - add a Flask or tk-inter (ttkbootstrap) GUI

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

mc-tk-1.0.0.tar.gz (811.4 kB view details)

Uploaded Source

Built Distribution

mc_tk-1.0.0-py3-none-any.whl (830.7 kB view details)

Uploaded Python 3

File details

Details for the file mc-tk-1.0.0.tar.gz.

File metadata

  • Download URL: mc-tk-1.0.0.tar.gz
  • Upload date:
  • Size: 811.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for mc-tk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 185fd80f296bdd055f209cb026e78b9abf19e24337a5342a43048be4980434e2
MD5 b6ca6ca4803dd6eb2b0fdd62b403baf1
BLAKE2b-256 e01d30affd05166a84dad0992ec781a41f4fc5d1b083a1075f7c1b4a4ee1bcaa

See more details on using hashes here.

File details

Details for the file mc_tk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mc_tk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 830.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for mc_tk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 444de66422c1de5a6978abadac015ebf9f10ed7064795be88109fc949762ce04
MD5 761f1cd6ff121d0a64edf9d9bc09f20c
BLAKE2b-256 8255735bbc19116e809adef553bc91bb31508838c9872c8c03d920254fadf47d

See more details on using hashes here.

Supported by

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