「上昇トレンドの検定 ヨンクヒール・タプストラ検定」にて
SAGx というライブラリ(パッケージ)は普通にはないので,代替法を探していて,
http://aoki2.si.gunma-u.ac.jp/R/Jonckheere.html
にあるとか,cor.test で method="kendall" とするのと同じであるとかの収穫があった。
で,ブログ著者は,「この本の例をやってみる。」...「本ではものすごい小さいp値になるらしいけど1になる。保留。」としているが,
JT.test(y[1, ], rep(1, 7), alternative="increasing")
というのは,書式を間違えていると思う。だから,変な結果になっただけだろう。実際の所,以下のように確かに P 値はとっても小さな値になる。
> y <- rbind(c(1.06, 1.03, 1.10, 1.66, 1.72, 1.82, 1.91),
+ c(0.98, 1.02, 1.08, 1.58, 1.68, 1.78, 1.89),
+ c(1.09, 1.10, 1.11, NA, 1.71, 1.83, 1.92))
> y <- c(y)
> g <- rep(1:7, each=3)
> Jonckheere(y, g)
ヨンキー検定
data: y by g
J = 164.5000, E(J) = 85.5000, V(J) = 231.5250, Z-value = 5.1919,
p-value = 1.041e-07
alternative hypothesis: control <= treat-1 <= ... <= treat-n
> cor.test(y, g, method="kendall", alternative="greater")
Kendall's rank correlation tau
data: y and g
z = 5.1919, p-value = 1.041e-07
alternative hypothesis: true tau is greater than 0
sample estimates:
tau
0.8788771
cor.test(x, g, method="kendall") だということ...
http://aoki2.si.gunma-u.ac.jp/R/Jonckheere.html
の例題
> x <- c(
+ 153, 153, 152, 156, 158, 151, 151, 150, 148, 157, # 第 1 群のデータ
+ 158, 152, 152, 152, 151, 151, 157, 147, 155, 146, # 第 2 群のデータ
+ 153, 146, 138, 152, 140, 146, 156, 142, 147, 153, # 第 3 群のデータ
+ 137, 139, 141, 141, 143, 133, 147, 144, 151, 156 # 第 4 群のデータ
+ )
> g <- rep(1:4, each=10)
> Jonckheere(x, g, alternative="decreasing")
ヨンキー検定
data: x by g
J = 446.5000, E(J) = 300.0000, V(J) = 1705.0776, Z-value = 3.5479,
p-value = 0.0001942
alternative hypothesis: control >= treat-1 >= ... >= treat-n
は
> cor.test(x, g, method="kendall", alternative="less")
Kendall's rank correlation tau
data: x and g
z = -3.5479, p-value = 0.0001942
alternative hypothesis: true tau is less than 0
sample estimates:
tau
-0.4391269
と同じだということ。知らなかった。