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.

13.2. CONTINUOUS DISTRIBUTION 99<br />

Examples<br />

> D = StatDist("Gamma",2,20)<br />

GammaDist(2,20)<br />

> D.mean()<br />

40<br />

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

40.3099<br />

> D.pdf([1,10,100])<br />

Col 1 Col 2 Col 3<br />

Row 1 0.00237807 0.0151633 0.00168449<br />

> D.cdf([1,10,100])<br />

Col 1 Col 2 Col 3<br />

Row 1 0.00120910 0.0902040 0.959572<br />

> D.inv([0.00120910,0.0902040,0.959572])<br />

Col 1 Col 2 Col 3<br />

Row 1 0.999998 10.0000 99.9998<br />

13.2.7 Exponential distribution<br />

Definition<br />

The random variable X has a exponential distribution if its probability density function is defined by<br />

f(x) = 1 θ e−x/θ , 0 ≤ x < ∞. (13.9)<br />

where θ (real) is the parameter with its range θ > 0. In short, we say X ∼ E(θ). The exponential distribution<br />

with θ = 1 is known as the standard exponential distribution.<br />

Properties<br />

1. moment generating function<br />

M(t) = 1<br />

1 − θt , t < 1 θ<br />

2. E(X) = θ, Var(X) = θ 2<br />

3. the cumulative distribution function (cdf) is defined<br />

{ 0 −∞ < x < 0<br />

F (x) =<br />

1 − e −x/θ 0 ≤ x < ∞<br />

4. the median m is found by solving F (m) = 0.5. That is m = θ log(2). because log(2) < 1. Thus the<br />

median is always less than the mean (θ).<br />

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

An object of E(θ) can be created by<br />

D = StatDist("Exponential",theta);<br />

D = StatDist("Exponential");<br />

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

functions of E(θ):<br />

pdf D.pdf(x) returns the probability density function (pdf) values of x which could be a vector or matrix.

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

Saved successfully!

Ooh no, something went wrong!