Functions > Statistics > Probability Distributions > Example: Monte Carlo Probability Estimation
  
Example: Monte Carlo Probability Estimation
Generate random numbers to illustrate how large sampling methods can estimate probabilities of quantities whose distributions are unknown.
1. Set the parameters of a logistic distribution with location and scale parameters L and S.
Click to copy this expression
Click to copy this expression
2. Set the Monte Carlo sampling parameters.
Number of individual samples to collect:
Click to copy this expression
Number of data points in each sample:
Click to copy this expression
3. Use functions mean and rlogis to perform sampling and calculate the mean of each sample.
Click to copy this expression
Click to copy this expression
4. Estimate the probability that the mean of a set of random numbers lies within interval [a, b].
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
The probability depends on the number of data points in each sample and on the width of the interval.
5. Plot the plogis function to show the cumulative probability distribution of the logistic distribution. Use a horizontal marker to mark the probability level.
Click to copy this expression
Click to copy this expression
6. Zoom the dashed green segment of the plot and use vertical markers to mark the [a, b] interval and use horizontal markers to mark the lower and upper cumulative probability between [a, b]:
Click to copy this expression
Click to copy this expression
Click to copy this expression
7. Plot the dlogis function to show the probability density of the logistic distribution.
Click to copy this expression
8. Zoom the dashed green segment of the plot and use vertical markers to mark the [a, b] interval:
Click to copy this expression
9. Use function qlogis to calculate the inverse cumulative probability distribution for probability Prob.
Click to copy this expression