Re: Good algorithm for Inverse of cumulative Student's t?
- From: iandjmsmith@xxxxxxx
- Date: 19 Aug 2006 00:36:26 -0700
Schizoid Man wrote:
Hi,
I'm trying to set up a credit risk model that employees a Student t
copula. For this purpose, I need algorithms for:
a. the cumulative distribution function of the Student t
b. the inverse of the cumulative distribution function of the Student t
I nicked the CDF from Numerical Recipes and it seems to do the job quite
well, but I have not had much luck with the inverse algorithm.
I also needed to setup a Gaussian copula for which I used Excel's
built-in NORMSDIST() for the CDF which was good enough, and P.J.
Acklam's inverse algorithm, since NORMSINV() is meant to be quite horrible.
Thanks,
Schiz
You could use the inv_tdist code in
http://members.aol.com/iandjmsmith/Examples.xls (VBA code only in
http://members.aol.com/iandjmsmith/Examples.txt)
It requires a accurate algorithm for the cdf of the t-distribution and
a function to invert the normal distribution.
The accuracy of the cdf of the t-distribution from NR is not very high
so you will have to reduce the accuracy to which the code for inv_tdist
works.
If you wish an algorithm rather than code
Choose a decent starting approximation. I use the one given in
Abramowitz & Stegun (26.7.5)
For probabilities <= 0.5 use Newton Raphson to solve
log(cdf(tapprox,df)) = log(prob)
which is done using
new tapprox = tapprox -
log(cdf(tapprox,df)/prob).cdf(tapprox,df)/pdf(tapprox,df)
if prob and cdf(tapprox,df) are not close together or
new tapprox = tapprox -
log1p((cdf(tapprox,df)-prob)/prob).cdf(tapprox,df)/pdf(tapprox,df)
if prob and cdf(tapprox,df) are close together. log1p(x) is a function
which evaluates log(1+x) accurately for small x.
For probabilities > 0.5 use -inv_tdist(1-prob,df)
If you want a more accurate function for the cdf of the t-distribution
use cdf_tdist from the same source.
Ian Smith
.
- References:
- Good algorithm for Inverse of cumulative Student's t?
- From: Schizoid Man
- Good algorithm for Inverse of cumulative Student's t?
- Prev by Date: Re: Question about the usage of Binomial dist
- Next by Date: Re: Anybody know how to calculate this condiditonal Probability ?
- Previous by thread: Good algorithm for Inverse of cumulative Student's t?
- Next by thread: Re: Good algorithm for Inverse of cumulative Student's t?
- Index(es):
Relevant Pages
|