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.

94 CHAPTER 13. STATISTICAL DISTRIBUTIONS<br />

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

An object of χ 2 (r, λ) can be created by<br />

D = StatDist("ChiSquare",r,lambda);<br />

D = StatDist("ChiSquare",r);<br />

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

functions of χ 2 (r, λ):<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 r, degree of freedom.<br />

mean D.mean() returns the expected value of X ∼ χ 2 (r, λ).<br />

variance D.variance() returns the variance of X ∼ χ 2 (r, λ).<br />

Examples<br />

> D = StatDist("ChiSquare",10,0.1)<br />

ChiSquareDist(10,0.1)<br />

> D.mean()<br />

10.1<br />

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

10.0323<br />

> D.pdf(5)<br />

***ERROR***<br />

ChiSquareDist::pdf(): not available yet: non-centrality<br />

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

Col 1 Col 2 Col 3<br />

Row 1 0.00000 0.000164396 0.550770<br />

> D.inv([0,0.000164396,0.550770])<br />

Col 1 Col 2 Col 3<br />

Row 1 0.00000 1.00000 10.0000<br />

> D.nonct(10,0.550770)<br />

0.100003<br />

> D.sample()<br />

5.15093

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

Saved successfully!

Ooh no, something went wrong!