Each row of test_results is one hypothesis test, with its test statistic, degrees of freedom and significance level. A seeded lookup table, critical_values, holds the critical value for each combination of df and alpha. Join every test to its critical value on df and alpha, and label the test 'reject' when test_statistic is strictly greater than critical_value, otherwise 'accept'.
Input Table(s)
test_results
| Column | Type | Meaning |
|---|
| test_statistic | DECIMAL(8,3) | Observed value of the test statistic |
| df | INT | Degrees of freedom of the test |
| alpha | DECIMAL(4,3) | Significance level, either 0.05 or 0.01 |
Each row is one test. The table has no key column, and two tests may share the same values.
critical_values
| Column | Type | Meaning |
|---|
| df | INT | Degrees of freedom |
| alpha | DECIMAL(4,3) | Significance level |
| critical_value | DECIMAL(8,4) | Threshold the statistic must exceed to reject |
Primary key: (df, alpha).
Output Contract
One row per row of test_results, with these columns in this order:
| Column | Definition |
|---|
| test_statistic | From test_results |
| df | From test_results |
| alpha | From test_results |
| critical_value | The matching value from critical_values |
| decision | 'reject' if test_statistic > critical_value, else 'accept' |
Return the numeric columns as stored, without rounding. Sort by df ascending, then alpha ascending, then test_statistic ascending.
Example
Input test_results:
| test_statistic | df | alpha |
|---|
| 2.93 | 4 | 0.05 |
| 3.188 | 4 | 0.01 |
| 8.4 | 3 | 0.01 |
| 13.909 | 3 | 0.01 |
| 4.998 | 2 | 0.01 |
| 2.676 | 1 | 0.01 |
| 9.061 | 2 | 0.05 |
Input critical_values:
| df | alpha | critical_value |
|---|
| 1 | 0.05 | 3.841 |
| 1 | 0.01 | 6.635 |
| 2 | 0.05 | 5.991 |
| 2 | 0.01 | 9.21 |
| 3 | 0.05 | 7.815 |
| 3 | 0.01 | 11.345 |
| 4 | 0.05 | 9.488 |
| 4 | 0.01 | 13.277 |
Expected result:
| test_statistic | df | alpha | critical_value | decision |
|---|
| 2.676 | 1 | 0.01 | 6.635 | accept |
| 4.998 | 2 | 0.01 | 9.21 | accept |
| 9.061 | 2 | 0.05 | 5.991 | reject |
| 8.4 | 3 | 0.01 | 11.345 | accept |
| 13.909 | 3 | 0.01 | 11.345 | reject |
| 3.188 | 4 | 0.01 | 13.277 | accept |
| 2.93 | 4 | 0.05 | 9.488 | accept |
Only two tests clear their thresholds: 9.061 is above 5.991 (df 2, alpha 0.05) and 13.909 is above 11.345 (df 3, alpha 0.01). Every other statistic is below its critical value.
Constraints and Clarifications
-
Every (
df
,
alpha
) pair in
test_results
has exactly one row in
critical_values
.
-
No column in either table is NULL.
-
A statistic exactly equal to its critical value is labeled
'accept'
, because rejection requires strictly greater.
-
Duplicate rows in
test_results
are separate tests and each appears in the output.