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: 1factor 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 N_{1} = 15, N_{2} = 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 chisquare distribution with r degrees of freedom.  
Function: Computes probability mass function and the cumumlative distribution function of the chisquare 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 chisquare distribution with r degrees of freedom. Makes use of the Symbolic Toolkit.  
Function: Computes probabilities related to the chisquare distribution with r degrees of freedom. Makes use of the builtin Matlab quad function.  
Script: Study of chisquare with r degrees of freedom over the interval [0,xR]. Plots the probability density function, the cumulative ditribution function, and userspecified percentiles. The xvalues 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 nsided, and summing the faceup 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 qq plot.  
Function: returns values of the probability density function for the Fdistribution.  
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 N_{1}, N_{2}, 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 userprovided xvector. 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 userinput vector.  
Function to generate random permutations of vector k components of a vector of the distinct components of a userinput vector.  
Function: Quick and dirty stemandleaf 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 AttributionNonCommercialShareAlike 3.0 License.
.