tute12_4x1

Upload: cecilia-veronica-rana

Post on 06-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Tute12_4x1

    1/13

  • 8/3/2019 Tute12_4x1

    2/13

    55 66

    Worksheet 2: chi sq test of Independence

    Research question: Do males and females differ in theiropinion on Governments spending on health, educationor transport?

    Ho: There is no association between Sex and OpinionFirst form the column and row totals.Then check if sum of column totals, and sum of row totalsequals grand total before proceeding.

    Opinion Total

    Sex Health Education Transport

    Males 6 7 5 18

    Females 3 6 3 12

    Total 9 13 8 30

    77

    2 Test of Independence

    Opinion Total

    Sex Health Education Transport

    Males 6

    (5.4)

    7

    (7.8)

    5

    (4.8)

    18

    Females 3

    (3.6)

    6

    (5.2)

    3

    (3.2)

    12

    Total 9 13 8 30

    30

    188

    30

    189

    Problem: Expected counts

  • 8/3/2019 Tute12_4x1

    3/13

    99

    Back to square one!

    Opinion Total

    Sex Health &

    Transport

    Education

    Males 11

    (10.2)

    7

    (7.8)

    18

    Females 6

    (6.8)

    6

    (5.2)

    12

    Total 17 13 30

    30

    1817

    A: Now, all Ei 5(Please check column totals and row totals of Ei again.)

    30

    1813

    1010

    df = (r-1)*(c-1) = 1*1 = 1

    P: From chi-sq table (df=1), p-val>0.5

    Since p-val>0.05, retain (do NOT reject) Ho.

    362.02.5

    )2.56(

    8.6

    )8.66(

    8.7

    )8.77(

    2.10

    )2.1011(

    O)-(Estatisticsq-chi:T

    2222

    2

    =

    +

    +

    +

    =

    =E

    1111

    (Recall: Ho: There is no association between

    Sex and Opinion.)

    C: There could be no association between Sex

    and Opinion; there is no strong evidence to

    indicate otherwise.

    Note: No formula for CI it has no meaning.

    1212

    Practice Exercises

    Note: In Q4-6, always check if

    Sum of Ei = n

    (apart from some rounding errors)

    before continuing the HATPCs.

  • 8/3/2019 Tute12_4x1

    4/13

    1313

    Question 1

    Refer to the table on the next slide.

    1414

    Question 1

    School: 1=Govt, 2=Catholic, 3=independent

    Sex: 1=male, 2=female

    Course Grade SNG UAI GPA School Sex

    Accounting And Finance CR 69 77.6 2.6 2 1

    Accounting And Finance CR 66 96.15 2.25 2 2

    Information Systems & T P 58 56.15 0.75 1 1

    Business HD 91 87.65 3.25 2 2

    Psychology CR 69 91.15 2.5 3 2

    Computer Science P 58 81.05 1.5 2 1

    Psychology HD 88 92.7 3.25 1 2

    Financial Management D 79 88.85 3 3 1

    Mathematics HD 87 96.1 3.75 3 2

    Applied Finance CR 70 98.35 2.5 1 2

    Geoscience P 57 2.25 1 2

    Philosophy D 77 74.05 1.778 1 1

    Applied Finance P 63 90.15 3 1 1

    Psychology D 76 88.7 2.5 3 2

    Medical Chemistry P 58 95.3 1.5 3 2

    Environmental Managem HD 91 94.5 3.25 3 2Economics CR 71 97.5 2.75 1 2

    Business F 27 89.65 1 2 2

    1515

    Question 1 (continued)

    (a) How many variables are there in the firstcolumn Course?

    (b) How many variables are there in the firstcolumn Sex?

    (c) Make up a research question that can beasked for the column Sex?

    1616

    Question 1 (continued)

    (d) What is the research question that can be

    asked for the last 2 columns School andSex?

  • 8/3/2019 Tute12_4x1

    5/13

    17

    Question 2

    It is hypothesized that 4 types of peas should

    occur in the ratio 9:3:3:1 (Mendels theory).(a) What type of test should be used to test

    Mendels theory? (Just quote the name of

    the test.)

    (b) Write down the null hypothesis for this test.

    1818

    Question 3

    The computer output

    below refers to a

    survey of Chinesemales who were

    living in the

    Minhang District

    of China. They

    were classified by

    their level ofeducation and their

    smoking status:

    1919

    Research Question: Is there an association betweenlevel of education and smoking status of Chinesemales from the Minhang District?

    Write a conclusion only to the above research question.Do NOT perform the formal hypothesis test(HATPC).

    2020

    Question 3 (answer)

  • 8/3/2019 Tute12_4x1

    6/13

    2121

    Question 4 (continued from Q.3)

    Assume the sample of Chinese males was selectedrandomly from the Minhang District.

    (a) Estimate the proportion of males who are educatedto each of the three levels:

    primary school, middle school and college

    (Note: These proportions are NEVER used to performthe hypothesis test.)

    2222

    Question 4 (continued from Q.3)

    Suppose you are asked to determine whether equalproportions of males are educated to primary school

    level, middle school level and college level.

    (b) Write down an appropriate null hypothesis to test thisclaim.

    (c) Would you expect to reject this null hypothesis?Explain. (Do not perform the test)

    2323

    Question 4 (continued from Q.3)

    (d) Write down the conclusion you would expect. (Do

    not perform the test)

    2424

    The Stat170 survey was used to investigate whetherstudents newspaper reading habits have changed overthe past ten years. In 1998 studies conducted at

    Macquarie University revealed that 20% of students reada newspaper daily, 10% never read a newspaper and therest divided equally between weekly and less than weekly.

    The Stat170 survey in 2008 revealed that, of 668 studentswho responded to this question, 118 read a newspaperdaily, 211 weekly, 257 less than weekly and 82 neverread a newspaper.

    Did the newspaper reading habits of students changedbetween 1998 and 2008?

    Source: Stat170 student database (2008)

    Question 5

  • 8/3/2019 Tute12_4x1

    7/13

    2525

    Question 5 (answers)

    (Ans: chi sq = 9.81)

    newspaper reading habits

    daily weekly

  • 8/3/2019 Tute12_4x1

    8/13

    2929

    Question 7

    preferred diet

    weightfeel meat vegetarian vegan total

    underweight 35 (34.56) 4 (4.51) 1 (0.92) 40

    just right 226 (227.26) 33 (29.67) 4 (6.07) 263

    overweight 76 (75.18) 7 (9.82) 4 (2.01) 87

    total 337 44 9 390

    Research Question: Among students, is there anassociation between type of diet and how they feel

    about their weight?

    3030

    There is a problem with the test of association asseen from the given table. Re-construct the tableand perform the test to answer the researchquestion.

    3131(Ans: chi sq = 0.16)

    32

    Question 8

    In order to check if a coin is fair, the coin is tossed 200times. The results are 92 heads and 108 tails. Isthere evidence to indicate that the coin is biased?

  • 8/3/2019 Tute12_4x1

    9/13

    33

    Question 8 (Answers)

    (Partial Ans: chi sq = 1.28, 0.2

  • 8/3/2019 Tute12_4x1

    10/13

    37

    Question 10 (answers)

    Given the chi sq statistic to be 5.1 (because the

    calculations are too long!)

    Partial Ans: chi sq = 5.1, p-val>0.5 38

    Computer (EcStat) Exercises

    39

    Question 1

    Re-do the problem in the beginning of this tutorial about

    students holidaying in NSW, interstate or overseas.

    Given 2003 past history: 50% NSW, 20% interstate,30% overseas

    In the sample of 2011 (n=25), the numbers are:

    NSW = 14, Interstate = 2, and Overseas = 9 (n = 25)

    Research question: Have the proportions of students

    holidaying within NSW, interstate and overseaschanged over the past 8 years?

    40

    Question 1 (continued)

    Re-construct the original datafile (of 2011) in this way:

    Row 1: Title (eg

    Holidaying) Row 2 - row 15, enter 1 Row 16 row 17, enter 2 Row 18 row 26, enter 3

    Type the labels (anywhere), andthe null values 0.5, 0.2 and

    0.3 beside them.

  • 8/3/2019 Tute12_4x1

    11/13

    41

    Optional butrecommended: Pre-highlight column A,

    then clickUnivariateicon.

    Tell EcStat where tolook for the labels andnull values.

    Tick CI (optional).

    42

    Holidaying Size Proportion StErr

    NSW 14 0.5600 0.0993 0.3654 0.7546

    Interstate 2 0.0800 0.0543 -0.0263 0.1863

    Overseas 9 0.3600 0.0960 0.1718 0.5482

    Goodness-of-fit test on population proportions:

    Holidaying 2dcmp. 0 StErr0

    NSW 0.1800 0.5 0.1000

    Interstate 1.8000 0.2 0.0800

    Overseas 0.3000 0.3 0.0917

    chisq(2): 2.280 pValue: 0.3198

    95% CI

    Proportion refers to the 3 sample proportions p1, p2and p3. But we do NOT use p1, p2 and p3 in the chisq calculations.

    43

    Question 1 (continued)

    Fill in the following answers:

    (a) Ho: ___________________

    (b) What is the value of test statistic? (Includesymbol z/t/2) ____________

    (c) What is the value of p-val? __________

    (d) What is the value of df ? _________

    (e) Do you reject or not reject Ho? _________

    (f) What are the expected counts? You do them;EcStat does not calculate them.

    E1= ________, E2 = _________, E3 = _______44

    Alternatively, instead of

    the raw data file, we

    can input the summary

    (the observed counts or

    frequencies).

  • 8/3/2019 Tute12_4x1

    12/13

    45

    Holidaying Size Proportion StErr

    NSW 14 0.5600 0.0993 0.3654 0.7546

    Interstate 2 0.0800 0.0543 -0.0263 0.1863

    Overseas 9 0.3600 0.0960 0.1718 0.5482

    Goodness-of-fit test on population proportions:

    Holidaying 2dcmp. 0 StErr0

    NSW 0.1800 0.5 0.1000

    Interstate 1.8000 0.2 0.0800

    Overseas 0.3000 0.3 0.0917

    chisq(2): 2.280 pValue: 0.3198

    95% CI

    Outputs will be the same as from a raw data file.

    46

    Question 2 (Pract 10 Exercises)

    Load the file Students.xls (used in Pract/WASP 10)

    Research question: Can the claim that the proportionsof university students coming from Governmentschools, Catholic schools and independent schoolsbeing 0.5, 0.25 and 0.25 respectively be justified?

    Perform the hypothesis test using EcStat. Then answerthe questions that follow.

    47

    Type in thelabels and nullvalues ofproportions --anywhere.

    CI optional.

    48

    Question 2 (continued)

    Fill in the following answers:

    (a) Ho: ___________________

    (b) What is the value of test statistic? (Includesymbol z/t/2) ____________

    (c) What is the value of p-val? __________

    (d) What is the value of df ? _________

    (e) Do you reject or not reject Ho? _________

    (f) What are the expected counts? You do them;EcStat does not calculate them.

    E1= ________, E2 = _________, E3 = _______

  • 8/3/2019 Tute12_4x1

    13/13

    49

    Question 3 (Pract 10 Exercises)

    Continue with the file Students.xls.

    Research question: Is there an association

    between School and Sex?

    50

    Question 3 (continued)

    Steps: 1. Type the labels of the 2 variables asshown.

    2. Optional but recommended: Pre-highlight thecolumns School and Sex. Make sure youhighlight them separately highlight School,then press Ctrl and highlight Sex. It does notmatter which one comes first.

    3. ClickAssociation (5th

    ) EcStat icon.4. Fill in the boxes as shown on the next slide.

    5. Tick bar chart (clustered bar chart).

    51 52

    Question 3 (continued)

    Fill in the following answers:

    (a) Ho: _______________________________

    (b) What is the value of test statistic? (Includesymbol z/t/2) ____________

    (c) What is the value of p-val? __________

    (d) What is the value of df ? _________

    (e) Do you reject or not reject Ho? _________