[統算] chisq.test

看板NCU96Stat作者 (~烤焦麵包~)時間16年前 (2008/06/04 00:48), 編輯推噓3(300)
留言3則, 3人參與, 最新討論串1/1
# chisq.test.r - rescale.p = FALSE, simulate.p.value = FALSE, B = 2000) + rescale.p = FALSE, simulate.p.value = FALSE, B = 2000, unspec.m = 0) else { - PARAMETER <- length(x) - 1 + if(unspec.m){ + PARAMETER <- length(x) - unspec.m - 1 + } + else { + PARAMETER <- length(x) - 1 + } PVAL <- pchisq(STATISTIC, PARAMETER, lower.tail = FALSE) } ## Example 9c ## > N <- c(6, 2, 1, 9, 7, 5) > prob <- c(0.0550, 0.1596, 0.2312, 0.2237, 0.1622, 0.1682) > chisq.test(N, p=prob, unspec.m=1) Chi-squared test for given probabilities data: N X-squared = 19.887, df = 4, p-value = 0.0005257 Warning message: In chisq.test(N, p = p, unspec.m = 1) : Chi-squared approximation may be incorrect -- 改一下 chisq.test 的函式,加入一個 unspec.m(unspecified parameter 的個數) 這樣跑出來的結果就跟 Example 9c 一樣了,也就是我們要的 goodness of fit :p -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.221.212 ※ 編輯: Chris7462 來自: 140.115.221.212 (06/04 01:25)

06/04 12:47, , 1F
好厲害
06/04 12:47, 1F

06/05 01:25, , 2F
真的超強的!!!感恩感恩
06/05 01:25, 2F

06/05 14:58, , 3F
感激Q__Q
06/05 14:58, 3F
文章代碼(AID): #18HNNxZq (NCU96Stat)