Many of the MATLAB scripts and functions here were originally developed to support a two semester undergraduate course sequence in probability and statistics at the junior/senior level. The course was based on the textbook "Probability and Statistical Inference" by R. V. Hogg and E. A. Tanis.
Make sure you download both the .p and .m files. You can use the function or script with only the .p file, but you'll need the .m file for the associated help. For example, if you download binomialDist.p you can use the binomialDist function, provided you know how to use it. To read how to use it, however, you'll need binomialDist.m. Once you've downloaded binomialDist.m, you can enter help binomialDist in the command window to read instructions on how to use the binomialDist function.
Files | Description |
Function: 1-factor ANOVA. Uses functions FProbQuad and FPercentilesBisectQuad. | |
Script: Estimates the probability that at least one match occurs when the first m postive integers are selected at random one at a time (with and without replacement) and are arranged in a row. Note: A match occurs when k turns up in the kth position. The script solves the problem for 2, 3, ..., m, where m is provided by the user. | |
Function: Returns probability mass function and the cumulative distribution function of the binomial distribution b(n,p). | |
Script: Used to explore various properties of the binomial distribution. Uses function binomialDist. | |
Function: produces a boxplot for each column of an input matrix. | |
Script: Displays a table of values and a probability histogram of a hypergeometric probability mass function with N1 = 15, N2 = 5, n = 4. Uses Function hypergeometricPMF. | |
Function: Plots cumulative distribution function (c.d.f) of a discrete random variable. | |
Function: Computes probability mass function of the chi-square distribution with r degrees of freedom. | |
Function: Computes probability mass function and the cumumlative distribution function of the chi-square distribution with r degrees of freedom. Ues function chiSquareProb. | |
Function: Finds the number χα2(r) such that P[X ≥ χα2(r)] = α or P[X ≤ χ1-α2(r)] = α. Uses a bisection algorithm and the chiSquareProb() function. | |
Function: Computes probabilities related to the chi-square distribution with r degrees of freedom. Makes use of the Symbolic Toolkit. | |
Function: Computes probabilities related to the chi-square distribution with r degrees of freedom. Makes use of the builtin Matlab quad function. | |
Script: Study of chi-square with r degrees of freedom over the interval [0,xR]. Plots the probability density function, the cumulative ditribution function, and user-specified percentiles. The x-values of the percentiles are also displayed in a table n the command window. Uses a bisection algorithm and the chiSquareDist2 and chiSquareProb() functions. | |
Script: Produces figure showing chiSquareSubAlpha. Uses chiSquarePercentilesBisect and chiSquareProb functions. | |
Script: Two players take turns rolling a pair of dice until one of them wins by obtaining a sum of 7. This script estimates the probability that the player who goes first wins. To estimate the probability, the game is played at total of ntrials times, where ntrials is provided by the user of this script. | |
Function: Displays graphical representation of the sample space resulting from a roll of pair dice, one m- and the other n-sided, and summing the face-up sides. | |
Function: Returns probability mass function and the cumulative distribution function of the discrete uniform distribution on first m positive integers. | |
Function: Returns probability mass function of the discrete uniform distribution on first m positive integers. | |
Script: Plots cumulative distribution frunction of exponential with mean 20. | |
Function: Returns exponential probabilty density function f(x) and cumulative distribution function F(x). | |
Script: Simulate exponential distribution. Uses boxplot to make a boxplot. Also makes q-q plot. | |
Function: returns values of the probability density function for the F-distribution. | |
Function: Finds the number Fα such that P[X ≥ Fα] = α or P[X ≤ Fα -1] = α. Depends on Symbolic toolkit. | |
Function: Finds the number Fα such that P[X ≥ Fα] = α or P[X ≤ Fα -1] = α. Does not depend on Symbolic toolkit. | |
Function: Computes probabilities related to the F = F(r1,r2) distribution. Depends on Symbolic toolkit. | |
Function: Computes probabilities related to the F = F(r1,r2) distribution. Does not depend on Symbolic toolkit. | |
Function: Computes probability mass function of the gamma distribution. | |
Function: Computes probabilities related to the gamma distribution. Makes use of the Symbolic Toolkit. | |
Script: Explores gamma distribution. Makes use of the gammaDist function. | |
Function: Returns probability mass function and cumulative distribution function of the hypergeomtric distribution with N1, N2, and n. | |
Script: Explores hypergeometric distrubtion. Uses hypergeometricDist function. | |
Script: Compares hypergeometric and binomial distributions. Makes use of the hypergeometricDist and binomialDist functions. | |
Function: Computes the mean and variance of a discrete random variable X. | |
Function returns probability mass and cumulative distribution functions of the Negative Binomial distribution. P(X=x) = probability that x is the minimum number of trials required to achieve r successes in a sequence of independent Bernoulli trials, where p is the probability of success on each trial. | |
Function: returns values of the normal probability density function. | |
Function: Finds the number zα such that P[X ≥ zα] = α See 'help normalPercentilesBisect' (i.e., normalPercentilesBisect.m) for details and requirements. | |
Function: Finds the number zα such that P[X ≥ zα] = α See 'help normalPercentilesBisectQuad' (i.e., normalPercentilesBisectQuad.m) for details and requirements. | |
Function: Computes probabilities related to the normal distribution N(μ, σ2). See 'help normalProb' (i.e., normalProb.m) for details and requirements. | |
Function: Computes probabilities related to the normal distribution N(μ, σ2). See 'help normalProb' (i.e., normalProbQuad.m) for details and requirements. | |
Function: nPr returns the number of permutations of n objects taken r at a time. (Order matters and selection is performed without replacement.) . See 'help normalProb' (i.e., normalProbQuad.m) for details and requirements. | |
Script: Displays a representation of the space of random variables X and Y, where X is the smaller and Y is the large number when two dice are rolled. The joint probability mass function as well as the marginal probability mass functions are displayed. | |
Script: Simulation of the following random experiment:
|
|
Function: Computes desired πp (percentiles) of user-provided x-vector. User must also provide a vector of desired percentiles. | |
Function: permutationOfMatrix returns permutation of matrix entries. | |
Function: Returns probability mass and cumulative distribution functions of the Poisson distribution. | |
Script: Compares Poisson and binomial distributions. Makes use of the PoissonDist and binomialDist functions. | |
Function to generate random combinations of k components of the distinct components of a user-input vector. | |
Function to generate random permutations of vector k components of a vector of the distinct components of a user-input vector. | |
Function: Quick and dirty stem-and-leaf function. | |
Function: Computes student's t distribution probability density function: f(x) = (gamma[(r+1)/2]/[sqrt(pi*r)*gamma(r/2)*(1+x^2/r)^(r+1)/2], where gamma(w) denotes the gamma function evaluated at w. | |
Function: Returns values of the students t probability density function. | |
Function: Finds the number tα such that P[T ≥ tα] = α. | |
Function: Finds the number tα such that P[T ≥ tα] = α. Does not use the Symboic Toolkit. | |
Function: Computes probabilities related to the gamma distribution with
probability density function: f(x) = ( f(x) =
(gamma[(r+1)/2]/[sqrt(pi*r)*gamma(r/2)*(1+x^2/r)^(r+1)/2], where
gamma(w) denotes the gamma function evaluated at w. This function
computes and returns:
Depends on Symbolic toolkit. |
|
Function: Computes probabilities related to the gamma distribution with
probability density function: f(x) = ( f(x) =
(gamma[(r+1)/2]/[sqrt(pi*r)*gamma(r/2)*(1+x^2/r)^(r+1)/2], where
gamma(w) denotes the gamma function evaluated at w. This function
computes and returns:
Does not depend on Symbolic toolkit. |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.
.