forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 11:45 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: invstudenttdistribution() bug or my problem?
PostPosted: Wed Jan 05, 2011 10:23 pm 
Offline

Joined: Fri Dec 31, 2010 4:32 pm
Posts: 3
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.


Top
 Profile  
 
 Post subject: Re: invstudenttdistribution() bug or my problem?
PostPosted: Fri Jan 07, 2011 8:14 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
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.


Top
 Profile  
 
 Post subject: Re: invstudenttdistribution() bug or my problem?
PostPosted: Fri Jan 07, 2011 11:53 pm 
Offline

Joined: Fri Dec 31, 2010 4:32 pm
Posts: 3
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!


Top
 Profile  
 
 Post subject: Re: invstudenttdistribution() bug or my problem?
PostPosted: Sun Jul 27, 2014 7:10 am 
Offline

Joined: Sun Jul 27, 2014 7:09 am
Posts: 6
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


Top
 Profile  
 
 Post subject: Re: invstudenttdistribution() bug or my problem?
PostPosted: Sun Jul 27, 2014 9:11 am 
Offline

Joined: Sun Jul 27, 2014 7:09 am
Posts: 6
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)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 39 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group