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.1.tar.gz (811.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: mc-tk-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 73de818256d592985a4863a859481ff22d7ade61f806b4a7ef1550be077c8e81
MD5 719a86a9115b65891049d15c59e60bf4
BLAKE2b-256 e9058325439a2d523144723fbb15a416b55a4a2ed7f4ff936b6471281da98830

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mc_tk-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2695b0bd45d34b6cbdf5b542f1776918d86c5b54b008a8d5d6eb11ed44f39cbf
MD5 1625dfe2487539c27b6753388a29af75
BLAKE2b-256 b010615eae708ed1d6a25cfe7afe9fbf8c7658a60a21bcf8891ce80e8619640c

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