Categorical Data 2 -test Pray for a quick and painless death.

15
Categorical Data 2 -test Pray for a quick and painless death. Pray for a quick and painless death.

Transcript of Categorical Data 2 -test Pray for a quick and painless death.

Page 1: Categorical Data  2 -test Pray for a quick and painless death.

Categorical Data

2-test

Pray for a quick and painless death.Pray for a quick and painless death.

Page 2: Categorical Data  2 -test Pray for a quick and painless death.

Para-what?

Statistical test are divided into two types1. Parametric: a test that compares sample data to

a larger population (e.g., z, t, F). Parametric tests have stringent assumptions (e.g., sample is normally, and independently distributed).

2. Non-parametric: do not depend on a specific distribution. For that reason, they are called distribution-free, and are not

Page 3: Categorical Data  2 -test Pray for a quick and painless death.

Are you nuts?

Non-parametric tests do not depend on a distribution, and are easier to perform. So why not use them exclusively?

1. Parametric tests are generally robust to violations of their assumptions.

2. Parametric tests are more powerful and versatile (e.g., you can’t test for multiple variable interactions.

Note: As a general rule, researchers will use parametric tests wheneverpossible, due to their higher power. However, when there have beengross violations of the assumptions, researchers will use non-parametrictests.

Page 4: Categorical Data  2 -test Pray for a quick and painless death.

2 Test for Single Variable Experiments

Often, experiments are conducted with nominal data (e.g., product preference tests).

The (Chi-square) test is the most frequently used with nominal data.

Page 5: Categorical Data  2 -test Pray for a quick and painless death.

2 Test for Single Variable Experiments

Bud’s Suds makes microbrewed beer for blue-collar drinkers. Bud’s Suds have 3 new products, but recent cut-backs mean there is only enough funding to introduce one product. So they decide to conduct an experiment. You randomly sample 150 beer drinkers, let them taste the three different products, and pick the ones they like the best.

45 40 65

Trailer Tea NASCAR Nectar Mountain Mead Total

150

Frequency ofdrinkers picking a particular brand

H0: No difference in preference

Page 6: Categorical Data  2 -test Pray for a quick and painless death.

Computing2 obtained

1. Determine the frequency you would expect (expected frequencies) in each cell if sampling is random from the null hypothesis population.

Fe = expected frequency under the null hypothesis

Fo = observed frequency in the sample

fo 45 40 65

fe 50 50 50

Trailer Tea NASCAR Nectar Mountain Mead Total

150

Page 7: Categorical Data  2 -test Pray for a quick and painless death.

Computing2 obtained

fo 45 40 65

fe 50 50 50

Trailer Tea NASCAR Nectar Mountain Mead Total

150

fffe

2

eo2

obt

50

5065

50

5040

50

5045 222

50

225

50

100

50

25

50

15

50

10

50

5 222

00.750.400.250.02

obt

Page 8: Categorical Data  2 -test Pray for a quick and painless death.

Computing2 obtained

H0

2

crit

2

obtreject then If

2131kdf 05.0

00.72

obt

991.52

crit

Conclusion: Reject the null hypothesis

Page 9: Categorical Data  2 -test Pray for a quick and painless death.

2 Test for Two Variable (Two-way) Experiments

Suppose the senate is trying to pass a bill to legalize medical marijuana. You are volunteering for your local senator, who asksyou to take a poll. You pick a random sample of 400 voters (200 Democrats and 200 Republicans) in your district and ask them about legalization of medical marijuana. Here are the results

Republican 68 22 110 200

Democrat 92 18 90 200

Column Margin

160 40 200 400

For Against Row MarginsUndecided

Page 10: Categorical Data  2 -test Pray for a quick and painless death.

Computing Expected Values

80200400

160sRepublican total

subjects total

billfor Proportion

f

e

20200400

40sRepublican total

subjects total

undecided Proportion

f

e

Republicans FOR the bill

Republicans Undecided

100200400

200sRepublican total

subjects total

Against Proportion

f

e

Republicans Against

Page 11: Categorical Data  2 -test Pray for a quick and painless death.

Computing Expected Values

80200400

160Democrats total

subjects total

billfor Proportion

f

e

20200400

40Democrats total

subjects total

undecided Proportion

f

e

Democrats FOR the bill

Democrats Undecided

100200400

200Democrats total

subjects total

Against Proportion

f

e

Democrats Against

Page 12: Categorical Data  2 -test Pray for a quick and painless death.

2 Test for Two Variable (Two-way) Experiments

Republican 68(80)

22

(20)

110(100)

200

Democrat 92 (80)

18(20)

90(100)

200

Column Margin

160 40 200 400

For Against Row MarginsUndecided

df = (r-1)(c-1) = (2-1)(3-1) = (1)(2) = 2

Page 13: Categorical Data  2 -test Pray for a quick and painless death.

Computing Values

80.180

)8068()( 22

fe

eo ff

Republicans FOR the bill

Republicans Undecided

Republicans Against

20.020

)2022()( 22

fe

eo ff

00.1

100

)100110( 22

e

eo

f

ff

Page 14: Categorical Data  2 -test Pray for a quick and painless death.

Computing Values

80.1

80

)8092( 22

e

eo

f

ff

Democrats FOR the bill

Democrats Undecided

Democrats Against

20.0

20

)2018( 22

e

eo

f

ff

00.1

100

)10090( 22

e

eo

f

ff

Page 15: Categorical Data  2 -test Pray for a quick and painless death.

Computing Values

00.6

22

e

eo

f

ff

991.52

crit

Reject the Null Hypothesis. Political affiliation and attitudetoward the bill are related.