Hi All,
I'm trying to calculate 90/95% confidence intervals on data that I have. Oracle doesn't seem to be able to give me the Critical T-Values from the Student's T Table given N-1 degrees of freedom and a given confidence level, ie 90 or 95%. I've managed to create the student's t table in Oracle, I've named the table STUDENTS_T_TABLE_REF. Below is a small sample of the table:
DEGREE_FREEDOM CONFIDENCE_LVL CRITICAL_T_VALUE
1 90 6.3138
2 90 2.92
3 90 2.3534
4 90 2.1319
5 90 2.015
6 90 1.9432
7 90 1.8946
8 90 1.8595
9 90 1.8331
10 90 1.8124
11 90 1.7959
12 90 1.7823
13 90 1.7709
14 90 1.7613
1 95 12.7065
2 95 4.3026
3 95 3.1824
4 95 2.7764
5 95 2.5706
6 95 2.4469
7 95 2.3646
8 95 2.306
9 95 2.2621
10 95 2.2282
11 95 2.201
12 95 2.1788
13 95 2.1604
14 95 2.1448
I want to create a function or procedure that looks up the Critical T Value from this table given a user inputted confidence level, ie 95%, given N-1 degrees of freedom where N = Sample size. The sample sizes will be pulled from aggregate tables I create. So for instance I have a table called AGGREGATE_DATA_SAMPLES and within this table I have a column called "SAMPLE_SIZE". What I would like to have is an oracle function or procedure that allows the user to specify the following as input parameters:
1. Name of the column in the aggregate table that contains the sample sizes. The sample size inputted is substracted by 1 to get degrees of freedom.
2. Confidence Level, ie 95.
This function/procedure in turn outputs or returns the Critical T Value from the STUDENTS_T_TABLE_REF table. So for example I'll name of the function/procedure CRITICAL_T and call it by inputting the parameters above so it would look like, CRITICAL_T(sample_size,95) and it would return, for every row in my AGGREGATE_DATA_SAMPLES table the critical t value. So if I had 3 rows in my AGGREGATE_DATA_SAMPLES table, it would return the critical t given the sample size and confidence level of 95%.
Select sample_size, critical_t(sample_size,95) from AGGREGATE_DATA_SAMPLES;
SAMPLE_SIZE CRITICAL_T_VALUE (computed)
9 2.306
14 2.1604
4 3.1824
Hope this makes sense. I'm using Oracle 10g version. Any help would be appreciated.
Thanks,
Ed