<< distfun_permrnd Support distfun_verboseset >>

distfun >> distfun > Support > distfun_plotintcdf

distfun_plotintcdf

Plots an integer CDF.

Calling Sequence

distfun_plotintcdf(x,p)
distfun_plotintcdf(x,p,colorspec)
distfun_plotintcdf(x,p,colorspec,legendspec)

Parameters

x :

a n-by-1 matrix of doubles, the outcomes.

p :

a n-by-nbplot matrix of doubles, the probabilities, where nbplot is the number of plots and n is the number of outcomes. The entry p(j,k) is the probability that X<x(j) for the k-th CDF plot, for j=1,2,...,n and k=1,2,...,nbplot.

colorspec :

a 1-by-nbplot matrix of strings, the color of each CDF plot. The k-th plot has the color colorspec(k), for k=1,2,...,nbplot.The available colors are: "r" "g" "b" "c" "m" "y" "k" "w" (default colorspec=[], i.e. the default color of the plot function).

legendspec :

a 1-by-nbplot matrix of strings, the legend of each CDF plot. The k-th plot has the legend legendspec(k), for k=1,2,...,nbplot.

Description

Plots a discrete (integer) Cumulative Distribution Function. The CDF of a discrete random variable is discontinuous, with jumps at each point. More precisely, it is continuous from the right. This is why a dedicated plotting function was created.

For the k-th CDF and the j-th outcome, the line starts from x(j) to x(j+1), at ordinate p(j,k), for j=1,2,...,n and k=1,2,...,nbplot. On the left of the line, a full circle is plotted, meaning that

\begin{eqnarray}
P\left(X\leq x(j)\right)=p(j,k).
\end{eqnarray}

On the right of the line, an empty circle is plotted, meaning that

\begin{eqnarray}
P\left(X<x(j+1)\right)=p(j,k).
\end{eqnarray}

Examples

// Plot the geometric distribution
x=(0:11)';
pr=0.2;
p=distfun_geocdf(x,pr)
scf();
distfun_plotintcdf(x,p)

// Plot several geometric distributions
x=(0:11)';
p1=distfun_geocdf(x,0.2);
p2=distfun_geocdf(x,0.5);
p3=distfun_geocdf(x,0.8);
legendspec=["pr=0.2" "pr=0.5" "pr=0.8"];
scf();
distfun_plotintcdf(x,[p1,p2,p3],["r" "b" "g"],legendspec)

Bibliography

http://en.wikipedia.org/wiki/Poisson_distribution

Authors


Report an issue
<< distfun_permrnd Support distfun_verboseset >>