[pstricks] graphs of the t-distribution?
Christian Sgraja
christian.sgraja at uni-ulm.de
Fri Feb 17 09:06:17 CET 2006
Alan Ristow wrote:
> In theory you could do it with \psplot, provided you know how to write
> mathematical expressions in Postscript. From a practical perspective,
> though, I think trying to compute the definite integral in the gamma
> function might be tricky. I've never tried anything that advanced with
> \psplot, but as I recall Postscript uses 8-bit arithmetic for its
> calculations -- even if you figure out how to program it, you might have
> problems with roundoff error.
I agree with Alan to use the \psplot command and that the main obstacle
is the gamma function in the specification of the t-density (for the
square-root and power, use the postscript commands "sqrt" and "exp").
However, the argument of the gamma functions takes on only integer
and half-integer values, which means you don't have to use a series
representation.
Note that:
Gamma(n) = (n-1)!
Gamma(n-1/2) = \sqrt{\pi} \prod_{i=1}^{n-1} (i-1/2)
where Gamma(0) = 1 and Gamma(1/2) = \sqrt{\pi}.
For evaluation of the factorial, use a recursive postscript function,
made global via the \pstVerb command:
\pstVerb{%
/factorial{%
dup 1 gt {dup 1 sub factorial mul} if
} def
}
BTW, it's a good idea to plot the Student-t and Gaussian density in the
same graph, since for n tending to infinity, the t-density converges to
a Gaussian density (which you probably want to show).
Christian.
More information about the PSTricks
mailing list