Matvec Users’ Guide
Matvec Users' Guide
Matvec Users' Guide
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
13.2. CONTINUOUS DISTRIBUTION 101<br />
<strong>Matvec</strong> interface<br />
An object of Beta(α, β, λ) can be created by<br />
D = StatDist("Beta",alpha,beta,lambda);<br />
D = StatDist("Beta",alpha,beta);<br />
<strong>Matvec</strong> provided several standard member functions to allow user to access most of properties and<br />
functions of Beta(α, β, λ):<br />
pdf D.pdf(x) returns the probability density function (pdf) values of x which could be a vector or matrix.<br />
cdf D.cdf(x) returns the cumulative distribution function (cdf) values of x which could be a vector or<br />
matrix<br />
mgf D.mgf(t) returns the moment-generating function (mgf) values of t which could be a vector or matrix.<br />
inv D.inv(p) is the inverse function of D.cdf(x), where p could be a vector or matrix. That is if p =<br />
D.cdf(x), then x = D.inv(p).<br />
nonct D.nonct(cv,p) returns non-centrality value given the critical value (cv) and p value (cdf). Both cv and<br />
p could be either vector or matrix as long as the sizes are the same.<br />
sample D.sample(), D.sample(n), and D.sample(m,n) return a random scalar or a vector of size n or a matrix<br />
of size m by n.<br />
parameter D.parameter(1) returns α, D.parameter(2) returns β, and D.parameter(3) returns λ.<br />
mean D.mean() returns the expected value.<br />
variance D.variance() returns the variance.<br />
Examples<br />
> C = StatDist("Beta",2,3)<br />
BetaDist(2,3,0)<br />
> D.mean()<br />
0.4<br />
> D.sample(1000).mean()<br />
0.407094<br />
> D.pdf([0.01,0.5,0.9])<br />
Col 1 Col 2 Col 3<br />
Row 1 0.117612 1.50000 0.108000<br />
> D.cdf([0.01,0.5,0.9])<br />
Col 1 Col 2 Col 3<br />
Row 1 0.000592030 0.687500 0.996300<br />
> D.inv([0.000592030,0.687500,0.996300])<br />
Col 1 Col 2 Col 3<br />
Row 1 0.00999928 0.500001 0.900001<br />
13.2.9 Log normal distribution<br />
Definition<br />
The random variable X has a lognormal distribution if its probability density function (pdf) is defined by<br />
f(x) = [(x − θ) √ (2π)σ] −1 exp(−<br />
log(x − θ) − µ)2<br />
2σ 2 ), x > θ (13.13)