Solved

Posted on 2007-08-01

I need to write some code that, given a probability (eg 80%), and a number of degrees of freedom (eg 9) returns the t-distribution, as in the chart at the bottom of this page: http://en.wikipedia.org/wiki/T-distribution . (eg, for p=80%, df=9, the code would therefore return 0.883.)

I don't follow how they're getting that chart based on the derivation there. I tried finding some existing code and came up with the following links, but since I'm not familiar with OOP, I'm finding it hard to understand the code. Any help would be greatly appreciated.

Links to the t-distribution PHP code I found:

http://www.multistat.de/source.php?file=t.php

(this one is an archive of a bunch of different probability classes, including one for t-distribution)

http://www.google.com/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Fwww.phpmath.com%2Fbuild02%2Fdocs%2Fdownload.php%3Fop%3Ddownload&ei=LxCwRubnHaLSep-D0fsL&usg=AFQjCNGi4m7VjRsDnOuFl7vrWzG3otj6HQ&sig2=jVu-4ObjE_RFOMS6R-KzEA

All I really need is a function that will return a t-value given a probability and number of degrees of freedom.

I don't follow how they're getting that chart based on the derivation there. I tried finding some existing code and came up with the following links, but since I'm not familiar with OOP, I'm finding it hard to understand the code. Any help would be greatly appreciated.

Links to the t-distribution PHP code I found:

http://www.multistat.de/so

(this one is an archive of a bunch of different probability classes, including one for t-distribution)

http://www.google.com/url?

All I really need is a function that will return a t-value given a probability and number of degrees of freedom.

8 Comments

http://mathworld.wolfram.c

but I do not know what this means. How would I express this in a normal way?

http://mathworld.wolfram.c

http://mathworld.wolfram.c

B(r/2, 1/2) = (r/2-1)!(-1/2)!/(r/2-1/2)!

and I can just plug that into formula (6)

hm.. solving for t, I get

t = (r/((f(t)*B(r/2, 1/2)*r^(1/2))^(2/(1+r))) - r)^(1/2)

using f(t) = 90% and r = 1, I get

t = ( -0.646322349 )^(1/2)

when from the table, I am expecting t=3.07768. What am I doing wrong?

I started with formula (6), then used the definition for the beta function that you provided, and arrived at the wrong result. I went through it several times so I don't think it is a math error. What am I misunderstanding? Thanks.

Here is my work:

http://godshalk.com/tdist.

Title | # Comments | Views | Activity |
---|---|---|---|

Does high color HSV saturation imply that it must originate from a coherent laser source? | 21 | 77 | |

SQL Server - Query for Outlier | 11 | 44 | |

Calculating distances between two coordinates - all directions (PHP) | 12 | 42 | |

Vertex form of the function | 8 | 40 |

This is a research brief on the potential colonization of humans on Mars.

This video discusses moving either the default database or any database to a new volume.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**15** Experts available now in Live!