Matvec Users’ Guide
Matvec Users' Guide
Matvec Users' Guide
- 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 91<br />
4. the cumulative distribution function (cdf) for X ∼ N(0, 1) is<br />
Φ(x) =<br />
=<br />
∫ x<br />
−∞<br />
1<br />
√<br />
2π<br />
exp(− w2<br />
2 ) dw<br />
{<br />
1+erf(x/ √ 2)<br />
2<br />
x ≥ 0<br />
1−erf(−x/ √ 2)<br />
2<br />
x < 0<br />
5. E(X) = µ, Var(X) = σ 2 .<br />
6. the median = µ.<br />
7. if X 1 , X 2 , . . . , X n is a sample from N(µ, σ 2 ), let<br />
∑ n<br />
i=1 ¯X = X ∑ n<br />
i<br />
, and s 2 i=1<br />
=<br />
(X i − ¯X) 2<br />
n<br />
n − 1<br />
then ¯X ∼ N(µ, σ2<br />
s2<br />
n<br />
), (n − 1)<br />
σ<br />
∼ χ 2 (n − 1), and both are independent.<br />
2<br />
<strong>Matvec</strong> interface<br />
An object of N(µ, σ 2 ) can be created by<br />
D = StatDist("Normal",mu,sigma2);<br />
D = StatDist("Normal");<br />
// standard normal N(0,1)<br />
<strong>Matvec</strong> provided several standard member functions to allow user to access most of properties and<br />
functions of N(µ, σ 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 µ and D.parameter(2) returns σ 2 .<br />
mean D.mean() returns the expected value of X ∼ N(µ, σ 2 ).<br />
variance D.variance() returns the variance of X ∼ N(µ, σ 2 ).<br />
Examples<br />
> D = StatDist("Normal",2, 10)<br />
NormalDist(2,10)<br />
> D.mean()<br />
2<br />
> D.pdf([-2,0,2])<br />
Col 1 Col 2 Col 3<br />
Row 1 0.0566858 0.103288 0.126157<br />
> D.cdf([-3.20148,2,7.20148])