輪盤實驗室 · 實驗室 · 統計 · 8分鐘

卡方檢驗

檢驗「這37個計數是否像公平轉輪會產生的結果?」的標準方法。

簡短答案

χ² = Σ(觀察值 − 期望值)² / 期望值,對全部37個口袋求和。再與自由度36的卡方分佈比較,即可得出 p 值。

統計量
Σ (O−E)²/E
自由度
36
5%臨界值
51.0
1%臨界值
58.6

計算方式

每個口袋設備口袋轉子上37個有號碼隔間之一。也稱 slot、cup。閱讀全文 →的期望計數是n/37。對每個口袋,把觀察值與期望值之差平方,再除以期望值;然後把37項相加。公平轉輪得出的值平均約為36(即自由度實驗室自由度統計量中彼此獨立的數值個數。對37個口袋做卡方檢驗時為36,因為計數必須加總為總數。閱讀全文 →),標準差數學標準差方差的平方根;結果與期望值的典型距離。閱讀全文 →約8.5。高於51.0即在5%水平顯著;高於58.6則在1%水平顯著。「輪盤轉輪偏差分析器」會計算這個統計量,並以正則化不完全伽瑪函數求出精確的p 值實驗室p 值若轉輪公平,觀察到至少與目前偏差同樣大的偏離的概率。閱讀全文 →。

旋轉次數n每個口袋的期望值每個口袋的 σ+2σ 的口袋+3σ 的口袋
370103.11619
1,000275.13742
3,7001009.9120130
10,00027016.2303319
37,0001,00031.21,0621,094
σ ≈ √(n·p·(1−p)),其中p = 1/37。在1,000次旋轉中,某口袋中獎37次並不出奇;中獎42次就值得再收集第二個樣本。

一個計算實例

Consider a hypothetical sample of 1,000 independent spins數學獨立轉輪結果每次旋轉不論過去紀錄,概率都相同。本站每項計算的基礎。閱讀全文 →. Each pocket has an expected count of 1,000/37 ≈ 27.03. If pocket 8 appears 41 times, its contribution to the statistic is about 7.22. Suppose the total statistic is approximately 45.2. On 36 degrees of freedom, the approximate p-value is 0.14: under the fair-wheel model, a statistic at least this large has a probability數學概率結果發生的可能性,以0到1或0%到100%表示。一個號碼:1/37 = 2.70%。閱讀全文 → of about 14%. This is not significant at the 5% level, and it does not prove the wheel is fair. A pocket selected after examining these counts needs independent confirmation; another 1,000 spins is not guaranteed to resolve a small departure.

假設條件

The usual approximation assumes independent observations and adequate expected counts. The common five-per-cell rule gives n ≥ 185 for 37 equal pockets; it is a guideline for the approximation, not a hard boundary for all possible tests. Pooling wheels changes the population being tested. Dependence may invalidate the reference distribution without necessarily increasing the statistic.

輪盤荷官特徵獨立的輪盤旋轉

Pearson與蒙地卡羅

Karl Pearson於1900年發表這個檢驗,他最早的計算實例之一,就是26,306次有紀錄的蒙地卡羅輪盤旋轉。他發現這些結果極不均勻,不可能出於偶然,並宣稱「蒙地卡羅輪盤……並不是一種碰運氣的遊戲」。後來的作者斷定,為報章記錄旋轉結果的記者捏造了其中許多紀錄;這本身就是關於數據來源的一課。

Pearson在1900年的檢驗發現,蒙地卡羅的旋轉紀錄不均勻得離譜;原來報章的記錄者捏造了其中許多。

蒙地卡羅輪盤

真實檢驗:拉斯維加斯的自動轉輪

A published analysis of specific automatic wheels is evidence about those recorded samples, not all automatic roulette. A non-significant uniformity test cannot prove the absence of steering, and combining several wheels does not identify the behavior of each one. Check the original study’s data and design before drawing that conclusion.

超越卡方檢驗

若只懷疑單一口袋,二項檢驗的統計功效較高。若懷疑一段弧區,請使用「區段分析」頁面上的區段轉輪區段轉輪上連續的一段口袋弧線,不同於投注枱面上的一組號碼。閱讀全文 →z檢驗。卡方是一種綜合檢驗:它告訴你有地方不對勁,卻不說是哪裏。先用它,再細看。

區段分析

公式

χ² = Σᵢ (Oᵢ − Eᵢ)² / Eᵢ
Eᵢ = n / 37 · 自由度 = 36
臨界值:51.0(5%) · 58.6(1%)

問題

為何是36個自由度而非37個?

37個計數必須加總為n,因此只有36個可以自由變動。

偏差嚴重的轉輪,χ²會是多少?

若轉輪在10,000次旋轉中有一個口袋以1/25的概率中獎,單是該口袋一項就約有60;χ²約為100,p實際上等於零。

可以用200次旋轉執行嗎?

技術上可以,每個口袋的期望值為5.4。但除非有某個口袋被黏死,否則它甚麼也偵測不到。

漫畫點綴

For 36 degrees of freedom, the approximate 5% upper-tail cutoff is 51.0.

For 36 degrees of freedom, the approximate 5% upper-tail cutoff is 51.0.

來源

  1. Pearson, K. “On the criterion that a given system of deviations from the probable…” https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/chsqgood.htm
  2. Feller, W. An Introduction to Probability Theory and Its Applications, Vol. 1. https://www.amstat.org/asa/files/pdfs/P-ValueStatement.pdf
模型:歐式、單零方法論 ↗來源 ↗