|
| 1 | +# basic-probability |
| 2 | +Matlab source code for basic probability used in information theory. |
| 3 | +Static methods are defined in a class named 'probabilityTool'. |
| 4 | +Simply call a function in this class by probabilityTool.<functionname>. |
| 5 | +All methods provides default input for computation. |
| 6 | +Your inputs are collected using <varargin>. |
| 7 | + |
| 8 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 9 | +Example: |
| 10 | +Jointly distributed random variables X and Y are defined with a joint probability distribution pXY(x,y) = Pr(X = x, Y = y). |
| 11 | +Then the marginal distribution pX(x) and pY(y) can be computed by: |
| 12 | +[px,py] = probabilityTool.marginalize(pxy) %pxy is the joint probability distribution pXY(x,y) |
| 13 | +or |
| 14 | +[px,py] = probabilityTool.marginalize(pxy,'r') which returns rational number. |
| 15 | + |
| 16 | +The program also provides default values, invoking |
| 17 | +[px,py] = probabilityTool.marginalize |
| 18 | + |
| 19 | + |
| 20 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 21 | +Type methods(probabilityTool) to see all methods in this class. |
| 22 | + |
| 23 | +The software provides the following functions. |
| 24 | +- Theorem of total probability @probabilityTool.PRy |
| 25 | +- Marginalization @probabilityTool.marginalize |
| 26 | +- Compute joint distribution @probabilityTool.computeJointDistribution |
| 27 | +- Compute "all-related" probability @probabilityTool.computeAllP |
| 28 | +- Bayes rule @probabilityTool.bayes |
| 29 | +- Compute expected value @probabilityTool.computeExpection |
| 30 | +- Expected value of a function @probabilityTool.expectionOfaFunction |
| 31 | +- Compute variance @probabilityTool.computeVariance |
| 32 | +- An example of binary random vector @probabilityTool.binaryRandomVectorExample (uses @binomialPR) |
| 33 | +- Use Chebyshev inequality on random vectors @largeNumberExperiment (uses @randomSamples) |
| 34 | + |
| 35 | + |
| 36 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 37 | + |
| 38 | +Notations in source code: |
| 39 | +- px: Pr(X = x) |
| 40 | +- py: Pr(Y = y) |
| 41 | +- pxy: Pr(X=x,Y=y) joint probability |
| 42 | +- pxgy: Pr(X=x | Y=y) conditional probability |
| 43 | +- pygx: Pr(Y=y | X=x) conditional probability |
| 44 | +- EX: E[X] expection of pX(x) |
| 45 | +- EgX: E[g(x)] expection of a function g(x), where g(x) is a function of pX(x) |
| 46 | +- Var: Var[X] variance of pX(x) |
| 47 | + |
| 48 | +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +v1.0 June 29, 2020 Initial release |
0 commit comments