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.

106 CHAPTER 13. STATISTICAL DISTRIBUTIONS<br />

Properties<br />

1. its moment generation function is<br />

2. E(X) = 1−p<br />

p<br />

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

, Var(X) =<br />

1−p<br />

p 2 .<br />

An object of g(p) can be created by<br />

D = StatDist("Geometric",p);<br />

M(t) =<br />

p<br />

, t < − ln(1 − p)<br />

1 − (1 − p)et <strong>Matvec</strong> provided several standard member functions to allow user to access most of properties and<br />

functions of g(p):<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 p, the probability of success in a Bernoulli trial.<br />

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

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

Examples<br />

> D = StatDist("Geometric",0.2)<br />

GeometricDist(0.2)<br />

> D.mean()<br />

4<br />

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

3.751<br />

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

Col 1 Col 2 Col 3<br />

Row 1 0.160000 0.128000 0.0214748<br />

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

Col 1 Col 2 Col 3<br />

Row 1 0.360000 0.488000 0.914101<br />

> D.inv(0.5)<br />

***ERROR***<br />

GeometricDist::inv(): not available

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

Saved successfully!

Ooh no, something went wrong!