View Single Post
  #4   Report Post  
Jerry W. Lewis
 
Posts: n/a
Default t-distribution puzzle in Excel

Please clarify what you did. Are you talking about
1. Using TINV(2*p,df) but only for p<0.5 with an auxiliary Bernoulli
variable to decide whether it is the upper or lower tail (multiply
t-value by +/-1).
2. Using Ian Smith's inv_tdist(p,df).
3. Using Ian Smith's inv_tdist(p,df) but only for p<0.5 with an
auxiliary Bernoulli variable to decide whether it is the upper or lower
tail (multiply t-value by +/-1).
4. Something else (please describe)

I would be very surprised if you are finding a VBA function to be faster
than a native Excel function.

In Excel 2002 and earlier versions,
=TINV(p,df)
returns 5E6 for p<4.3E-7, regardless of df (too extreme even for df=1).
Whenever you hit such a value, that will necessarily destabilize your
descriptive statistics.

Excel 2003 truncates the distribution at 1E7, but the p-value for which
TINV returns 1E7 varies with df, and seems to provide around 10 digit
accuracy in this tail, so TINV in 2003 might be acceptable to generate
random variates, but I still would avoid GAMMAINV for this purpose.

By contrast, Ian Smith's VBA functions are as close to machine accuracy
as I have seen in any double precision implementation (better than
commercial statistics packages, better than commercial math libraries, etc.)

Jerry


wrote:

Thanks Jerry! Btw, your function is a LOT faster than Excel's tinv!

But the results are still the same.

I'm beginning to wonder.. maybe the distribution of the sample kurtosis
is so *terribly* skewed, even for sample of size 60000, that it looks
to me like I'm getting a biased result? And maybe the variance is so
terribly huge too (I only know the theoretical variance of the sample
kurtosis for normal, not t distribution)..