Download presentation

Presentation is loading. Please wait.

Published byLauryn Cutlip Modified about 1 year ago

1
8.11 Using Statistics To Make Inferences 8 Summary Contingency tables. Goodness of fit test. Saturday, 02 May 20158:05 AM

2
8.22 Goals To assess contingency tables for independence. To perform and interpret a goodness of fit test. Practical Construct and analyse contingency tables.

3
8.33 Recall To compare a population and sample variance we employed? χ2χ2 Cc cc

4
8.44 Today The probability approach from last week is employed to tell if “observed” data confirms to the pattern “expected” under a given model.

5
8.55 Categorical Data - Example Assessed intelligence of athletic and non-athletic schoolboys. brightstupidTotal athletic5815671148 lazy209351560 Total7909181708 K. Pearson “On The Relationship Of Intelligence To Size And Shape Of Head, And To Other Physical And Mental Characters”, Biometrika, 1906, 5, 105-146, data on page 144.On The Relationship Of Intelligence To Size And Shape Of Head, And To Other Physical And Mental Characters

6
8.66 Procedure 1.Formulate a null hypothesis. Typically the null hypothesis is that there is no association between the factors. 2.Calculate expected frequencies for the cells in the table on the assumption that the null hypothesis is true. 3.Calculate the chi-squared statistic. This is for an r x c table with entries in row i and column j.

7
8.77 Procedure 4.Compare the calculated statistic with tabulated values of the chi-squared distribution with ν degrees of freedom. ν = (rows ‑ 1)(columns ‑ 1) = (r – 1)(c – 1)

8
8.88 Key Assumptions 1.Independence of the observations. The data found in each cell of the contingency table used in the chi-squared test must be independent observations and non-correlated. 2.Large enough expected cell counts. As described by Yates et al., "No more than 20% of the expected counts are less than 5 and all individual expected counts are 1 or greater" (Yates, Moore & McCabe, 1999, The Practice of Statistics, New York: W.H. Freeman p. 734).

9
8.99 Key Assumptions 3.Randomness of data. The data in the table should be randomly selected. 4. Sufficient Sample Size. It is also generally assumed that the sample size for the entire contingency table is sufficiently large to prevent falsely accepting the null hypothesis when the null hypothesis is true.

10
8.1010 Example Assessed intelligence of athletic and non athletic schoolboys. Observed brightstupidTotal athletic5815671148 lazy209351560 Total7909181708

11
8.1111 Probabilities The probability a random boy is athletic is The probability a random boy is bright is Assuming independence, the probability a random boy is both athletic and bright is brightstupidTotal athletic5815671148 lazy209351560 Total7909181708 For 1708 respondents the expected number of athletic bright boys is CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

12
8.1212 Expected brightstupidTotal athletic530.981148 lazy560 Total7909181708 The expected number of athletic bright boys is

13
8.1313 Expected brightstupidTotal athletic530.98?1148 lazy560 Total7909181708 The expected number of athletic stupid boys is

14
8.1414 Expected brightstupidTotal athletic530.98617.021148 lazy560 Total7909181708 The expected number of athletic stupid boys is 1148 – 530.98 = 617.02

15
8.1515 Expected brightstupidTotal athletic530.98617.021148 lazy?560 Total7909181708 The expected number of lazy bright boys is

16
8.1616 Expected brightstupidTotal athletic530.98617.021148 lazy259.02?560 Total7909181708 The expected number of stupid lazy boys is

17
8.1717 Expected brightstupidTotal athletic530.98617.021148 lazy259.02300.98560 Total7909181708 The expected number of stupid lazy boys is 918 – 617.02 = 300.98

18
8.1818 Expected brightstupidTotal athletic530.98617.021148 lazy259.02300.98560 Total7909181708

19
8.1919 χ2χ2 ObservedExpected Only one cell is free.

20
8.2020 χ2χ2 As a general rule to employ this statistic, all expected frequencies should exceed 5. If this is not the case categories are pooled (merged) to achieve this goal. See the Prussian data later.

21
8.2121 Conclusion νp=0.1p=0.05p=0.025p=0.01p=0.005p=0.002 12.7063.8415.0246.6357.8799.550 The result is significant (26.73 > 3.84) at the 5% level. So we reject the hypothesis of independence between athletic prowess and intelligence.

22
8.2222 SPSS Raw data Notev1 are the row labels v2 are the column labels v3 is the frequency for each cell

23
8.2323 SPSS Data > Weight Cases Since frequency data has been input, necessary to weight. This is essential, do not use percentages.

24
8.2424 SPSS Analyze > Descriptive Statistics > Crosstabs Set row and column variables. Frequencies already set.

25
8.2525 SPSS Select chi-square

26
8.2626 SPSS Select Observed – input data Expected – output data, under the model

27
8.2727 SPSS Expected cell frequencies Expected under the model.

28
8.2828 SPSS Pearson Chi Square is the required statistic Do not report p =.000, rather p <.001 Note Fisher’s exact test, only available in SPSS for 2x2 tables (see next slide). ff

29
8.2929 What If We Have Small Cell Counts? Fisher's exact test The Fisher's exact test is used when you want to conduct a chi-square test but one or more of your cells has an expected frequency of five or less. Remember that the chi-square test assumes that each cell has an expected frequency of five or more, but the Fisher's exact test has no such assumption and can be used regardless of how small the expected frequency is. In SPSS, unless you have the SPSS Exact Test Module, you can only perform a Fisher's exact test on a 2x2 table, and these results are presented by default.

30
8.3030 Aside Two dials were compared. A subject was asked to read each dial many times, and the experimenter recorded his errors. Altogether 7 subjects were tested. The data shows how many errors each subject produced. Do the two conditions differ at the 0.05 significance level (give the appropriate p value)? Observed data 1234567 36313129322526 29353435343530 What key word describes this data?

31
8.3131 Aside What tests are available for paired data? One sample t test Sign test Wilcoxon Signed Ranks Test CCCCCCCCCcCCCCCCCCCc

32
8.3232 Aside What tests are available for paired data? What assumptions are made? One sample t test Sign test Wilcoxon Signed Ranks Test normality Resembles the SignTest in scope, but it is much more sensitive. In fact, for large numbers it is almost as sensitive as the Student t-test No assumption of normality

33
8.3333 Aside What tests are available for paired data? One sample t test Sign test Wilcoxon Signed Ranks Test Sign test answers the question How Often?, whereas other tests answer the question How Much? One sample t test – mean Wilcoxon Signed Ranks Test - median

34
8.3434 Example The table is based on case-records of women employees in Royal Ordnance factories during 1943-6. The same test being carried out on the left eye (columns) and right eye (rows). Stuart “The estimation and comparison of strengths of association in contingency tables”, Biometrika, 1953, 40, 105-110.The estimation and comparison of strengths of association in contingency tables

35
8.3535 Observed HighestSecondThirdLowestTotal Highest1520266124661976 Second2341512432782256 Third11736217722052456 Lowest3682179492789 Total1907222225078417477 Is there any obvious structure?

36
8.3636 Expected In general to find the expected frequency in a particular cell the equation is Row total x Column total / Grand total

37
8.3737 Expected In general to find the expected frequency in a particular cell the equation is Row total x Column total / Grand total So for highest right and bottom left the equation becomes 1976 x 1907 / 7477 = 503.98

38
8.3838 Expected HighestSecondThirdLowestTotal Highest503.98?1976 Second?2256 Third?2456 Lowest????789 Total1907222225078417477 Row total x Column total / Grand total 1976 x 1907 / 7477 = 503.98

39
8.3939 Expected HighestSecondThirdLowestTotal Highest503.98587.22662.54?1976 Second575.39670.43756.43?2256 Third626.40729.87823.48?2456 Lowest????789 Total1907222225078417477 Row total x Column total / Grand total

40
8.4040 Expected HighestSecondThirdLowestTotal Highest503.98587.22662.54?1976 Second575.39670.43756.43?2256 Third626.40729.87823.48?2456 Lowest????789 Total1907222225078417477 The missing values are simply found by subtraction

41
8.4141 Expected HighestSecondThirdLowestTotal Highest503.98587.22662.54?1976 Second575.39670.43756.432256 Third626.40729.87823.482456 Lowest789 Total1907222225078417477 1976 – 503.98 – 587.22 – 662.54 = 222.26

42
8.4242 Expected HighestSecondThirdLowestTotal Highest503.98587.22662.54222.261976 Second575.39670.43756.432256 Third626.40729.87823.482456 Lowest789 Total1907222225078417477 1976 – 503.98 – 587.22 – 662.54 = 222.26

43
8.4343 Expected HighestSecondThirdLowestTotal Highest503.98587.22662.54222.261976 Second575.39670.43756.43?2256 Third626.40729.87823.48?2456 Lowest????789 Total1907222225078417477 Similarly for the remaining cells

44
8.4444 Expected HighestSecondThirdLowestTotal Highest503.98587.22662.54222.261976 Second575.39670.43756.43253.752256 Third626.40729.87823.48276.252456 Lowest201.23234.47264.5588.75789 Total1907222225078417477

45
8.4545 Short Cut Contributions to the χ 2 statistic, for the top left cell the contribution is

46
8.4646 Conclusion ν p=0.1p=0.05p=0.025p=0.01p=0.005p=0.002 914.68416.91919.02321.66623.58926.056 The above statistic makes it very clear that there is some relationship between the quality of the right and left eyes. For the top left cell only. Nine cells are free.

47
8.4747 HighestSecondThirdLowestTotal Highest2048.32175.72437.75109.86 Second202.551056.38139.14121.73 Third414.25185.411092.5318.38 Lowest135.6799.1527.661832.37 Total8097 Total χ 2

48
8.4848 Conclusion ν p=0.1p=0.05p=0.025p=0.01p=0.005p=0.002 914.68416.91919.02321.66623.58926.056 The above statistic makes it very clear that there is some relationship between the quality of the right and left eyes. For all cells. Nine cells are free.

49
8.4949 SPSS Raw data

50
8.5050 SPSS Expected cell frequencies

51
8.5151 SPSS Pearson Chi Square is the required statistic

52
8.5252 Poisson Distribution The Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time and/or space if these events occur with a known average rate and independently of the time since the last event. The Poisson distribution can also be used for the number of events in other specified intervals such as distance, area or volume. Typical applications are to queues/arrivals. The number of phone calls received per day. The occurrence of accidents/industrial injuries. More exotically, birth defects and the number of genetic mutations. The occurrence of rare diseases.

53
8.5353 Poisson Distribution 1discrete events which are independent. 2events occur at a fixed rate λ per unit continuum. ( λ lambda)

54
8.5454 Poisson Distribution x successes e is approximately equal to 2.718 λ is the rate per unit continuum the mean is λ the variance is λ

55
8.5555 Casio 83ES exp or “e” exp(1) = 2.7182818 exp(2) = 7.389056 Its inverse, on the same key is ln, so ln(2.7182818) = 1 ln(7.389056) = 2

56
8.5656 Alternate applications A similar approach may be employed to test if simple models are plausible.

57
8.5757 χ 2 Goodness of Fit Test The degrees of freedom are ν = m – n – 1, where there are m frequencies left in the problem, after pooling, and n parameters have been fitted from the raw data. For example…

58
8.5858 Example The number of Prussian army corps in which soldiers died from the kicks of a horse in a year. Typical “industrial injury” data

59
8.5959 Which distribution is appropriate? Is the data discrete or continuous? Discrete, since a simple count ccccccccccccccccccccccc

60
8.6060 Check list of distributions DiscreteContinuous BinomialNormal PoissonExponential

61
8.6161 Check list of distribution parameters DiscreteContinuous BinomialNormal PoissonExponential n p μ σ2μ σ2 λ cccccccccccccccccccccccccc Discrete, no “n” implies Poisson ccccccc λcccccccccccccccccccccccccc

62
8.6262 Observed Data Number deaths in a corps Observed frequency (O i ) 0144 191 232 311 42 5 or more0 Total280 We need to estimate the Poisson parameter λ. Which is the mean of the distribution.

63
8.6363 Observed Data Number deaths in a corps Observed frequency (O i ) 0144 191 232 311 42 5 or more0 Total280

64
8.6464 Mean ccccccccccccccccccccc

65
8.6565 Expected Number deaths in a corps Poisson model Expected probability 00.4966 10.3476 20.1217 30.0284 40.0050 5 or moreBy subtraction? Total11 λ = 0.7 and “e” is a constant on your calculator

66
8.6666 Expected Number deaths in a corps Poisson model Expected probability 00.4966 10.3476 20.1217 30.0284 40.0050 5 or moreBy subtraction0.0008 Total11

67
8.6767 Expected Frequency Expected frequency for no deaths 280 x 0.4966 = 139.04 Number deaths in a corps Expected probability Expected frequency (E i ) 00.4966139.04 10.3476 20.1217 30.0284 40.0050 5 or more0.0008 Total1

68
8.6868 Expected Frequency Expected frequency for remaining rows 280 × probability = frequency Number deaths in a corps Expected probability Expected frequency (E i ) 00.4966139.04 10.347697.33 20.121734.07 30.02847.95 40.00501.39 5 or more0.00080.22 Total1280 Note the two expected frequencies less than 5!

69
8.6969 χ 2 Calculation Number deaths in a corps Observed frequency (O i ) Expected frequency (E i ) 0144139.040.18 19197.330.41 23234.070.13 3 or more139.561.24 Total280 1.95 Pool to ensure all expected frequencies exceed 5

70
8.7070 Conclusion Here m (frequencies) = 4, n (fitted parameters) = 1 then ν = m – n – 1 = 4 – 1 – 1 = 2 ν p=0.1p=0.05p=0.025p=0.01p=0.005p=0.002 24.6055.9917.3789.21010.59712.429 The hypothesis, that the data comes from a Poisson distribution would be accepted (5.991 > 1.95).

71
8.7171 Next Week Bring your calculators next week

72
8.7272 Read Read Howitt and Cramer pages 134-152 Read Howitt and Cramer (e-text) pages 125-134 Read Russo (e-text) pages 100-119 Read Davis and Smith pages 434-448

73
8.7373 Practical 8 This material is available from the module web page. http://www.staff.ncl.ac.uk/mike.cox Module Web Page

74
8.7474 Practical 8 This material for the practical is available. Instructions for the practical Practical 8 Material for the practical Practical 8

75
8.7575 Assignment 2 You will find submission details on the module web site module web site Note the dialers lower down the page give access to your individual assignment. It is necessary to enter your student number exactly as it appears on your smart card.

76
8.7676 Assignment 2 As a general rule make sure you can perform the calculations manually. It does no harm to check your calculations using a software package. Some software employ non-standard definitions and should be used with caution.

77
8.7777 Assignment 2 All submissions must be typed.

78
8.7878 Whoops! Researchers at Cardiff University School of Social Science claim errors made by the Hawk- Eye line - calling technology can be greater than 3.6mm - the average error quoted by the manufacturers. Teletext, p388 12 June 2008

79
8.7979 Whoops! Kate Middleton 'marries Prince Harry' on souvenir mug The Telegraph - Thursday 17 March 2011

80
8.8080 Whoops! Poldark - BBC - 8 March 2015

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google