MATLAB Examples

Compute and plot the pdf of a Poisson distribution with parameter lambda = 5.

Use copulafit to calibrate copulas with data. To generate data Xsim with a distribution "just like" (in terms of marginal distributions and correlations) the distribution of data in the

Similar to the bootstrap is the jackknife, which uses resampling to estimate the bias of a sample statistic. Sometimes it is also used to estimate standard error of the sample statistic. The

Plot the pdf of a bivariate Student's t distribution. You can use this distribution for a higher number of dimensions as well, although visualization is not easy.

Compute and plot the pdf using four different values for the parameter r, the desired number of successes: .1, 1, 3, and 6. In each case, the probability of success p is .5.

As for all discrete distributions, the cdf is a step function. The plot shows the discrete uniform cdf for N = 10.

Compute and plot the pdf of a multivariate normal distribution.

The bootstrap procedure involves choosing random samples with replacement from a data set and analyzing each sample the same way. Sampling with replacement means that each observation is

Compute the pdf of an F distibution with 5 numerator degrees of freedom and 3 denominator degrees of freedom.

Compute the pdf of a gamma distribution with parameters A = 100 and B = 10. For comparison, also compute the pdf of a normal distribution with parameters mu = 1000 and sigma = 100.

Several examples show how to use the gkdeb function.

Compute the pdf of an exponential distribution with parameter mu = 2.

Pick a random sample of 10 from a list of 553 items.

Suppose the income of a family of four in the United States follows a lognormal distribution with mu = log(20,000) and sigma = 1. Compute and plot the income density.

Compute the pdf for a Student's t distribution with parameter nu = 5, and for a standard normal distribution.

Compute the pdf of a chi-square distribution with 4 degrees of freedom.

Compute and plot the cdf of a hypergeometric distribution.

Since the bivariate normal distribution is defined on the plane, you can also compute cumulative probabilities over rectangular regions.

Generate examples of probability density functions for the three basic forms of the generalized extreme value distribution.

Suppose the probability of a five-year-old car battery not starting in cold weather is 0.03. What is the probability of the car starting for 25 consecutive days during a long cold snap?

Use haltonset to construct a 2-D Halton quasi-random point set.

Compute the pdf of an extreme value distribution.

Compute the pdf of three generalized Pareto distributions. The first has shape parameter k = -0.25, the second has k = 0, and the third has k = 1.

The lognrnd function simulates independent lognormal random variables. In the following example, the mvnrnd function generates n pairs of independent normal random variables, and then

Compute the pdf of a standard normal distribution, with parameters equal to 0 and equal to 1.

Generate samples from a quasi-random point set.

Simulate data from a multivariate normal distribution, and then fit a Gaussian mixture model (GMM) to the data using fitgmdist. To create a known, or fully specified, GMM object, see

Create a known, or fully specified, Gaussian mixture model (GMM) object using gmdistribution and by specifying component means, covariances, and mixture proportions. To create a GMM

This exampe shows how to simulate data from a Gaussian mixture model (GMM) using a fully specified gmdistribution object and random.

The following plot compares the probability density functions for the standard normal, Cauchy, and Lévy distributions.

How changing the values of the mu and sigma parameters alters the shape of the pdf.

The following plot compares the probability density functions for stable distributions with different alpha values. In each case, beta = 0, gam = 1, and delta = 0.

Fit a Burr distribution to data, draw the cdf, and construct a histogram with a Burr distribution fit.

Use copulas to generate data from multivariate distributions when there are complicated relationships among the variables, or when the individual variables are from different

Find and plot the survival and hazard functions for a sample coming from a Burr distribution.

The following plot compares the cumulative distribution functions for stable distributions with different alpha values. In each case, beta = 0, gam = 1, and delta = 0.

How changing the values of the mu and sigma parameters alters the shape of the cdf.

Create a variety of shapes for probability density functions of the Burr distribution.

Compare the lognormal pdf to the Burr pdf using income data generated from a lognormal distribution.

Create a triangular probability distribution object based on sample data, and generate random numbers for use in a simulation.

Fit a nonparametric probability distribution to sample data using Pareto tails to smooth the distribution in the tails.

Fit probability distribution objects to grouped sample data, and create a plot to visually compare the pdf of each group.

Generate random numbers using the uniform distribution inversion method. This is useful for distributions when it is possible to compute the inverse cumulative distribution function,

Fit multiple probability distribution objects to the same set of sample data, and obtain a visual comparison of how well each distribution fits the data.

Generate random numbers and compute and plot the pdf of a multinomial distribution using probability distribution functions.

Use the t location-scale probability distribution object to work with a Cauchy distribution with nonstandard parameter values.

Generate random numbers, compute and plot the pdf, and compute descriptive statistics of a multinomial distribution using probability distribution objects.

Generate a kernel probability density estimate from sample data using the ksdensity function.

Use a copula and rank correlation to generate correlated data from probability distributions that do not have an inverse cdf function available, such as the Pearson flexible distribution

Fit kernel distributions to grouped sample data using the ksdensity function.

Perform Bayesian inference on a linear regression model using a Hamiltonian Monte Carlo (HMC) sampler.

Fit a kernel probability distribution object to sample data.

Use the Student's t distribution to generate random numbers from a standard Cauchy distribution.

Estimate parameters of a three-parameter Weibull distribution by using a custom probability density function.

The exponential distribution has a constant hazard function, which is not generally the case for the Weibull distribution. The plot shows the hazard function for exponential (dashed line)

Suppose you want to model the tensile strength of a thin filament using the Weibull distribution. The function wblfit gives maximum likelihood estimates and confidence intervals for the

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a location from the following list:

See all countries