14.09.2015 Views

Matvec Users’ Guide

Matvec Users' Guide

Matvec Users' Guide

SHOW MORE
SHOW LESS
  • 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.

102 CHAPTER 13. STATISTICAL DISTRIBUTIONS<br />

where µ (real), σ 2 (real) and θ (real) are the parameters with their ranges −∞ < µ, θ < ∞ and σ 2 > 0. In<br />

short, we say X ∼ lognormal(µ, σ 2 , θ).<br />

Alternatively, if log(X − θ) ∼ N(µ, σ 2 ), then we say X has a lognormal(µ, σ 2 , θ) distribution.<br />

The lognormal distribution with θ = 0 is known as two-parameter lognormal distribution lognormal(µ, σ 2 ).<br />

Properties<br />

1. E(X) = exp(µ + σ 2 /2) + θ, Var(X) = exp(2µ + 2σ 2 ) − exp(2µ + σ 2 ) + 2θ 2 .<br />

2. mode(X) = exp(µ − σ 2 ) + θ<br />

3. median(X) = exp(µ) + θ<br />

<strong>Matvec</strong> interface<br />

An object of lognormal(µ, σ 2 , θ) can be created by<br />

D = StatDist("LogNormal",mu,sigma2,theta);<br />

D = StatDist("LogNormal",mu,sigma2);<br />

<strong>Matvec</strong> provided several standard member functions to allow user to access most of properties and<br />

functions of lognormal(µ, σ 2 , θ):<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 />

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 σ 2 , and D.parameter(3) returns θ.<br />

mean D.mean() returns the expected value.<br />

variance D.variance() returns the variance.<br />

Examples<br />

> D = StatDist("LogNormal",1,3,2);<br />

LogNormalDist(1,3,2)<br />

> D.mean()<br />

14.1825<br />

> D.sample(1000).mean()<br />

14.087<br />

> D.pdf([2.01,10,30])<br />

Col 1 Col 2 Col 3<br />

Row 1 0.122530 0.0237094 0.00332270<br />

> D.cdf([2.01,10,30])<br />

Col 1 Col 2 Col 3<br />

Row 1 0.000605776 0.733429 0.910929<br />

> D.inv([0.000605776,0.733429,0.910929])<br />

Col 1 Col 2 Col 3<br />

Row 1 2.01000 10.0000 30.0000

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!