Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 P-Value in SQL

Author  Topic 

zoe2003
Starting Member

17 Posts

Posted - 2013-12-04 : 04:38:44
Hi There,

I need to create a table with P-values (from statistical t-test).
The table should have the following 3 columns: DF (degree of freedom), X, P-value.
P-value can be calculated in Excel using the following function :
T.DIST.RT(X,DF)

Is there a built-in function in PL/SQL to calculate the p-value ?
How can I calculate it without using an Excel ?
[It will be a 17M records table- 0.00<X<17.00, 1<DF<10000) ]

Tx,
Z

Kristen
Test

22859 Posts

Posted - 2013-12-04 : 05:09:31
quote:
Originally posted by zoe2003

Is there a built-in function in PL/SQL to calculate the p-value ?


Sounds like you are using Oracle? (This is a Microsoft SQL forum, so doubtful anyone here will now, you'd be better off with an Oracle forum)
Go to Top of Page

zoe2003
Starting Member

17 Posts

Posted - 2013-12-04 : 06:33:55
I'm using SQL Server 2008 R2
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2013-12-04 : 12:11:26
quote:
Originally posted by zoe2003

I'm using SQL Server 2008 R2



OK, well you will be using T-SQL then, rather than PL/SQL (which is Oracle's SQL)

Sorry, I don't know anything about statistical functions in SQL, but all functions are listed in "Books Online" - which is the help facility that comes with SQL. It is available on Microsoft's web site, but is also usually installed on your PC / Server when you install SQL Server or the SQL Tools, so you may well find that you have that installed locally (contrary to its, now outdated, name of "Books Online")
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-12-04 : 14:04:28
In answer to your question there is no t-sql function that will generate P-Values.

sql server is not the best application for statistical analysis. but if that is the tool you need to use and you still want a solution from us then you'll likely need to post some better requirements. This site has a lot of sql smarties but probably not many of them are statisticians. From a quick look at some p-value posts it looks like in order to get an answer you first need to get MEAN values, standard deviations , degree of freedom, and maybe some other stuff too. Not sure if you are asking us to calculate all the prerequisite results or you are providing them.

If you provide sample data and expected output based on the sample data and a description (in non-statistics speak keeping acronyms to a minimum) about the logic used to get the answer someone can provide a solution.

Look here for how to provide us this information:

by the way, if we can use excel to validate our results that's good but I personally will need more than this to know what i need to put into excel to see actual output: "T.DIST.RT(X,DF)"

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -