[轉錄][統算] chisq.test

看板NCU97Stat作者 (細枝小葉)時間15年前 (2009/06/06 16:24), 編輯推噓2(201)
留言3則, 3人參與, 最新討論串1/1
※ [本文轉錄自 NCU96Stat 看板] 作者: Chris7462 (~烤焦麵包~) 看板: NCU96Stat 標題: Re: [統算] chisq.gof() 時間: Wed Jun 4 00:48:56 2008 # 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,
好厲害
06/04 12:47

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

06/05 14:58,
感激Q__Q
06/05 14:58
-- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.161.197.102

06/06 16:34, , 1F
學長3q~
06/06 16:34, 1F

06/06 21:05, , 2F
不客氣。突然看到自己 po 的文還滿奇怪的 = =
06/06 21:05, 2F

06/07 23:17, , 3F
太感謝了~!!
06/07 23:17, 3F
文章代碼(AID): #1AAYVEwt (NCU97Stat)