Skip Day? U nit 5: I nference for categorical variables The table - - PowerPoint PPT Presentation

skip day u nit 5 i nference for categorical variables
SMART_READER_LITE
LIVE PREVIEW

Skip Day? U nit 5: I nference for categorical variables The table - - PowerPoint PPT Presentation

Goodness of Fit Test Example Skip Day? U nit 5: I nference for categorical variables The table below shows the number of pupils absent on particular days L ecture 3: C hi - square T est of I ndependence in the week. Day of the Week M T W Th


slide-1
SLIDE 1

Unit 5: Inference for categorical variables Lecture 3: Chi-square Test of Independence Statistics 101

Nicole Dalzell June 10, 2015

Goodness of Fit Test Example

Skip Day?

The table below shows the number of pupils absent on particular days in the week. Day of the Week M T W Th F Number of Absences 125 88 85 94 108 A principal believes that students are equally likely to be absent on any day of the week. Based on this data, does it seem like students are equally likely to be absent on any given day of the week?

Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 2 / 10 Goodness of Fit Test Example

Skip Day?

What are the hypotheses we are testing here? Day of the Week M T W Th F Number of Absences 125 88 85 94 108 Under the null hypothesis, what is the probability of being absent on Monday? Tuesday?

Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 3 / 10 Chi-square test of independence Obesity and marital status

Obesity and marital status

A study reported in the medical journal Obesity in 2009 analyzed data from the National Longitudinal Study of Adolescent Health. Obesity was defined as having a BMI of 30 or more. The research subjects were followed from adolescence to adulthood, and all the people in the sample were categorized in terms of whether they were obese and whether they were dating, cohabiting, or married. Does there appear to be a relationship between weight and relationship status? Dating Cohabiting Married Obese 81 103 147 Not Obese 359 326 277

Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 4 / 10

slide-2
SLIDE 2

Chi-square test of independence Obesity and marital status

Participation question If relationship status is the explanatory and weight status is the re- sponse variable, which of the following is the correct representation of the relationship? (a)

dating cohabiting married

  • bese

not obese

(b)

  • bese

not obese dating cohabiting married

Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 5 / 10 Chi-square test of independence Obesity and marital status

Chi-square test of independence

The hypotheses are:

H0: Weight and relationship status are independent. Obesity rates do not vary by relationship status. HA: Weight and relationship status are dependent. Obesity rates do vary by relationship status.

The test statistic is calculated as

χ2

df = k

  • i=1

(O − E)2

E where df = (R − 1) × (C − 1), where k is the number of cells, R is the number of rows, and C is the number of columns.

Note: We calculate df differently for one-way and two-way tables.

The p-value is the area under the χ2

df curve, above the calculated

test statistic.

Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 6 / 10 Chi-square test of independence Expected counts in two-way tables

Dating Cohabiting Married Total Obese 81 103 147 331 Not Obese 359 326 277 962 Total 440 429 424 1293

What proportion of the individuals in this sample are obese? If in fact weight and relationship status are independent (i.e. if in fact H0 is true) how many of the dating people would we expect to be obese? How many of the cohabiting and married? 113 + 110 + 108 = 331

Dating Cohabiting Married Obese 81 103 147 Not Obese 359 326 277

Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 7 / 10 Chi-square test of independence Expected counts in two-way tables

Expected counts in two-way tables

Expected counts in two-way tables Expected Count = (row total) × (column total) table total

Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 8 / 10

slide-3
SLIDE 3

Chi-square test of independence Expected counts in two-way tables

Application exercise: Chi-square test of independence Test the hypothesis that relationship status and obesity are associated using a signify acne level of 0.05. Can we conclude from these data that living with someone jus making some people obese and that mar- rying jus making people even more obese? Can we conclude that

  • besity affects relationship status?

Dating Cohabiting Married Obese 81 103 147 Not Obese 359 326 277

Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 9 / 10 Chi-square test of independence Expected counts in two-way tables inference(weight,mar_stat,est="proportion", type = "ht", method = "theoretical", alternative = "greater") Response variable: categorical, Explanatory variable: categorical Chi-square test of independence Summary statistics: x y dating cohabiting married Sum

  • bese

81 103 147 331 not obese 359 326 277 962 Sum 440 429 424 1293 H_0: Response and explanatory variable are independent. H_A: Response and explanatory variable are dependent. Check conditions: expected counts x y dating cohabiting married

  • bese

112.64 109.82 108.54 not obese 327.36 319.18 315.46 Pearson’s Chi-squared test data: y_table X-squared = 30.8286, df = 2, p-value = 2.021e-07 Statistics 101 (Nicole Dalzell) U5 - L3: Chi-square tests June 10, 2015 10 / 10