makedist
Create probability distribution object
Description
creates
a probability distribution object with one or more distribution parameter
values specified by name-value pair arguments.pd
= makedist(distname
,Name,Value
)
returns
a cell array list
= makedistlist
containing a list of the probability
distributions that makedist
can create.
makedist -reset
resets the list of distributions by searching the path
for files contained in a namespace named prob
and
implementing classes derived from ProbabilityDistribution
.
Use this syntax after you define a custom distribution function. For details, see Define Custom Distributions Using the Distribution Fitter App.
Examples
Create Normal Distribution Object Using Default Parameter Values
Create a normal distribution object using the default parameter values, which correspond to the parameters of the standard normal distribution.
pd = makedist('Normal')
pd = NormalDistribution Normal distribution mu = 0 sigma = 1
You can use the object functions of pd
to evaluate the distribution and generate random numbers. Display the supported object functions.
methods(pd)
Methods for class prob.NormalDistribution: cdf gather icdf iqr mean median negloglik paramci pdf plot proflik random std truncate var
For example, compute the interquartile range of the distribution by using the iqr
function.
r = iqr(pd)
r = 1.3490
Create Gamma Distribution Object Using Default Parameter Values
Create a gamma distribution object using the default parameter values.
pd = makedist('Gamma')
pd = GammaDistribution Gamma distribution a = 1 b = 1
Compute the mean of the gamma distribution.
mean = mean(pd)
mean = 1
Specify Parameters for Normal Distribution Object
Create a normal distribution object with parameter values mu = 75
and sigma = 10
.
pd = makedist('Normal','mu',75,'sigma',10)
pd = NormalDistribution Normal distribution mu = 75 sigma = 10
Specify Parameters for Gamma Distribution Object
Create a gamma distribution object with the parameter value a = 3
and the default value b = 1
.
pd = makedist('Gamma','a',3)
pd = GammaDistribution Gamma distribution a = 3 b = 1
Input Arguments
distname
— Distribution name
character vector | string scalar
Distribution name, specified as one of the following character vectors or string scalars. The
distribution specified by distname
determines the type of
the returned probability distribution object.
Distribution Name | Description | Distribution Object |
---|---|---|
'Beta' | Beta distribution | BetaDistribution |
'Binomial' | Binomial distribution | BinomialDistribution |
'BirnbaumSaunders' | Birnbaum-Saunders distribution | BirnbaumSaundersDistribution |
'Burr' | Burr distribution | BurrDistribution |
'Exponential' | Exponential distribution | ExponentialDistribution |
'ExtremeValue' | Extreme Value distribution | ExtremeValueDistribution |
'Gamma' | Gamma distribution | GammaDistribution |
'GeneralizedExtremeValue' | Generalized Extreme Value distribution | GeneralizedExtremeValueDistribution |
'GeneralizedPareto' | Generalized Pareto distribution | GeneralizedParetoDistribution |
'HalfNormal' | Half-normal distribution | HalfNormalDistribution |
'InverseGaussian' | Inverse Gaussian distribution | InverseGaussianDistribution |
'Logistic' | Logistic distribution | LogisticDistribution |
'Loglogistic' | Loglogistic distribution | LoglogisticDistribution |
'Lognormal' | Lognormal distribution | LognormalDistribution |
'Loguniform' | Loguniform distribution | LoguniformDistribution |
'Multinomial' | Multinomial distribution | MultinomialDistribution |
'Nakagami' | Nakagami distribution | NakagamiDistribution |
'NegativeBinomial' | Negative Binomial distribution | NegativeBinomialDistribution |
'Normal' | Normal distribution | NormalDistribution |
'PiecewiseLinear' | Piecewise Linear distribution | PiecewiseLinearDistribution |
'Poisson' | Poisson distribution | PoissonDistribution |
'Rayleigh' | Rayleigh distribution | RayleighDistribution |
'Rician' | Rician distribution | RicianDistribution |
'Stable' | Stable distribution | StableDistribution |
'tLocationScale' | t Location-Scale distribution | tLocationScaleDistribution |
'Triangular' | Triangular distribution | TriangularDistribution |
'Uniform' | Uniform distribution | UniformDistribution |
'Weibull' | Weibull distribution | WeibullDistribution |
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: makedist('Normal','mu',10)
specifies
a normal distribution with parameter mu
equal to
10, and parameter sigma
equal to the default value
of 1.
a
— First shape parameter
1
(default) | positive scalar value
First shape parameter of a beta distribution, specified as a positive
scalar value. This argument is valid only when
distname
is 'Beta'
.
Example: 'a',3
Data Types: single
| double
b
— Second shape parameter
1
(default) | positive scalar value
Second shape parameter of a beta distribution, specified as a positive
scalar value. This argument is valid only when
distname
is 'Beta'
.
Example: 'b',5
Data Types: single
| double
N
— Number of trials
1
(default) | positive integer value
Number of trials for a binomial distribution, specified as a positive
integer value. This argument is valid only when
distname
is 'Binomial'
.
Example: 'N',25
Data Types: single
| double
p
— Probability of success
0.5
(default) | scalar value in the range [0,1]
Probability of success of any individual trial for a binomial
distribution, specified as a scalar value in the range [0,1]. This
argument is valid only when distname
is
'Binomial'
.
Example: 'p',0.25
Data Types: single
| double
beta
— Scale parameter
1
(default) | positive scalar value
Scale parameter of a Birnbaum-Saunders distribution, specified as a
positive scalar value. This argument is valid only when
distname
is
'BirnbaumSaunders'
.
Example: 'beta',2
Data Types: single
| double
gamma
— Shape parameter
1
(default) | positive scalar value
Shape parameter of a Birnbaum-Saunders distribution, specified as a
positive scalar value. This argument is valid only when
distname
is
'BirnbaumSaunders'
.
Example: 'gamma',0.5
Data Types: single
| double
alpha
— Scale parameter
1
(default) | positive scalar value
Scale parameter of a Burr distribution, specified as a positive scalar
value. This argument is valid only when distname
is
'Burr'
.
Example: 'alpha',2
Data Types: single
| double
c
— First shape parameter
1
(default) | positive scalar value
First shape parameter of a Burr distribution, specified as a positive
scalar value. This argument is valid only when
distname
is 'Burr'
.
Example: 'c',2
Data Types: single
| double
k
— Second shape parameter
1
(default) | positive scalar value
Second shape parameter of a Burr distribution, specified as a positive
scalar value. This argument is valid only when
distname
is 'Burr'
.
Example: 'k',5
Data Types: single
| double
mu
— Mean
1
(default) | positive scalar value
Mean of an exponential distribution, specified as a positive scalar
value. This argument is valid only when distname
is
'Exponential'
.
Example: 'mu',5
Data Types: single
| double
mu
— Location parameter
0
(default) | scalar value
Location parameter of an extreme value distribution, specified as a
scalar value. This argument is valid only when
distname
is
'ExtremeValue'
.
Example: 'mu',-2
Data Types: single
| double
sigma
— Scale parameter
1
(default) | nonnegative scalar value
Scale parameter of an extreme value distribution, specified as a
nonnegative scalar value. This argument is valid only when
distname
is
'ExtremeValue'
.
Example: 'sigma',2
Data Types: single
| double
a
— Shape parameter
1
(default) | positive scalar value
Shape parameter of a gamma distribution, specified as a positive
scalar value. This argument is valid only when
distname
is 'Gamma'
.
Example: 'a',2
Data Types: single
| double
b
— Scale parameter
1
(default) | nonnegative scalar value
Scale parameter of a gamma distribution, specified as a nonnegative
scalar value. This argument is valid only when
distname
is 'Gamma'
.
Example: 'b',0
Data Types: single
| double
k
— Shape parameter
0
(default) | scalar value
Shape parameter of a generalized extreme value distribution, specified
as a scalar value. This argument is valid only when
distname
is
'GeneralizedExtremeValue'
.
Example: 'k',0
Data Types: single
| double
sigma
— Scale parameter
1
(default) | nonnegative scalar value
Scale parameter of a generalized extreme value distribution, specified
as a nonnegative scalar value. This argument is valid only when
distname
is
'GeneralizedExtremeValue'
.
Example: 'sigma',2
Data Types: single
| double
mu
— Location parameter
0
(default) | scalar value
Location parameter of a generalized extreme value distribution,
specified as a scalar value. This argument is valid only when
distname
is
'GeneralizedExtremeValue'
.
Example: 'mu',1
Data Types: single
| double
k
— Shape parameter
1
(default) | scalar value
Shape parameter of a generalized Pareto distribution, specified as a
scalar value. This argument is valid only when
distname
is
'GeneralizedPareto'
.
Example: 'k',0
Data Types: single
| double
sigma
— Scale parameter
1
(default) | nonnegative scalar value
Scale parameter of a generalized Pareto distribution, specified as a
nonnegative scalar value. This argument is valid only when
distname
is
'GeneralizedPareto'
.
Example: 'sigma',2
Data Types: single
| double
theta
— Location (threshold) parameter
1
(default) | scalar value
Location (threshold) parameter of a generalized Pareto distribution,
specified as a scalar value. This argument is valid only when
distname
is
'GeneralizedPareto'
.
Example: 'theta',2
Data Types: single
| double
mu
— Location parameter
0
(default) | scalar value
Location parameter of a half-normal distribution, specified as a
scalar value. This argument is valid only when
distname
is
'HalfNormal'
.
Example: 'mu',1
Data Types: single
| double
sigma
— Scale parameter
1
(default) | nonnegative scalar value
Scale parameter of a half-normal distribution, specified as a
nonnegative scalar value. This argument is valid only when
distname
is
'HalfNormal'
.
Example: 'sigma',2
Data Types: single
| double
mu
— Scale parameter
1
(default) | positive scalar value
Scale parameter of an inverse Gaussian distribution, specified as a
positive scalar value. This argument is valid only when
distname
is
'InverseGaussian'
.
Example: 'mu',2
Data Types: single
| double
lambda
— Shape parameter
1
(default) | positive scalar value
Shape parameter of an inverse Gaussian distribution, specified as a
positive scalar value. This argument is valid only when
distname
is
'InverseGaussian'
.
Example: 'lambda',4
Data Types: single
| double
mu
— Mean
0
(default) | scalar value
Mean of a logistic distribution, specified as a scalar value. This
argument is valid only when distname
is
'Logistic'
.
Example: 'mu',2
Data Types: single
| double
sigma
— Scale parameter
1
(default) | nonnegative scalar value
Scale parameter of a logistic distribution, specified as a nonnegative
scalar value. This argument is valid only when
distname
is
'Logistic'
.
Example: 'sigma',4
Data Types: single
| double
mu
— Mean of logarithmic values
0
(default) | scalar value
Mean of logarithmic values for a loglogistic distribution, specified
as a scalar value. This argument is valid only when
distname
is
'Loglogistic'
.
Example: 'mu',2
Data Types: single
| double
sigma
— Scale parameter of logarithmic values
1
(default) | positive scalar value
Scale parameter of logarithmic values for a loglogistic distribution,
specified as a positive scalar value. This argument is valid only when
distname
is
'Loglogistic'
.
Example: 'sigma',4
Data Types: single
| double
mu
— Mean of logarithmic values
0
(default) | scalar value
Mean of logarithmic values for a lognormal distribution, specified as
a scalar value. This argument is valid only when
distname
is
'Lognormal'
.
Example: 'mu',2
Data Types: single
| double
sigma
— Standard deviation of logarithmic values
1
(default) | nonnegative scalar value
Standard deviation of logarithmic values for a lognormal distribution,
specified as a nonnegative scalar value. This argument is valid only
when distname
is
'Lognormal'
.
Example: 'sigma',2
Data Types: single
| double
Lower
— Lower limit
1
(default) | nonnegative scalar value
Lower limit for a loguniform distribution, specified as a nonnegative
scalar value. This argument is valid only when
distname
is
'Loguniform'
.
Example: 'Lower',2
Data Types: single
| double
Upper
— Upper limit
4
(default) | scalar value greater than Lower
Upper limit for a loguniform distribution, specified as a scalar value
greater than Lower
. This argument is valid only when
distname
is
'Loguniform'
.
Example: 'Upper',6
Data Types: single
| double
Probabilities
— Outcome probabilities
[0.500 0.500]
(default) | vector of scalar values in the range [0,1]
Outcome probabilities for a multinomial distribution, specified as a vector of
scalar values in the range [0,1]. The probabilities sum to 1 and correspond to
outcomes [1, 2, ..., k], where k is the number of elements in the
probabilities vector. This argument is valid only when distname
is 'Multinomial'
.
Example: 'Probabilities',[0.1 0.2 0.5 0.2]
gives the
probabilities that the outcome is 1, 2, 3, or 4, respectively.
Data Types: single
| double
mu
— Shape parameter
1
(default) | positive scalar value
Shape parameter of a Nakagami distribution, specified as a positive
scalar value. This argument is valid only when
distname
is
'Nakagami'
.
Example: 'mu',5
Data Types: single
| double
omega
— Scale parameter
1
(default) | positive scalar value
Scale parameter of a Nakagami distribution, specified as a positive
scalar value. This argument is valid only when
distname
is
'Nakagami'
.
Example: 'omega',5
Data Types: single
| double
R
— Number of successes
1
(default) | positive scalar value
Number of successes for a negative binomial distribution, specified as
a positive scalar value. This argument is valid only when
distname
is
'NegativeBinomial'
.
Example: 'R',5
Data Types: single
| double
P
— Probability of success
0.5
(default) | scalar value in the range (0,1]
Probability of success of any individual trial for a negative binomial
distribution, specified as a scalar value in the range (0,1]. This
argument is valid only when distname
is
'NegativeBinomial'
.
Example: 'P',0.1
Data Types: single
| double
mu
— Mean
0
(default) | scalar value
Mean of a normal distribution, specified as a scalar value. This argument is valid
only when distname
is 'Normal'
.
Example: 'mu',2
Data Types: single
| double
sigma
— Standard deviation
1
(default) | nonnegative scalar value
Standard deviation of a normal distribution, specified as a nonnegative scalar
value. This argument is valid only when distname
is
'Normal'
.
Example: 'sigma',2
Data Types: single
| double
x
— Data values
1
(default) | monotonically increasing vector of scalar values
Data values at which the cumulative distribution function (cdf) changes slope for
a piecewise linear distribution, specified as a monotonically increasing vector of
scalar values. This argument is valid only when distname
is
'PiecewiseLinear'
.
Example: 'x',[1 2 3]
Data Types: single
| double
Fx
— cdf value at each value in x
1
(default) | monotonically increasing vector of scalar values that start at 0 and end at 1
lambda
— Mean
1
(default) | nonnegative scalar value
Mean of a Poisson distribution, specified as a nonnegative scalar
value. This argument is valid only when distname
is
'Poisson'
.
Example: 'lambda',5
Data Types: single
| double
B
— Defining parameter
1
(default) | positive scalar value
Defining parameter of a Rayleigh distribution, specified as a positive
scalar value. This argument is valid only when
distname
is
'Rayleigh'
.
Example: 'B',3
Data Types: single
| double
s
— Noncentrality parameter
1
(default) | nonnegative scalar value
Noncentrality parameter of a Rician distribution, specified as a
nonnegative scalar value. This argument is valid only when
distname
is 'Rician'
.
Example: 's',0
Data Types: single
| double
sigma
— Scale parameter
1
(default) | positive scalar value
Scale parameter of a Rician distribution, specified as a positive
scalar value. This argument is valid only when
distname
is 'Rician'
.
Example: 'sigma',2
Data Types: single
| double
alpha
— First shape parameter
2
(default) | scalar value in the range (0,2]
First shape parameter of a stable distribution, specified as a scalar
value in the range (0,2]. This argument is valid only when
distname
is 'Stable'
.
Example: 'alpha',1
Data Types: single
| double
beta
— Second shape parameter
0
(default) | scalar value in the range [–1,1]
Second shape parameter of a stable distribution, specified as a scalar
value in the range [–1,1]. This argument is valid only when
distname
is 'Stable'
.
Example: 'beta',0.5
Data Types: single
| double
gam
— Scale parameter
1
(default) | scalar value in the range (0,∞)
Scale parameter of a stable distribution, specified as a scalar value
in the range (0,∞). This argument is valid only when
distname
is 'Stable'
.
Example: 'gam',2
Data Types: single
| double
delta
— Location parameter
0 (default) | scalar value
Location parameter of a stable distribution, specified as a scalar
value. This argument is valid only when distname
is
'Stable'
.
Example: 'delta',5
Data Types: single
| double
mu
— Location parameter
0
(default) | scalar value
Location parameter of a t location-scale
distribution, specified as a scalar value. This argument is valid only
when distname
is
'tLocationScale'
.
Example: 'mu',-2
Data Types: single
| double
sigma
— Scale parameter
1
(default) | positive scalar value
Scale parameter of a t location-scale distribution,
specified as a positive scalar value. This argument is valid only when
distname
is
'tLocationScale'
.
Example: 'sigma',2
Data Types: single
| double
nu
— Degrees of freedom
5
(default) | positive scalar value
Degrees of freedom of a t location-scale
distribution, specified as a positive scalar value. This argument is
valid only when distname
is
'tLocationScale'
.
Example: 'nu',20
Data Types: single
| double
A
— Lower limit
0
(default) | scalar value
Lower limit for a triangular distribution, specified as a scalar value. This
argument is valid only when distname
is
'Triangular'
.
Example: 'A',-2
Data Types: single
| double
B
— Peak location
0.5
(default) | scalar value greater than or equal to A
Peak location for a triangular distribution, specified as a scalar value greater
than or equal to A
. This argument is valid only when
distname
is 'Triangular'
.
Example: 'B',1
Data Types: single
| double
C
— Upper limit
1
(default) | scalar value greater than or equal to B
Upper limit for a triangular distribution, specified as a scalar value greater
than or equal to B
. This argument is valid only when
distname
is 'Triangular'
.
Example: 'C',5
Data Types: single
| double
Lower
— Lower limit
0
(default) | scalar value
Lower limit for a uniform distribution, specified as a scalar value. This argument
is valid only when distname
is
'Uniform'
.
Example: 'Lower',-4
Data Types: single
| double
Upper
— Upper limit
1
(default) | scalar value greater than Lower
Upper limit for a uniform distribution, specified as a scalar value greater than
Lower
. This argument is valid only when
distname
is 'Uniform'
.
Example: 'Upper',2
Data Types: single
| double
A
— Scale parameter
1
(default) | positive scalar value
Scale parameter of a Weibull distribution, specified as a positive
scalar value. This argument is valid only when
distname
is
'Weibull'
.
Example: 'A',2
Data Types: single
| double
B
— Shape parameter
1
(default) | positive scalar value
Shape parameter of a Weibull distribution, specified as a positive
scalar value. This argument is valid only when
distname
is
'Weibull'
.
Example: 'B',5
Data Types: single
| double
Output Arguments
pd
— Probability distribution
probability distribution object
Probability distribution, returned as a probability distribution
object of the type specified by distname
.
list
— List of probability distributions
cell array of character vectors
List of probability distributions that makedist
can
create, returned as a cell array of character vectors.
Alternative Functionality
App
The Distribution Fitter app opens a graphical user interface
for you to import data from the workspace and interactively fit a probability distribution to
that data. You can then save the distribution to the workspace as a probability distribution
object. Open the Distribution Fitter app using distributionFitter
, or click Distribution Fitter on the Apps tab.
Version History
Introduced in R2013a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site 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 web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)