Oracle PL/SQL/Analytical Functions/STATS WSR TEST
Версия от 13:45, 26 мая 2010; (обсуждение)
STATS_WSR_TEST(expr1, expr2, "ONE_SIDED_SIG"): For one-tailed significance level
SQL>
SQL> create table TestTable (
2 x number primary key,
3 y number
4 );
Table created.
SQL> insert into TestTable values (1, 7 );
1 row created.
SQL> insert into TestTable values (2, 1 );
1 row created.
SQL> insert into TestTable values (3, 2 );
1 row created.
SQL> insert into TestTable values (4, 5 );
1 row created.
SQL> insert into TestTable values (5, 7 );
1 row created.
SQL> insert into TestTable values (6, 34 );
1 row created.
SQL> insert into TestTable values (7, 32 );
1 row created.
SQL> insert into TestTable values (8, 43 );
1 row created.
SQL> insert into TestTable values (9, 87 );
1 row created.
SQL>
SQL> select * from TestTable;
X Y
---------- ----------
1 7
2 1
3 2
4 5
5 7
6 34
7 32
8 43
9 87
9 rows selected.
SQL>
SQL> -- STATS_WSR_TEST(expr1, expr2, "ONE_SIDED_SIG"): For one-tailed significance level
SQL>
SQL> -- STATS_WSR_TEST(expr1, expr2, "ONE_SIDED_SIG")
SQL>
SQL>
SQL> SELECT STATS_WSR_TEST(y, x, "ONE_SIDED_SIG") FROM TestTable;
STATS_WSR_TEST(Y,X,"ONE_SIDED_SIG")
-----------------------------------
.013923976
SQL>
SQL> drop table TestTable;
Table dropped.
SQL>
SQL>
SQL>
STATS_WSR_TEST(expr1, expr2, "TWO_SIDED_SIG"): For two-tailed significance level
SQL>
SQL>
SQL> create table TestTable (
2 x number primary key,
3 y number
4 );
Table created.
SQL> insert into TestTable values (1, 7 );
1 row created.
SQL> insert into TestTable values (2, 1 );
1 row created.
SQL> insert into TestTable values (3, 2 );
1 row created.
SQL> insert into TestTable values (4, 5 );
1 row created.
SQL> insert into TestTable values (5, 7 );
1 row created.
SQL> insert into TestTable values (6, 34 );
1 row created.
SQL> insert into TestTable values (7, 32 );
1 row created.
SQL> insert into TestTable values (8, 43 );
1 row created.
SQL> insert into TestTable values (9, 87 );
1 row created.
SQL>
SQL> select * from TestTable;
X Y
---------- ----------
1 7
2 1
3 2
4 5
5 7
6 34
7 32
8 43
9 87
9 rows selected.
SQL>
SQL> -- STATS_WSR_TEST(expr1, expr2, "TWO_SIDED_SIG"): For two-tailed significance level
SQL>
SQL> -- STATS_WSR_TEST(expr1, expr2, "TWO_SIDED_SIG")
SQL>
SQL>
SQL> SELECT STATS_WSR_TEST(y, x, "TWO_SIDED_SIG") FROM TestTable;
STATS_WSR_TEST(Y,X,"TWO_SIDED_SIG")
-----------------------------------
.027847953
SQL>
SQL> drop table TestTable;
Table dropped.
SQL>
SQL>
SQL>
STATS_WSR_TEST(y, x, "STATISTIC"): Wilcoxon Signed Ranks test tests whether medians of two populations are significantly different
SQL>
SQL>
SQL> create table TestTable (
2 x number primary key,
3 y number
4 );
Table created.
SQL> insert into TestTable values (1, 7 );
1 row created.
SQL> insert into TestTable values (2, 1 );
1 row created.
SQL> insert into TestTable values (3, 2 );
1 row created.
SQL> insert into TestTable values (4, 5 );
1 row created.
SQL> insert into TestTable values (5, 7 );
1 row created.
SQL> insert into TestTable values (6, 34 );
1 row created.
SQL> insert into TestTable values (7, 32 );
1 row created.
SQL> insert into TestTable values (8, 43 );
1 row created.
SQL> insert into TestTable values (9, 87 );
1 row created.
SQL>
SQL> select * from TestTable;
X Y
---------- ----------
1 7
2 1
3 2
4 5
5 7
6 34
7 32
8 43
9 87
9 rows selected.
SQL>
SQL> --STATS_WSR_TEST(y, x, "STATISTIC"): Wilcoxon Signed Ranks test tests whether medians of two populations are significantly different.
SQL>
SQL>
SQL> SELECT STATS_WSR_TEST(y, x, "STATISTIC") FROM TestTable;
STATS_WSR_TEST(Y,X,"STATISTIC")
-------------------------------
-2.1994217
SQL>
SQL> drop table TestTable;
Table dropped.
SQL>
SQL>
SQL>