forum.alglib.net http://forum.alglib.net/ |
|
invstudenttdistribution() bug or my problem? http://forum.alglib.net/viewtopic.php?f=2&t=149 |
Page 1 of 1 |
Author: | tomjefferson [ Wed Jan 05, 2011 10:23 pm ] |
Post subject: | invstudenttdistribution() bug or my problem? |
Hello, I am trying to use alglib.invstudenttdistribution() in the same way as Excel's TINV() function or .NET's Chart.DataManipulator.Statistics.InverseTDistribution() function. However, I am getting different results. double x = alglib.invstudenttdistribution(3, 0.05); // gives me -2.3533634348018238 x = chrt.DataManipulator.Statistics.InverseTDistribution(0.05, 3); // .NET gives me 3.1824463049985425 The InverseTDistribution() result is correct and it is close to the Excel value, but invstudenttdistribution's result looks not OK. I checked your docs, but there is not a lot of description for usage of invstudenttdistribution(). Is this a bug, my improper usage of your function, or what else is happening? I'd appreciate any help you can offer on this puzzle. Thank you. |
Author: | Sergey.Bochkanov [ Fri Jan 07, 2011 8:14 am ] |
Post subject: | Re: invstudenttdistribution() bug or my problem? |
I think that ALGLIB result is correct. ALGLIB invstudenttdistribution(k,p) returns such t that integral(student_PDF(x)dx : x=-INF...t)=p. If p=0.5, t=0. If p=1.0, t=+INF. If p=0.0, t=-INF. ALGLIB returns inverse CDF. DataManipulator and Excel's TINV() just use another definition of inverse distribution. Read http://office.microsoft.com/en-gb/excel ... 09317.aspx to find out what definition they use. |
Author: | tomjefferson [ Fri Jan 07, 2011 11:53 pm ] |
Post subject: | Re: invstudenttdistribution() bug or my problem? |
Thank you Sergey! I looked at that link and played around with the relationship between the probability used by alglib.invstudenttdistribution() versus Microsoft's versions and I found this relationship: p_alglib = 1.0 - (0.5 * p_Excel) With this conversion, alglib.invstudenttdistribution() appears to work like a charm in my software. Thanks for your excellent help! |
Author: | hameedacpa [ Sun Jul 27, 2014 7:10 am ] |
Post subject: | Re: invstudenttdistribution() bug or my problem? |
tomjefferson wrote: Thank you Sergey! I looked at that link and played around with the relationship between the probability used by alglib.invstudenttdistribution() versus Microsoft's versions and I found this relationship: p_alglib = 1.0 - (0.5 * p_Excel) With this conversion, alglib.invstudenttdistribution() appears to work like a charm in my software. Thanks for your excellent help! I think there is something wrong with this relation , p_alglib = 1.0 - (0.5 * p_Excel) , please can anybody show the exact relation, I tried the above figures but it is not matching I need excel to give me the same results as alglib |
Author: | hameedacpa [ Sun Jul 27, 2014 9:11 am ] |
Post subject: | Re: invstudenttdistribution() bug or my problem? |
I reconciled both excel tinv and invstudenttdistribution and as a reference for this in the forum I'll mention it the reconciliation will be according to the one tail result and two tails result for one tail result -1*InvStudentTDistribution(3,.05) = TINV(.05*2,3) for two tails result -1*InvStudentTDistribution(3,.05/2) = TINV(.05,3) |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |