# Virtual COMSATS Inferential Statistics Lecture22 Ossam Chohan Assistant

• Slides: 19

Virtual COMSATS Inferential Statistics Lecture-22 Ossam Chohan Assistant Professor CIIT Abbottabad 1

Recap of last lecture • In our last sessions, we worked on: – Test for independence. – Practice problem. – Assessment Problems. 2

Objective of lecture-22 • In this lecture, we will understand problems related to: – Fisher’s Exact test. – Test for homogeneity. – Goodness of fit. – Review of Chi Square. 3

Fisher’s Exact test for 2*2 Contingency Table • When frequencies in a 2*2 contingency table are fairly small, typical chi square approach creates some doubts about adequacy. • An exact test is recommended by Fisher. • No comparison is made on observed and expected frequencies. • Exact test based on exact probabilities of each cell for all values. • More explanation in following example. 4

Problem-20 • Use the Fisher’s exact test to test the hypothesis that inoculation is independent of immunity from attack among a population exposed to a certain disease, given the following data: Classes Not Inoculated Total No attacked 3 5 8 Attacked 10 2 12 Total 13 7 20 5

Problem-20 Solution 6

Problem-20 Solution 7

Problem-20 Solution 8

Assessment Problem-19 • Suppose that a number of patients were treated for cancer with results as in the following table: Toxity Present Tumer Regression Yes No Yes 5 2 No 1 7 • Use Fisher’s exact test to test the independence. 9

The chi square test of homogeneity Brandt-Snedecor formula • In a certain city, a random sample of 50 men and another sample of 50 women over 21 years of age were asked about their educational background, classified as Secondary, college or university education. The results were: Secondary College University Total Male 13 25 12 50 Female 23 20 7 60 total 36 45 19 N=100 • Test whether the two samples are homogeneous in respect of educational levels at 5% level of significance. 10

Problem-21 Solution 11

Cont… 12

Goodness of Fit-Chi square • A statistical method used to determine goodness of fit – Goodness of fit refers to how close the observed data are to those predicted from a hypothesis • Note: – The chi square test does not prove that a hypothesis is correct • It evaluates to what extent the data and the hypothesis have a good fit 13

The Chi Square Test-Goodness of fit • The general formula is c 2 = S (O – E)2 E • With n-k-1 degrees of freedom • where – O = observed data in each category – E = observed data in each category based on the experimenter’s hypothesis – S = Sum of the calculations for each category 14

Problem-22 • In the accounting department of a bank 100 accounts are selected at random and examined fro errors. The following results have been obtained. No of errors No of accounts 0 36 • Does this information verify that the errors are distributed according to Poisson probability law? 1 40 2 19 3 2 4 0 5 2 6 1 15

Problem-22 Solution 16

Problem-22 Solution 17

Assessment Problem-20 • Suppose that 6 coins are tossed simultaneously 640 times and the following frequency distribution is observed: • Test the null hypothesis that the coins are wellbalanced. Use 5% level of significance. No of heads Frequency 0 13 1 70 2 137 3 210 4 145 5 56 6 9 18

Review of Chi-Square • In chi-square unit, we discussed the following points: • Hypothesis testing for variances. • Hypothesis testing for independence. – Special case of independence for 2*2. • Hypothesis testing for homogeneity. • Goodness of fit. 19