14.08.2013 Views

STAT170 Workshop Notes prepared by Nan Carter for Numeracy ...

STAT170 Workshop Notes prepared by Nan Carter for Numeracy ...

STAT170 Workshop Notes prepared by Nan Carter for Numeracy ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Week 11 <strong>STAT170</strong> workshop on CATEGORICAL variables. Prepared <strong>for</strong><br />

<strong>Numeracy</strong> Centre Macquarie University, <strong>by</strong> <strong>Nan</strong> <strong>Carter</strong>.<br />

Examples taken from various sources and adapted <strong>for</strong> <strong>STAT170</strong>.<br />

CATEGORICAL VARIABLES: WE CONSIDER ONLY ONE RANDOM SAMPLE IN<br />

<strong>STAT170</strong><br />

SUMMARY:<br />

1. ONE CATEGORICAL VARIABLE OBSERVED ON EACH ITEM<br />

• TWO CATEGORIES: use EITHER<br />

34<br />

z-TEST OF PROPORTIONS FOR H0: π = π0 where π0 has a<br />

particular value, and<br />

provided that nπ > 5 and n(1-π) > 5<br />

z = (p - π0 )/SE(p) where p is the sample estimate of π<br />

and SE(p)= √[(π)(1-π)/n]<br />

The 95% confidence interval <strong>for</strong> π uses the<br />

estimated SE(p) = √[(p)(1-p)/n]<br />

and is given <strong>by</strong> (p – 1.96 SE(p), p + 1.96 SE(p))<br />

OR χ 2 GOODNESS OF FIT TEST:<br />

The same null hypothesis as <strong>for</strong> the z-test, and it<br />

is used to find expected values, E, <strong>for</strong> both<br />

categories. The observed COUNTS are denoted <strong>by</strong> ‘O’.<br />

The χ 2 -test is valid if all expected values, E, are<br />

>5;<br />

χ 2 = Σ[(O-E) 2 /E] with 1 degree of freedom<br />

• MORE THAN TWO CATEGORIES: use only the χ 2<br />

goodness of fit test with degrees of freedom =<br />

(no. of categories–1)<br />

Use info from the question to <strong>for</strong>m the null<br />

hypothesis, and thence the expected values. The<br />

observed counts are given in the data.<br />

WARNING: SMALL EXPECTED FREQUENCIES: The chi-square<br />

test is not valid when any expected frequency is less<br />

than 5. To counter this problem, we group classes<br />

together to create larger observed counts and larger<br />

expected counts until the problem goes away! There<br />

is a good example of the need to do this in the 1998<br />

<strong>Nan</strong> <strong>Carter</strong>: workshop notes <strong>prepared</strong> <strong>for</strong> <strong>Numeracy</strong> Centre Macquarie University.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!