_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 覿殊炎

Contents

1 螳語 覦覯
2 ks.test(貊覈螻襦-る碁ゴ誤 蟆)
3 chisq.test(豺伎伎螻 蟆)
4 谿瑚


1 螳語 覦覯 #

  • ks.test --> 螳 覿襯 螳讌 瑚?
  • chisq.test --> 螳螳 bin 谿願 ?
  • run.test --> 谿願 蠏覿瑚? 讌朱 覦朱 蟾れ蟇磯 朱 願 覓語

2 ks.test(貊覈螻襦-る碁ゴ誤 蟆) #

覲 ecdf 谿願 螳 螳朱 貊覈螻襦-る碁ゴ誤 蟆糾 蠏朱襯 伎 蟆.
x1 <- rnorm(50)
x2 <- rnorm(50, -1)

compare <- function(x, y) {
  n <- length(x); m <- length(y)
  w <- c(x, y)
  o <- order(w)
  z <- cumsum(ifelse(o <= n, m, -n))
  i <- which.max(abs(z))
  w[o[i]]
}
u <- compare(x1,x2)
e.x <- ecdf(x1)
e.y <- ecdf(x2)
abs(e.x(u) - e.y(u))
ks.test(x1,x2)$statistic

plot(e.x, col="Blue", main="ECDF", xlab="Value", ylab="Probability", xlim=range(c(x1,x2)))
plot(e.y, add=TRUE, col="Red")
lines(c(u,u), c(0,1), col="Gray")
lines(c(u,u), c(e.x(u), e.y(u)), lwd=2)
text(u*1.04, abs(e.x(u)-e.y(u)) * 1.5, label="D")
kstest3.png

るジ 覦覯
x1 <- rnorm(50)
x2 <- rnorm(50, -1)

library("rgr")
gx.ks.test(x1, x2)

蟆郁骸
> gx.ks.test(x1, x2)

	Two-sample Kolmogorov-Smirnov test

data:  x1 and x2
D = 0.3, p-value = 0.02171
alternative hypothesis: two-sided
kstest.png

るジ 覦覯
plot(ecdf(x1), do.points = FALSE, verticals=T, xlim=range(x1, x2))
lines(ecdf(x2), lty=3, do.points = FALSE, verticals=T)
ks.test(x1, x2, alternative="two.sided")

3 chisq.test(豺伎伎螻 蟆) #

chisq.test(x1, p=x2/sum(x2))

蟆郁骸
> chisq.test(x1, p=x2/sum(x2))

	Chi-squared test for given probabilities

data:  x1
X-squared = 169.74, df = 49, p-value = 3.196e-15

Warning message:
In chisq.test(x1, p = x2/sum(x2)) :
  豺伎伎螻 approximation 讌  給

蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

讌ろ蠍 覓語 譬 讌襷 讌れ 蠍壱讌 蠍一 蠍壱. (襴 襷リ骸伎)