- 49 Views
- Uploaded on
- Presentation posted in: General

STAT131 W6La Association from Contingency Tables

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

STAT131W6La Association from Contingency Tables

by

Anne Porter

alp@uow.edu.au

- Card game

- We draw a card from a pack until such time as there is a protest.
- The cards have been stacked such that all red come first (or all black)
- The draw is meant be be random ie a mix of red and black.
- At some point students reject the idea of fairness
- The proportion of reds is higher than expected by chance
- (or blacks depending on which was drawn first)
- Students are in fact rejecting the null hypothesis that the proportion
- of red cards is 0.5.
- (or that the proportion of red and black cards is equal)
- They are accepting the hypothesis that the proportion is not equal 0.5

- Null hypothesis is that the proportion of red cards (females) is 0.5 (or that the proportion of red and black cards is equal)
- Alternative hypothesis is that the proportion of red cards (females) is not equal 0.5

- H0: p = 0.5 and
- HA p ≠ 0.5
- The p we refer to is the population proportion
- We do not hypothesise about a sample proportion
- We make inference about a population parameter p

Tests of proportions

- Test hypotheses about association between categorical variables
- Testing Hypotheses (5 steps)
- Null and alternative hypotheses
- a level of significance
- Select test and state decision rule
- Perform experiment
- Draw conclusions

- test of association AND
- model fit
- p values

- For this contingency table what is
- P(Male) =
- P(Support)=

20/70

40/70

- If event male is independent of event support then
- P(Male and Support) =

P(Male)xP(Support)

=20/70 x 40/70 = 0.1632

- Given 70 observed people, if P(Male & Support)=0.1632
- How many are expected to be male and support given independence?

11.43

= 0.1632 x70 = 11.43 if events Males and Support are independent

- Knowing the expected frequency for (male and support) we have no more degrees of freedom, the remaining values are fixed.

11.43

20-11.43=8.57

30-8.57=21.43

40-11.43=38.57

Note: We had 1 degree of freedom

- If we observe a sample of data we may ask if the variables sex and level of support are associated? To test this we formally test the hypotheses…

E=11.43

E=8.57

E=38.57

E=21.43

- Ho: Under model of independence, E distributed
(Row total * column total)/grand total

- Ha: E not distributed
- (row total*column total)/grand total

E=8.57

E=11.43

E=38.57

E=21.43

- a is determined such that we have a desired level of confidence in our procedures (ie in our results).
- For the chi-square test for association we will use a=0.05
- We will examine choosing alpha (a) later

- Knowing the expected frequency for (male and support) we have no more degrees of freedom, the remaining values are fixed.

11.43

20-11.43=8.57

21.43

38.57

Note: We had 1 degree of freedom

- The degrees of freedom for a rows x column matrix may be calculated as (r-1)x(c-1)=(2-1)x(2-1)=1
- r is the number or rows and c is the number of columns

11.43

8.57

21.43

38.57

Note: We had 1 degree of freedom

- Ho: Under model of independence, E distributed
(Row total * column total)/grand total

- Ha: E not distributed
- (row total*column total)/grand total

E=8.57

E=11.43

E=38.57

E=21.43

To test about association in contingency tables we calculate

- And determine the region of rejection ie how big chi-square has to be before we conclude that the observed are sufficiently different to the expected to reject the null hypothesis
- eij expected count for the ith row and jth column of the table

For our contingency table

df=1,

a=0.05

Then reject Ho there is evidence that the variables are not independent

If the calculated >

3.841

For our contingency table

df=1,

a=0.05

Then reject Ho there is evidence that the variables are not independent

If the calculated >

3.841

E=11.43

E=8.57

E=28.57

E=21.43

- As calculated value of 0.70 < 3.841 (tabulated value) there insufficient evidence to reject the model that sex and level of support are independent. That is there is no evidence of an association between sex and level of support. The profile of support by males is similar to the profile of support for females. 13/40 (32.5%)males support, 7/30 (23.3%) females support

- Data, weight cases by freq has been selected
- Analyse, Descriptives, Crosstabs and options have been selected

Value of chi-square

Assumption of expected frequencies > 5 hold

Probability of getting a statistic as high or greater than 0.706 is 0.401. This is high >0.05 therefore retain Ho, we can get this chi value by chance under independence

Value of chi-square

- Yes / No Ear infection
- P Placebo gum
- X xylitol gum
- L xylitol lozenge
- Is there an association between ear infection and gum used?

Degrees of freedom=

2

- Ho: Under model of independence, E distributed
-(Row total * column total)/grand total

- Ha: E not distributed
-(row total*column total)/grand total

If

p1=proportion who get an infection in population given placebo

p2=proportion who get an infection given Xylitol gum

P3=proportion who get an infection in a population given Xylitol lozenges

Ho:

Ha:

p1=p2=p3

p1, p2 and p3 are not all the same

- Ho: Under model of independence, E distributed
(Row total * column total)/grand total

- Ha: E not distributed in this manner
- a=
- df=
- Statistic and Region of rejection

0.05

(3-1)x(2-1)=2

If calculated chi-square >5.991 reject Ho there is evidence that the variables are not independent

>5.991 therefore there is evidence that

the data do not fit the model of independence

- Chi-square = 6.690

For chi-square test (one tailed) the p value is

- the probability of getting this statistic or greater

The probability of getting a chi-square as high as this or higher is 0.035. This is a small probability (<0.05) if the H0 were true. There is evidence of an association between infection and gum used

- Chi-square = 6.690

Assumptions re expected frequency>5 OK

1.Null and alternative hypotheses

2.Assign a

3.Select a statistic and determine the rejection region

4.Perform the experiment and calculate the observed value of c2 or T or Z or…other statistic

5.Draw conclusions in context of problem

Model fit

Ho: Expected distributed Binomial(2,0.5)

Ha: Expected not distributed Binomial (2,0.5)

2. Ho: Expected distributed Poisson (0.4)

Ha: Expected not Poisson (0.4)

3. Ho: Expected distributed as per the random stopping model

Ha: Expected not distributed as per random stopping model

- the null hypothesis may be proportion= 0.5 and
- alternative hypothesis proportion ≠ 0.5
- the null hypothesis may be m = 0 and
- alternative hypothesis m ≠ 0.

Tests of proportions

Tests of means