Sysquake Pro – Table of Contents
Sysquake for LaTeX – Table of Contents
Library - probdist
probdist is a library which adds to LME classes related to probability distributions. They provide an alternative interface to the algorithms in functions pdf, cdf, icdf and random. In addition, they provide methods to compute their mean, their median, their variance and their standard deviation when an explicit formula is known.
Probability distribution objects, which bundle both the distribution type and parameters, should be created with function makedist.
The following statement makes available classes defined in probdist:
use probdist
Functions
distribution::cdf
Cumulative distribution function for a distribution.
Syntax
s = cdf(pd, x)
Description
cdf(pd,x) calculates the integral of a probability density function from -infinity to x. The distribution is specified by the distribution object pd, typically created by makedist.
Example
use probdist pd = makedist('normal', mu=1, sigma=0.5); x = linspace(-1, 3); p = pdf(pd, x); c = cdf(pd, x); plot(x, p, '-'); plot(x, c);
See also
distribution::pdf, distribution::icdf, distribution::random, makedist, cdf
distribution::icdf
Inverse cumulative distribution function for a distribution.
Syntax
x = icdf(pd, p)
Description
icdf(pd,p) calculates the value of x such that cdf(pd,x) is p. The distribution is specified by the distribution object pd, typically created by makedist.
icdf is defined for distributions beta, chi2, gamma, lognormal, normal, student, and uniform.
Example
use probdist pd = makedist('student', nu=3); p = cdf(pd, 4) p = 0.9860 x = icdf(pd, p) x = 4.0000
See also
distribution::cdf, distribution::pdf, distribution::random, makedist, icdf
makedist
Make a distribution object.
Syntax
use probdist pd = makedist(name, param1=value1, ...)
Description
makedist(name) creates a distribution object with the default parameters. Parameters can be specified with named arguments. The result is an object whose class is a subclass of distribution.
Here is a list of distributions with the default parameter values.
Name | Default parameters | Class |
---|---|---|
'beta' | a=1,b=1 | betaDistribution |
'chi' | nu=1 | chiDistribution |
'chi2' 'chisquare' |
nu=1 | chi2Distribution |
'exp' 'exponential' |
mu=1 | exponentialDistribution |
'logn' 'lognormal' |
mu=1,sigma=1 | lognormalDistribution |
'nakagami' | mu=1,omega=1 | nakagamiDistribution |
'norm' 'normal' |
mu=0,sigma=1 | normalDistribution |
'rayl' 'rayleigh' |
b=1 | rayleighDistribution |
't' 'student' |
nu=1 | studentDistribution |
'unif' 'uniform' |
Lower=0,Upper=1 | uniformDistribution |
'weib' 'weibull' |
a=1,b=1 | weibullDistribution |
Example
use probstat pd = makedist('chi2', nu=3) pd = Chi2 distribution m_th = mean(pd) m_th = 3 m_data = mean(random(pd, [1, 10000])) m_data = 3.0027
distribution::mean
Mean of a distribution.
Syntax
m = mean(pd)
Description
mean(pd) gives the arithmetic mean of a distribution.
Example
use probdist pd = makedist('normal', mu=3, sigma=2); mean(pd) 3
See also
distribution::var, distribution::sdev, distribution::median, makedist, mean
distribution::median
Median of a distribution.
Syntax
m = median(pd)
Description
median(pd) gives the arithmetic median of a distribution, or NaN if it cannot be computed.
Example
use probdist pd = makedist('exp', mu=2); median(pd) 3
See also
distribution::var, distribution::sdev, distribution::median, makedist, median
distribution::pdf
Probability density function of a distribution.
Syntax
s = pdf(pd, x)
Description
pdf(pd,x) gives the probability of a distribution. The distribution is specified by the distribution object pd, typically created by makedist.
Example
use probdist pd = makedist('lognormal', mu=2, sigma=1.5); x = logspace(-2,1); p = pdf(pd, x); plot(x, p);
See also
distribution::cdf, distribution::icdf, distribution::random, makedist, pdf
distribution::random
Random generator for a distribution.
Syntax
x = random(pd) x = random(pd, size)
Description
random(pd) calculates a pseudo-random number whose distribution function is specified by the distribution object pd, typically created by makedist.
Additional input arguments specify the size of the result, either as a vector (or a single scalar for a square matrix) or as scalar values. The result is an array of the specified size where each value is an independent pseudo-random variable. The default size is 1 (scalar).
Example
use probdist pd = makedist('exp'); dataSize = [10, 100]; data = random(pd, dataSize);
See also
distribution::pdf, makedist, random
distribution::std
Standard deviation of a distribution.
Syntax
s = std(pd)
Description
std(pd) gives the standard deviation of a distribution.
Example
use probdist pd = makedist('lognormal', mu=2, sigma=1.5); std(pd) 66.3080 std(random(pd,[1,100000])) 68.0868
See also
distribution::var, distribution::mean, distribution::median, makedist, std
distribution::var
Variance of a distribution.
Syntax
s2 = var(pd)
Description
var(pd) gives the variance of a distribution.
Example
use probdist pd = makedist('uniform', Lower=2, Upper=10); var(pd) 5.3333 var(random(pd,[1,100000])) 5.3148
See also
distribution::mean, distribution::sdev, distribution::median, makedist, var