Skip to content · ⁨ข้ามไปยังเนื้อหา⁩

Inference for Categorical Data: Chi-Square · ⁨การอนุมานสำหรับข้อมูลเชิงประเภtsy: Chi-Square⁩

AP Statistics · Topic 8 · ⁨หัวข้อ 8⁩

Video lesson for this topic · ⁨บทเรียนวิดีโอสำหรับหัวข้อนี้⁩ Open the video page · ⁨เปิดหน้าวิดีโอ⁩
7:49

การอนุมานสำหรับข้อมูลเชิงประเภtsy: Chi-Square

โยนลูกเต๋าที่ adil sixty ครั้ง ทุกหน้าควรมีจำนวนเท่ากันสิบครั้ง แต่มันไม่เคยเป็นเช่นนั้น — แปดที่นี่ สิบสามที่นั่น ช่องว่างมีอยู่เสมอ ดังนั้นโยนอีกครั้ง...

English narration · English + 中文 subtitles burned in · ⁨การบรรยายภาษาอังกฤษ · คำบรรยายภาษาอังกฤษ + 中文 ลอยตัวบนภาพ⁩

8.1

Are My Results Unexpected? · ⁨ผลลัพธ์ของฉันผิดปกติหรือไม่?⁩

Syllabus · ⁨หลักสูตร⁩
English

Enduring Understanding (VAR-1): Given that variation may be random or not, conclusions are uncertain.

Learning Objective VAR-1.J: Identify questions suggested by variation between observed and expected counts in categorical data. [Skill 1.A]

  • VAR-1.J.1 Variation between what we find and what we expect to find may be random or not.
ไทย

ความเข้าใจที่ยั่งยืน (VAR-1): เนื่องจากความแปรปรวนอาจเป็นแบบสุ่มหรือไม่ ดังนั้นข้อสรุปจึงมีความไม่แน่นอน

วัตถุประสงค์การเรียนรู้ VAR-1.J: ระบุคำถามที่เกิดจากความแปรปรวนระหว่างจำนวนที่สังเกตได้และจำนวนที่คาดหวังในข้อมูลเชิงหมวดหมู่ [ทักษะ 1.A]

  • VAR-1.J.1 ความแปรปรวนระหว่างสิ่งที่เราพบกับสิ่งที่เราคาดว่าจะพบ อาจเกิดจากความบังเอิญหรือไม่ก็ตาม

Source: College Board AP Course and Exam Description · ⁨แหล่งที่มา: คำอธิบายหลักสูตรและข้อสอบ College Board AP⁩

English

When data are counts spread across several categories, we test whether the observed counts differ from what a claim predicts. The tool is the chi-square 卡方 ($\chi^2$) statistic, which adds up the standardized gaps between observed and expected counts:

$$\chi^2=\sum \frac{(\text{observed}-\text{expected})^2}{\text{expected}}.$$
A large $\chi^2$ means the observed counts are far from expected – evidence against the claim. The chi-square distribution is right-skewed and depends on its degrees of freedom 自由度.

ไทย

เมื่อข้อมูลเป็น จำนวนนับ กระจายอยู่หลายหมวดหมู่ เราจะทดสอบว่าจำนวนนับที่สังเกตได้แตกต่างจากการทำนายของข้ออ้างหรือไม่ เครื่องมือคือสถิติ chi-square ($\chi^2$) ซึ่งบวกช่องว่างมาตรฐานระหว่างจำนวนนับที่สังเกตได้และคาดหวังไว้:

$$\chi^2=\sum \frac{(\text{observed}-\text{expected})^2}{\text{expected}}.$$
ค่า $\chi^2$ ที่มากหมายความว่าจำนวนนับที่สังเกตได้ห่างจากจำนวนนับที่คาดหวัง – เป็นหลักฐาน反对ข้ออ้าง การแจกแจง chi-square มีความเบี่ยงไปทางขวาและขึ้นอยู่กับ องศาอิสระ ของมัน

Vocabulary · ⁨คำศัพท์⁩ Train · ⁨ฝึกฝน⁩
English ไทย
chi-square/kaɪ skweə/ ไคสแควร์ (chi-square)
degrees of freedom/dɪˈɡriːz ɒv ˈfriːdəm/ ระดับอิสระ
8.2

Setting Up a Goodness-of-Fit Test · ⁨การตั้งค่าทดสอบ Goodness-of-Fit⁩

Syllabus · ⁨หลักสูตร⁩
English

Enduring Understanding (VAR-8): The chi-square distribution may be used to model variation.

Learning Objective VAR-8.A: Describe chi-square distributions. [Skill 3.C]

  • VAR-8.A.1 Expected counts of categorical data are counts consistent with the null hypothesis. In general, an expected count is a sample size times a probability.

    The chi-square statistic measures the distance between observed and expected counts relative to expected counts.

    Chi-square distributions have positive values and are skewed right. Within a family of density curves, the skew becomes less pronounced with increasing degrees of freedom.

Learning Objective VAR-8.B: Identify the null and alternative hypotheses in a test for a distribution of proportions in a set of categorical data. [Skill 1.F]

  • VAR-8.B.1 For a chi-square goodness-of-fit test, the null hypothesis specifies null proportions for each category, and the alternative hypothesis is that at least one of these proportions is not as specified in the null hypothesis.

Learning Objective VAR-8.C: Identify an appropriate testing method for a distribution of proportions in a set of categorical data. [Skill 1.E]

  • VAR-8.C.1 When considering a distribution of proportions for one categorical variable, the appropriate test is the chi-square test for goodness of fit.

Learning Objective VAR-8.D: Calculate expected counts for the chi-square test for goodness of fit. [Skill 3.A]

  • VAR-8.D.1 Expected counts for a chi-square goodness-of-fit test are (sample size)(null proportion).

Learning Objective VAR-8.E: Verify the conditions for making statistical inferences when testing goodness of fit for a chi-square distribution. [Skill 4.C]

  • VAR-8.E.1 In order to make statistical inferences for a chi-square test for goodness of fit we must check the following:
    • a. To check for independence:
      • i. Data should be collected using a random sample or randomized experiment.
      • ii. When sampling without replacement, check that $n \leq 10\%N$.
    • b. The chi-square test for goodness of fit becomes more accurate with more observations, so large counts should be used (shape).
      • i. A conservative check for large counts is that all expected counts should be greater than 5.
ไทย

ความเข้าใจที่ยั่งยืน (VAR-8): การแจกแจง chi-square สามารถใช้เพื่อจำลองความแปรปรวน

วัตถุประสงค์การเรียนรู้ VAR-8.A: อธิบายการแจกแจง chi-square [ทักษะ 3.C]

  • VAR-8.A.1 จำนวนที่คาดหวังของข้อมูลเชิงหมวดหมู่คือจำนวนที่สอดคล้องกับสมมติฐานศูนย์ โดยทั่วไปแล้ว จำนวนที่คาดหวังคือขนาดตัวอย่างคูณกับความน่าจะเป็น

    สถิติ chi-square วัดระยะห่างระหว่างจำนวนที่สังเกตได้และจำนวนที่คาดหวังเมื่อเทียบกับจำนวนที่คาดหวัง

    การแจกแจง chi-square มีค่าเป็นบวกและมีลักษณะเบี่ยงไปทางขวา ภายในครอบครัวของเส้นโค้งความหนาแน่น ความเบี่ยงเบนจะลดลงเมื่อจำนวนอิสระเพิ่มขึ้น

วัตถุประสงค์การเรียนรู้ VAR-8.B: ระบุสมมติฐานศูนย์และสมมติฐานทางเลือกในการทดสอบการแจกแจงสัดส่วน的一组ข้อมูลเชิงหมวดหมู่ [ทักษะ 1.F]

  • VAR-8.B.1 สำหรับการทดสอบความเหมาะสมของ chi-square สมมติฐานศูนย์กำหนดสัดส่วนศูนย์ของแต่ละหมวดหมู่ และสมมติฐานทางเลือกคืออย่างน้อยหนึ่งสัดส่วนดังกล่าวไม่เป็นไปตามที่กำหนดไว้ในสมมติฐานศูนย์

วัตถุประสงค์การเรียนรู้ VAR-8.C: ระบุวิธีการทดสอบที่เหมาะสมสำหรับการแจกแจงสัดส่วน的一组ข้อมูลเชิงหมวดหมู่ [ทักษะ 1.E]

  • VAR-8.C.1 เมื่อพิจารณาถึงการแจกแจงสัดส่วนของตัวแปรเชิงหมวดหมู่หนึ่ง วิธีการทดสอบที่เหมาะสมคือการทดสอบ chi-square สำหรับความเหมาะสม

วัตถุประสงค์การเรียนรู้ VAR-8.D: คำนวณจำนวนที่คาดหวังสำหรับการทดสอบความเหมาะสมของ chi-square [ทักษะ 3.A]

  • VAR-8.D.1 จำนวนที่คาดหวังสำหรับการทดสอบความเหมาะสมของ chi-square คือ (ขนาดตัวอย่าง)(สัดส่วนศูนย์)

วัตถุประสงค์การเรียนรู้ VAR-8.E: ตรวจสอบเงื่อนไขสำหรับการทำอนุมานทางสถิติเมื่อทดสอบความเหมาะสมของการแจกแจง chi-square [ทักษะ 4.C]

  • VAR-8.E.1 เพื่อการทำอนุมานทางสถิติสำหรับการทดสอบความเหมาะสมของ chi-square เราต้องตรวจสอบสิ่งต่อไปนี้:
    • ก. ในการตรวจสอบความเป็นอิสระ:
      • i. ข้อมูลควรเก็บรวบรวมโดยใช้ตัวอย่างแบบสุ่มหรือการทดลองแบบสุ่ม
      • ii. เมื่อสุ่มโดยไม่มีการแทนที่ ตรวจสอบว่า $n \leq 10\%N$
    • b. การทดสอบความเหมาะสมของ chi-square จะแม่นยำขึ้นเมื่อมีข้อมูลมากขึ้น ดังนั้นควรใช้จำนวนที่มาก (รูปร่าง)
      • i. การตรวจสอบแบบระมัดระวังสำหรับจำนวนที่มากคือจำนวนที่คาดหวังทั้งหมดควรมากกว่า 5

Source: College Board AP Course and Exam Description · ⁨แหล่งที่มา: คำอธิบายหลักสูตรและข้อสอบ College Board AP⁩

English
The chi-square (χ²) test

A goodness-of-fit (GOF) 拟合优度 test checks whether one categorical variable follows a claimed distribution (e.g. "the die is fair"). Hypotheses:

$$H_0:\text{the distribution is as claimed}\qquad H_a:\text{at least one proportion differs}.$$
Expected count for each category $=n\times(\text{claimed proportion})$. Conditions: random sample, all expected counts $\ge 5$, and the 10% condition.

ไทย
การทดสอบ chi-square (χ²)

การทดสอบ goodness-of-fit (GOF) ตรวจสอบว่าตัวแปรเชิงประจักษ์ตัวใดตัวหนึ่ง是否符合 การแจกแจงที่ถูกอ้างถึง (เช่น "ลูกเต๋า adil") สมมติฐาน:

$$H_0:\text{the distribution is as claimed}\qquad H_a:\text{at least one proportion differs}.$$
Expected count สำหรับแต่ละหมวดหมู่ $=n\times(\text{claimed proportion})$. เงื่อนไข: ตัวอย่างสุ่ม, expected counts $\ge 5$, และเงื่อนไข 10%

การแจกแจง chi-square และพื้นที่ปฏิเสธทางขวา
การแจกแจง chi-square มีความเบี่ยงไปทางขวา ค่าสถิติที่มากจะตกในบริเวณหางขวาที่ทึบสีผ่านค่าวิกฤต – นั่นคือจุดที่คุณปฏิเสธโมเดล
Vocabulary · ⁨คำศัพท์⁩ Train · ⁨ฝึกฝน⁩
English ไทย
goodness-of-fit (GOF)/ˈɡʊdnəs ɒv fɪt/ การทดสอบความเหมาะสมของข้อมูล (GOF)
8.3

Carrying Out a Goodness-of-Fit Test · ⁨การดำเนินการทดสอบ Goodness-of-Fit⁩

Syllabus · ⁨หลักสูตร⁩
English

Enduring Understanding (VAR-8): The chi-square distribution may be used to model variation.

Learning Objective VAR-8.F: Calculate the appropriate statistic for the chi-square test for goodness of fit. [Skill 3.E]

  • VAR-8.F.1 The test statistic for the chi-square test for goodness of fit is
    • Equation: $\chi^2 = \sum \dfrac{(Observed\ count - Expected\ count)^2}{Expected\ count}$, with $degrees\ of\ freedom = number\ of\ categories - 1$.
  • VAR-8.F.2 The distribution of the test statistic assuming the null hypothesis is true (null distribution) can be either a randomization distribution or, when a probability model is assumed to be true, a theoretical distribution (chi-square).

Learning Objective VAR-8.G: Determine the $p$-value for chi-square test for goodness of fit significance test. [Skill 3.E]

  • VAR-8.G.1 The $p$-value for a chi-square test for goodness of fit for a number of degrees of freedom is found using the appropriate table or computer generated output.

Enduring Understanding (DAT-3): Significance testing allows us to make decisions about hypotheses within a particular context.

Learning Objective DAT-3.I: Interpret the $p$-value for the chi-square test for goodness of fit. [Skill 4.B]

  • DAT-3.I.1 An interpretation of the $p$-value for the chi-square test for goodness of fit is the probability, given the null hypothesis and probability model are true, of obtaining a test statistic as, or more, extreme than the observed value.

Learning Objective DAT-3.J: Justify a claim about the population based on the results of a chi-square test for goodness of fit. [Skill 4.E]

  • DAT-3.J.1 A decision to either reject or fail to reject the null hypothesis is based on comparison of the $p$-value to the significance level, $\alpha$.
  • DAT-3.J.2 The results of a chi-square test for goodness of fit can serve as the statistical reasoning to support the answer to a research question about the population that was sampled.
ไทย

ความเข้าใจที่ยั่งยืน (VAR-8): การแจกแจง chi-square สามารถใช้เพื่อจำลองความแปรปรวน

วัตถุประสงค์การเรียนรู้ VAR-8.F: คำนวณสถิติที่เหมาะสมสำหรับการทดสอบความเหมาะสมของ chi-square [ทักษะ 3.E]

  • VAR-8.F.1 สถิติการทดสอบสำหรับการทดสอบความเหมาะสมของ chi-square คือ
    • สมการ: $\chi^2 = \sum \dfrac{(Observed\ count - Expected\ count)^2}{Expected\ count}$, dengan $degrees\ of\ freedom = number\ of\ categories - 1$.
  • VAR-8.F.2 การแจกแจงของสถิติการทดสอบโดยสมมติว่าสมมติฐานศูนย์เป็นจริง (การแจกแจงศูนย์) สามารถเป็นการแจกแจงจากการสุ่ม (randomization distribution) หรือ, เมื่อสมมติว่าโมเดลความน่าจะเป็นเป็นจริง, เป็นการแจกแจงทฤษฎี (chi-square)

วัตถุประสงค์การเรียนรู้ VAR-8.G: หาค่า $p$ สำหรับการทดสอบนัยสำคัญของความเหมาะสม chi-square [ทักษะ 3.E]

  • VAR-8.G.1 ค่า $p$ สำหรับการทดสอบความเหมาะสมของ chi-square สำหรับจำนวนอิสระ tertentuหาได้จากตารางที่เหมาะสมหรือผลลัพธ์ที่สร้างโดยคอมพิวเตอร์

ความเข้าใจที่ยั่งยืน (DAT-3): การทดสอบความสำคัญช่วยให้เราตัดสินใจเกี่ยวกับสมมติฐานภายในบริบทหนึ่งๆ ได้

วัตถุประสงค์การเรียนรู้ DAT-3.I: ตีความค่า $p$ สำหรับการทดสอบความเหมาะสมของ chi-square [ทักษะ 4.B]

  • DAT-3.I.1 การตีความค่า $p$ สำหรับการทดสอบความเหมาะสมของ chi-square คือความน่าจะเป็น, ภายใต้สมมติฐานศูนย์และโมเดลความน่าจะเป็นที่เป็นจริง, ในการได้รับสถิติการทดสอบเท่ากับหรือรุนแรงกว่าค่าที่สังเกตได้

วัตถุประสงค์การเรียนรู้ DAT-3.J: อธิบายเหตุผลสนับสนุนข้ออ้างเกี่ยวกับประชากรจากผลการทดสอบความเหมาะสมของ chi-square [ทักษะ 4.E]

  • DAT-3.J.1 การตัดสินใจที่จะปฏิเสธหรือไม่ปฏิเสธสมมติฐานศูนย์ขึ้นอยู่กับผลของการเปรียบเทียบค่า $p$ กับระดับนัยสำคัญ $\alpha$
  • DAT-3.J.2 ผลลัพธ์ของการทดสอบความเหมาะสมของ chi-square สามารถใช้เป็นเหตุผลทางสถิติเพื่อสนับสนุนคำตอบสำหรับคำถามการวิจัยเกี่ยวกับประชากรที่ถูกสุ่มตัวอย่าง

Source: College Board AP Course and Exam Description · ⁨แหล่งที่มา: คำอธิบายหลักสูตรและข้อสอบ College Board AP⁩

English

Compute $\chi^2=\sum\dfrac{(O-E)^2}{E}$ with $df=(\text{number of categories})-1$. Find the $p$-value from the chi-square distribution (upper tail), compare to $\alpha$, and conclude in context. A large component of the sum points to the category that deviates most.

Worked example. A die rolled $60$ times gives counts $8,10,12,9,11,10$. If it is fair, each expected count is $60/6=10$, so

$$\chi^2=\frac{(8-10)^2}{10}+\frac{(10-10)^2}{10}+\frac{(12-10)^2}{10}+\frac{(9-10)^2}{10}+\frac{(11-10)^2}{10}+\frac{(10-10)^2}{10}=0.4+0+0.4+0.1+0.1+0=1.0,$$
with $df=6-1=5$. Write out every category, including the two that match their expected count exactly and so add $0$ – the sum runs over all six categories, and $df$ counts categories, not just the ones that differ. This $\chi^2$ is small (a large $p$-value), so we fail to reject $H_0$ – no evidence the die is unfair.

ไทย

คำนวณ $\chi^2=\sum\dfrac{(O-E)^2}{E}$ ด้วย $df=(\text{number of categories})-1$. หาค่า $p$-value จาก chi-square distribution (หางบน), เปรียบเทียบกับ $\alpha$, และสรุปผลในบริบท ส่วนประกอบที่มีค่าสูงของผลรวมชี้ไปที่หมวดหมู่ที่เบี่ยงเบนมากที่สุด

Chi-square เปรียบเทียบจำนวนนับที่สังเกตได้กับจำนวนนับที่คาดหวังภายใต้สมมติฐานศูนย์
Chi-square เปรียบเทียบจำนวนนับที่สังเกตได้กับจำนวนนับที่คาดหวังภายใต้สมมติฐานศูนย์

ตัวอย่างคำนวณ. ลูกเต๋าลูกหนึ่งถูกโยน $60$ ครั้ง ได้จำนวนนับ $8,10,12,9,11,10$. ถ้าลูกเต๋า adil จำนวนนับที่คาดหวังแต่ละประเภทคือ $60/6=10$, ดังนั้น

$$\chi^2=\frac{(8-10)^2}{10}+\frac{(10-10)^2}{10}+\frac{(12-10)^2}{10}+\frac{(9-10)^2}{10}+\frac{(11-10)^2}{10}+\frac{(10-10)^2}{10}=0.4+0+0.4+0.1+0.1+0=1.0,$$
ด้วย $df=6-1=5$. เขียนออกมา ทุก หมวดหมู่ รวมถึงสองหมวดหมู่ที่ตรงกับจำนวนนับที่คาดหวังพอดีและดังนั้นจึงเพิ่ม $0$ – ผลรวมครอบคลุมทั้งหกหมวดหมู่, และ $df$ นับจำนวนหมวดหมู่ ไม่ใช่แค่那些 differs. ค่า $\chi^2$ นี้เล็ก (ค่า $p$ ใหญ่), ดังนั้นเรา ไม่ปฏิเสธ $H_0$ – ไม่มีหลักฐานว่าลูกเต๋าไม่ adil.

Explore · ⁨สำรวจ⁩

Explore the chi-square distribution and its p-value · ⁨สำรวจการแจกแจง chi-square และ p-value ของมัน⁩

The p-value is the area in the right tail beyond your test statistic, so a larger $\chi^2$ means a smaller p-value. Drag $\chi^2$ to watch that area shrink, and drag df to see the whole family change shape — strongly right-skewed at small df, more symmetric as df grows. · ⁨p-value คือพื้นที่ใน หางขวา ที่เกินค่าสถิติทดสอบของคุณ ดังนั้น ค่า $\chi^2$ ที่ มากขึ้น จะทำให้ p-value น้อยลง ลาก $\chi^2$ เพื่อดูพื้นที่นั้นหดตัวลง และลาก df เพื่อดูการเปลี่ยนแปลงรูปร่างของทั้งครอบครัว — บิดเบี้ยวไปทางขวาอย่างชัดเจนเมื่อ df มีค่าน้อย และมีความสมมาตรมากขึ้นเมื่อ df เพิ่มขึ้น⁩

8.4

Expected Counts in Two-Way Tables · ⁨จำนวนนับที่คาดหวังในตารางสองมิติ⁩

Syllabus · ⁨หลักสูตร⁩
English

Enduring Understanding (VAR-8): The chi-square distribution may be used to model variation.

Learning Objective VAR-8.H: Calculate expected counts for two-way tables of categorical data. [Skill 3.A]

  • VAR-8.H.1 The expected count in a particular cell of a two-way table of categorical data can be calculated using the formula:
    • Equation: $expected\ count = \dfrac{(row\ total)(column\ total)}{table\ total}$.
ไทย

ความเข้าใจที่ยั่งยืน (VAR-8): การแจกแจง chi-square สามารถใช้เพื่อจำลองความแปรปรวน

วัตถุประสงค์การเรียนรู้ VAR-8.H: คำนวณจำนวนที่คาดหวังสำหรับตารางสองมิติของข้อมูลเชิงหมวดหมู่ [ทักษะ 3.A]

  • VAR-8.H.1 จำนวนที่คาดหวังในเซลล์เฉพาะของตารางสองมิติของข้อมูลเชิงหมวดหมู่สามารถคำนวณได้ด้วยสูตร:
    • สมการ: $expected\ count = \dfrac{(row\ total)(column\ total)}{table\ total}$.

Source: College Board AP Course and Exam Description · ⁨แหล่งที่มา: คำอธิบายหลักสูตรและข้อสอบ College Board AP⁩

English

For a two-way table, the expected count in a cell (under "no association") is

$$E=\frac{(\text{row total})\times(\text{column total})}{\text{grand total}}.$$
This is the count you would see if the row and column variables were unrelated.

Worked example. In a two-way table a cell's row total is $40$, its column total is $50$, and the grand total is $200$. Its expected count is $E=\dfrac{40\times50}{200}=10$. Repeating for every cell gives the expected table to compare against the observed one.

ไทย

สำหรับตารางสองมิติ, expected count ในเซลล์ (ภายใต้ "ไม่มีการสัมพันธ์") คือ

$$E=\frac{(\text{row total})\times(\text{column total})}{\text{grand total}}.$$
นี่คือจำนวนนับที่คุณจะเห็นหากตัวแปรแถวและคอลัมน์ไม่เกี่ยวข้องกัน

ตัวอย่างคำนวณ. ในตารางสองมิติ ค่าผลรวมแถวของเซลล์หนึ่งคือ $40$, ค่าผลรวมคอลัมน์คือ $50$, และผลรวมทั้งหมดคือ $200$. ค่า expected count ของมันคือ $E=\dfrac{40\times50}{200}=10$. ทำซ้ำสำหรับทุกเซลล์จะได้ตาราง expected เพื่อเปรียบเทียบกับตารางที่สังเกตได้

โปรแกรมสเปรดชีตจัดระเบียบจำนวนนับเชิงประจักษ์ก่อนการทดสอบ chi-square
โปรแกรมสเปรดชีตจัดระเบียบจำนวนนับเชิงประจักษ์ก่อนการทดสอบ chi-square
8.5

Homogeneity or Independence? · ⁨Homogeneity หรือ Independence?⁩

Syllabus · ⁨หลักสูตร⁩
English

Enduring Understanding (VAR-8): The chi-square distribution may be used to model variation.

Learning Objective VAR-8.I: Identify the null and alternative hypotheses for a chi-square test for homogeneity or independence. [Skill 1.F]

  • VAR-8.I.1 The appropriate hypotheses for a chi-square test for homogeneity are:

    $H_0$: There is no difference in distributions of a categorical variable across populations or treatments.

    $H_a$: There is a difference in distributions of a categorical variable across populations or treatments.

  • VAR-8.I.2 The appropriate hypotheses for a chi-square test for independence are:

    $H_0$: There is no association between two categorical variables in a given population or the two categorical variables are independent.

    $H_a$: Two categorical variables in a population are associated or dependent.

Learning Objective VAR-8.J: Identify an appropriate testing method for comparing distributions in two-way tables of categorical data. [Skill 1.E]

  • VAR-8.J.1 When comparing distributions to determine whether proportions in each category for categorical data collected from different populations are the same, the appropriate test is the chi-square test for homogeneity.
  • VAR-8.J.2 To determine whether row and column variables in a two-way table of categorical data might be associated in the population from which the data were sampled, the appropriate test is the chi-square test for independence.

Learning Objective VAR-8.K: Verify the conditions for making statistical inferences when testing a chi-square distribution for independence or homogeneity. [Skill 4.C]

  • VAR-8.K.1 In order to make statistical inferences for a chi-square test for two-way tables (homogeneity or independence), we must verify the following:
    • a. To check for independence:
      • i. For a test for independence: Data should be collected using a simple random sample.
      • ii. For a test for homogeneity: Data should be collected using a stratified random sample or randomized experiment.
      • iii. When sampling without replacement, check that $n \leq 10\%N$.
    • b. The chi-square tests for independence and homogeneity become more accurate with more observations, so large counts should be used (shape).
      • i. A conservative check for large counts is that all expected counts should be greater than 5.
ไทย

ความเข้าใจที่ยั่งยืน (VAR-8): การแจกแจง chi-square สามารถใช้เพื่อจำลองความแปรปรวน

วัตถุประสงค์การเรียนรู้ VAR-8.I: ระบุสมมติฐานศูนย์และสมมติฐานทางเลือกสำหรับการทดสอบ chi-square เพื่อความสม่ำเสมอหรือความเป็นอิสระ [ทักษะ 1.F]

  • VAR-8.I.1 สมมติฐานที่เหมาะสมสำหรับการทดสอบ chi-square เพื่อความสม่ำเสมอคือ:

    $H_0$: ไม่มีความแตกต่างในการแจกแจงของตัวแปรเชิงหมวดหมู่ระหว่างประชากรหรือการ trattamento

    $H_a$: มีความแตกต่างในการแจกแจงของตัวแปรเชิงหมวดหมู่ระหว่างประชากรหรือการ treatment

  • VAR-8.I.2 สมมติฐานที่เหมาะสมสำหรับการทดสอบ chi-square เพื่อความเป็นอิสระคือ:

    $H_0$: ไม่มีความสัมพันธ์ระหว่างตัวแปรเชิงหมวดหมู่สองตัวในประชากรที่กำหนด หรือตัวแปรเชิงหมวดหมู่ทั้งสองเป็นอิสระต่อกัน

    $H_a$: ตัวแปรเชิงหมวดหมู่สองตัวในประชากรมีความสัมพันธ์กันหรือขึ้นอยู่กับกัน

วัตถุประสงค์การเรียนรู้ VAR-8.J: ระบุวิธีการทดสอบที่เหมาะสมสำหรับการเปรียบเทียบการแจกแจงในตารางข้อมูลเชิงหมวดหมู่สองมิติ [ทักษะ 1.E]

  • VAR-8.J.1 เมื่อเปรียบเทียบการแจกแจงเพื่อบ่งชี้ว่าสัดส่วนในแต่ละหมวดหมู่ของข้อมูลเชิงหมวดหมู่ที่เก็บจากประชากรต่างกันมีค่าเท่ากัน การทดสอบที่เหมาะสมคือการทดสอบ chi-square เพื่อความสม่ำเสมอ
  • VAR-8.J.2 เพื่อบ่งชี้ว่าตัวแปรแถวและคอลัมน์ในตารางข้อมูลเชิงหมวดหมู่สองมิติอาจมีความสัมพันธ์กันในประชากรที่สุ่มตัวอย่างมา การทดสอบที่เหมาะสมคือการทดสอบ chi-square เพื่อความเป็นอิสระ

วัตถุประสงค์การเรียนรู้ VAR-8.K: ตรวจสอบเงื่อนไขสำหรับการทำสถิติอนุมานเมื่อทดสอบการแจกแจง chi-square เพื่อความเป็นอิสระหรือความสม่ำเสมอ [ทักษะ 4.C]

  • VAR-8.K.1 เพื่อให้สามารถทำสถิติอนุมานสำหรับการทดสอบ chi-square สำหรับตารางสองมิติ (ความสม่ำเสมอหรือความเป็นอิสระ) เราต้องตรวจสอบสิ่งต่อไปนี้:
    • ก. ในการตรวจสอบความเป็นอิสระ:
      • i. สำหรับการทดสอบความเป็นอิสระ: ข้อมูลควรเก็บด้วยวิธีสุ่มตัวอย่างแบบง่าย
      • ii. สำหรับการทดสอบความสม่ำเสมอ: ข้อมูลควรเก็บด้วยวิธีสุ่มตัวอย่างแบบแบ่งชั้นหรือการทดลองแบบสุ่ม
      • iii. เมื่อสุ่มโดยไม่แทนที่ ให้ตรวจสอบว่า $n \leq 10\%N$
    • b. การทดสอบ chi-square เพื่อความเป็นอิสระและความสม่ำเสมอจะแม่นยำขึ้นเมื่อมีจำนวนการสังเกตมากขึ้น ดังนั้นควรใช้ค่านับที่สูง (รูปร่าง)
      • i. การตรวจสอบแบบระมัดระวังสำหรับจำนวนที่มากคือจำนวนที่คาดหวังทั้งหมดควรมากกว่า 5

Source: College Board AP Course and Exam Description · ⁨แหล่งที่มา: คำอธิบายหลักสูตรและข้อสอบ College Board AP⁩

English

Two tests use the same $\chi^2$ math but answer different questions:

  • Test for homogeneity 同质性: are the distributions of one categorical variable the same across several populations or groups (separate samples/treatments)?
  • Test for independence 独立性: are two categorical variables associated within a single population (one sample, two variables measured)?

The design (several samples vs one sample) decides which name and hypotheses to use.

ไทย

การทดสอบสองชนิดใช้คณิตศาสตร์ $\chi^2$ เดียวกันแต่ตอบคำถามต่างกัน:

  • Test for homogeneity: การแจกแจงของตัวแปรเชิงประจักษ์ตัวเดียวกัน เหมือนกัน Across หลายประชากรหรือกลุ่ม (ตัวอย่างแยก/การรักษาแยก)?
  • Test for independence: ตัวแปรเชิงประจักษ์สองตัว 有关系 Within ประชากรเดียว (ตัวอย่างหนึ่ง, วัดสองตัวแปร)?

การออกแบบ (หลายตัวอย่าง vs หนึ่งตัวอย่าง) กำหนดชื่อและสมมติฐานที่ใช้

Vocabulary · ⁨คำศัพท์⁩ Train · ⁨ฝึกฝน⁩
English ไทย
Test for homogeneity/test fɔː ˈhɒməʊdʒneɪti/ การทดสอบความเป็นเอกภาพ
Test for independence/test fɔː ˌɪndɪˈpendəns/ การทดสอบความเป็นอิสระ
8.6

Carrying Out a Test for Homogeneity or Independence · ⁨การดำเนินการทดสอบ Homogeneity หรือ Independence⁩

Syllabus · ⁨หลักสูตร⁩
English

Enduring Understanding (VAR-8): The chi-square distribution may be used to model variation.

Learning Objective VAR-8.L: Calculate the appropriate statistic for a chi-square test for homogeneity or independence. [Skill 3.E]

  • VAR-8.L.1 The appropriate test statistic for a chi-square test for homogeneity or independence is the chi-square statistic:
    • Equation: $\chi^2 = \sum \dfrac{(Observed\ count - Expected\ count)^2}{Expected\ count}$, with degrees of freedom equal to: $(number\ of\ rows - 1)(number\ of\ columns - 1)$.

Learning Objective VAR-8.M: Determine the $p$-value for a chi-square significance test for independence or homogeneity. [Skill 3.E]

  • VAR-8.M.1 The $p$-value for a chi-square test for independence or homogeneity for a number of degrees of freedom is found using the appropriate table or technology.
  • VAR-8.M.2 For a test of independence or homogeneity for a two-way table, the $p$-value is the proportion of values in a chi-square distribution with appropriate degrees of freedom that are equal to or larger than the test statistic.

Enduring Understanding (DAT-3): Significance testing allows us to make decisions about hypotheses within a particular context.

Learning Objective DAT-3.K: Interpret the $p$-value for the chi-square test for homogeneity or independence. [Skill 4.B]

  • DAT-3.K.1 An interpretation of the $p$-value for the chi-square test for homogeneity or independence is the probability, given the null hypothesis and probability model are true, of obtaining a test statistic as, or more, extreme than the observed value.

Learning Objective DAT-3.L: Justify a claim about the population based on the results of a chi-square test for homogeneity or independence. [Skill 4.E]

  • DAT-3.L.1 A decision to either reject or fail to reject the null hypothesis for a chi-square test for homogeneity or independence is based on comparison of the $p$-value to the significance level, $\alpha$.
  • DAT-3.L.2 The results of a chi-square test for homogeneity or independence can serve as the statistical reasoning to support the answer to a research question about the population that was sampled (independence) or the populations that were sampled (homogeneity).
ไทย

ความเข้าใจที่ยั่งยืน (VAR-8): การแจกแจง chi-square สามารถใช้เพื่อจำลองความแปรปรวน

วัตถุประสงค์การเรียนรู้ VAR-8.L: คำนวณสถิติที่เหมาะสมสำหรับการทดสอบ chi-square เพื่อความสม่ำเสมอหรือความเป็นอิสระ [ทักษะ 3.E]

  • VAR-8.L.1 สถิติทดสอบที่เหมาะสมสำหรับการทดสอบ chi-square เพื่อความสม่ำเสมอหรือความเป็นอิสระคือสถิติ chi-square:
    • สมการ: $\chi^2 = \sum \dfrac{(Observed\ count - Expected\ count)^2}{Expected\ count}$, โดยมีองศาอิสระเท่ากับ: $(number\ of\ rows - 1)(number\ of\ columns - 1)$

วัตถุประสงค์การเรียนรู้ VAR-8.M: กำหนดค่า $p$-value สำหรับการทดสอบนัยสำคัญ chi-square เพื่อความเป็นอิสระหรือความสม่ำเสมอ [ทักษะ 3.E]

  • VAR-8.M.1 ค่า $p$-value สำหรับการทดสอบ chi-square เพื่อความเป็นอิสระหรือความสม่ำเสมอสำหรับจำนวนองศาอิสระหนึ่งๆ สามารถหาได้จากตารางหรือเทคโนโลยีที่เหมาะสม
  • VAR-8.M.2 สำหรับการทดสอบความเป็นอิสระหรือความสม่ำเสมอสำหรับตารางสองมิติ ค่า $p$-value คือสัดส่วนของค่าในการแจกแจง chi-square ที่มีองศาอิสระเหมาะสมที่มีค่าเท่ากับหรือมากกว่าสถิติทดสอบ

ความเข้าใจที่ยั่งยืน (DAT-3): การทดสอบความสำคัญช่วยให้เราตัดสินใจเกี่ยวกับสมมติฐานภายในบริบทหนึ่งๆ ได้

**วัตถุประสงค์การเรียนรู้ DAT-3.K:**诠释ค่า $p$-value สำหรับการทดสอบ chi-square เพื่อความสม่ำเสมอหรือความเป็นอิสระ [ทักษะ 4.B]

  • DAT-3.K.1 การตีความค่า $p$-value สำหรับการทดสอบ chi-square เพื่อความสม่ำเสมอหรือความเป็นอิสระคือ ความน่าจะเป็น给定สมมติฐานศูนย์และโมเดลความน่าจะเป็นเป็นจริง ที่จะได้สถิติทดสอบมีค่าเท่ากับหรือรุนแรงกว่าค่าที่สังเกตได้

วัตถุประสงค์การเรียนรู้ DAT-3.L: อธิบายเหตุผลเพื่อสนับสนุนข้ออ้างเกี่ยวกับประชากรโดยอาศัยผลการทดสอบ chi-square เพื่อความสม่ำเสมอหรือความเป็นอิสระ [ทักษะ 4.E]

  • DAT-3.L.1 การตัดสินใจที่จะปฏิเสธหรือไม่ปฏิเสธสมมติฐานศูนย์สำหรับการทดสอบ chi-square เพื่อความสม่ำเสมอหรือความเป็นอิสระนั้นขึ้นอยู่กับผลเปรียบเทียบระหว่างค่า $p$-value กับระดับนัยสำคัญ $\alpha$
  • DAT-3.L.2 ผลลัพธ์ของการทดสอบ chi-square เพื่อความสม่ำเสมอหรือความเป็นอิสระสามารถใช้เป็นเหตุผลทางสถิติเพื่อสนับสนุนคำตอบของคำถามการวิจัยเกี่ยวกับประชากรที่ถูกสุ่มตัวอย่าง (ความเป็นอิสระ) หรือประชากรที่ถูกสุ่มตัวอย่าง (ความสม่ำเสมอ)

Source: College Board AP Course and Exam Description · ⁨แหล่งที่มา: คำอธิบายหลักสูตรและข้อสอบ College Board AP⁩

English

Compute expected counts, then $\chi^2=\sum\dfrac{(O-E)^2}{E}$ over all cells, with

$$df=(\text{rows}-1)(\text{columns}-1).$$
Conditions: random data, all expected counts $\ge 5$, 10% condition. Find the $p$-value, compare to $\alpha$, and conclude in context – evidence of a difference between groups (homogeneity) or of an association (independence).

ไทย

คำนวณ expected counts, แล้ว $\chi^2=\sum\dfrac{(O-E)^2}{E}$ ครอบคลุมทุกเซลล์, ด้วย

$$df=(\text{rows}-1)(\text{columns}-1).$$
เงื่อนไข: ข้อมูลสุ่ม, จำนวนที่คาดหวังทั้งหมด $\ge 5$, เงื่อนไข 10%. หาค่า $p$-value, เปรียบเทียบกับ $\alpha$, และสรุปผลในบริบท – มีพยานถึงความแตกต่างระหว่างกลุ่ม (homogeneity) หรือความสัมพันธ์ (independence)

8.7

Choosing the Right Categorical Procedure · ⁨การเลือกวิธีการเชิงประจักษ์ที่เหมาะสม⁩

Syllabus · ⁨หลักสูตร⁩
English

This topic is intended to focus on the skill of selecting an appropriate inference procedure now that students have a range of options. Students should be given opportunities to practice when and how to apply all learning objectives relating to inference for categorical data.

ไทย

หัวข้อนี้มุ่งเน้นทักษะในการเลือกขั้นตอนการอนุมานที่เหมาะสม เนื่องจากนักเรียนมีตัวเลือกหลากหลาย นักเรียนควรมีโอกาสฝึกฝนเวลาและวิธีการใช้วัตถุประสงค์การเรียนรู้ทั้งหมดที่เกี่ยวข้องกับการอนุมานสำหรับข้อมูลเชิงหมวดหมู่

Source: College Board AP Course and Exam Description · ⁨แหล่งที่มา: คำอธิบายหลักสูตรและข้อสอบ College Board AP⁩

English

Decide by the setup: one categorical variable against a claimed distribution $\Rightarrow$ goodness-of-fit; one sample cross-classified by two variables $\Rightarrow$ independence; several samples/groups compared $\Rightarrow$ homogeneity. Comparing just two proportions can use either a two-proportion $z$-test or a chi-square test, but only for a two-tailed alternative, where they agree exactly ($\chi^2=z^2$). A chi-square test is always two-tailed, so it cannot give a directional conclusion: if $H_a$ is one-tailed (say $p_1>p_2$), use the $z$-test.

ไทย

ตัดสินใจจากชุดการทดลอง: ตัวแปรเชิงหมวดหมู่หนึ่งเทียบกับกระจายตัวที่อ้างถึง $\Rightarrow$ ความสอดคล้อง; ตัวอย่างเดียวที่จำแนกโดยตัวแปรสองตัว $\Rightarrow$ ความเป็นอิสระ; ตัวอย่างหลายกลุ่ม/กลุ่มเปรียบเทียบ $\Rightarrow$ ความสม่ำเสมอ การเปรียบเทียบสัดส่วนเพียง สอง ค่าสามารถใช้การทดสอบสองสัดส่วน $z$-test หรือการทดสอบ chi-square ได้ แต่ใช้ได้เฉพาะเมื่อเป็นทางเลือกแบบ สองด้าน เท่านั้น ซึ่งทั้งสองวิธีจะตรงกันพอดี ($\chi^2=z^2$) การทดสอบ chi-square เป็นสองด้านเสมอ ดังนั้นจึงไม่สามารถให้ข้อสรุปแบบมีทิศทางได้: หาก $H_a$ เป็นแบบด้านเดียว (เช่น $p_1>p_2$) ให้ใช้การทดสอบ $z$-test

Explore · ⁨สำรวจ⁩

Which chi-square test is this? · ⁨นี่คือการทดสอบ chi-square哪一种?⁩

All three tests use the same $\chi^2$ arithmetic, so the marks are won by naming the right one. The design decides — how many samples were taken, and how many variables were measured on each unit. · ⁨การทดสอบทั้งสามใช้ $\chi^2$ Arithmetic เดียวกัน ดังนั้นคะแนนจะอยู่ที่การระบุชื่อให้ถูกต้อง การออกแบบ เป็นตัวกำหนด — มีการเก็บตัวอย่างกี่กลุ่ม และวัดตัวแปรกี่ตัวต่อหน่วย⁩

8.7

Exam tips · ⁨ข้อแนะนำสำหรับการสอบ⁩

English
  • Use $\chi^2=\sum\tfrac{(O-E)^2}{E}$ for categorical data; always divide by the expected count.
  • Pick the right test: goodness-of-fit (one variable), independence, or homogeneity (two-way table).
  • Compute expected counts as $\tfrac{\text{row total}\times\text{column total}}{\text{grand total}}$ and check each is $\ge5$.
  • A large $\chi^2$ (small p-value) means observed counts differ from expected by more than chance.
  • State degrees of freedom correctly (categories $-1$, or $(r-1)(c-1)$).
ไทย
  • ใช้ $\chi^2=\sum\tfrac{(O-E)^2}{E}$ สำหรับข้อมูล เชิงหมวดหมู่; ต้องหารด้วยจำนวนที่คาดหวังเสมอ
  • เลือกการทดสอบที่เหมาะสม: ความสอดคล้อง (ตัวแปรเดียว), ความเป็นอิสระ, หรือความสม่ำเสมอ (ตารางสองมิติ)
  • คำนวณจำนวนที่คาดหวังตาม $\tfrac{\text{row total}\times\text{column total}}{\text{grand total}}$ และตรวจสอบว่าแต่ละค่าเป็น $\ge5$
  • ค่า $\chi^2$ ที่มาก (p-value น้อย) แสดงว่าจำนวนที่สังเกตได้แตกต่างจากจำนวนที่คาดหวังมากกว่าที่จะเกิดจากความบังเอิญ
  • ระบุระดับอิสรภาพให้ถูกต้อง (หมวดหมู่ $-1$, หรือ $(r-1)(c-1)$)

Interactive lessons on this topic · ⁨บทเรียนเชิงโต้ตอบสำหรับหัวข้อนี้⁩

Work through it step by step, with instant-check exercises. · ⁨ทำทีละขั้นตอน พร้อมแบบฝึกหัดตรวจสอบผลทันที⁩

Past Papers · ⁨ข้อสอบย้อนหลัง⁩

More topics in AP Statistics · ⁨หัวข้อเพิ่มเติมใน AP Statistics⁩

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP