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
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.
publication
doc
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
mc_tk-1.0.2-py3-none-any.whl
(830.9 kB
view details)
File details
Details for the file mc_tk-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: mc_tk-1.0.2-py3-none-any.whl
- Upload date:
- Size: 830.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e131bb78b9f7e845ca99b8654cdbdec666907eb056f537c499697e2c1267cd9a |
|
MD5 | cc1bf3e1792131416059734e6dbdc7d4 |
|
BLAKE2b-256 | eb37890c247f62e4d66ab21daef6fc04b9c9c7fe8c8cd23dbcc82417ab41f722 |