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.

92 CHAPTER 13. STATISTICAL DISTRIBUTIONS<br />

Col 1 Col 2 Col 3<br />

Row 1 0.0500001 0.500000 0.950000<br />

> D.inv([0.05,0.5,0.95])<br />

Col 1 Col 2 Col 3<br />

Row 1 -3.20148 2.00000 7.20148<br />

> D.sample(2,3)<br />

Col 1 Col 2 Col 3<br />

Row 1 -1.26660 2.85846 5.64868<br />

Row 2 3.51262 -1.97644 3.44860<br />

13.2.2 Uniform distribution<br />

Definition<br />

The random variable X has a uniform distribution if its probability density function (pdf) is defined by<br />

f(x) = 1<br />

b − a , a ≤ x ≥ b (13.2)<br />

where a (real) and b (real) are the parameters with their range −∞ < a < b < ∞. In short, we say<br />

X ∼ U(a, b). The uniform distribution with a = 0 and b = 1 is known as the standard uniform distribution<br />

U(0, 1). One of interesting example is that if D is an object of StatDist, then D.cdf(x) is distributed as<br />

U(0, 1).<br />

Properties<br />

1. E(X) = a+b<br />

(b−a)2<br />

2<br />

, Var(X) =<br />

12<br />

.<br />

2. its moment generation function is<br />

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

An object of U(a, b) can be created by<br />

D = StatDist("Uniform",a,b);<br />

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

M(t) = etb − e ta<br />

, t ≠ 0; M(0) = 1<br />

t(b − a)<br />

// standard uniform U(0,1)<br />

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

functions of U(a, b):<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 a and D.parameter(2) returns b.<br />

mean D.mean() returns the expected value of X ∼ U(a, b).<br />

variance D.variance() returns the variance of X ∼ U(a, b).

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

Saved successfully!

Ooh no, something went wrong!