Applied Statistics Using SAS and SPSS

  • View
    26

  • Download
    4

Embed Size (px)

DESCRIPTION

Applied Statistics Using SAS and SPSS. Topic: Chi-square tests By Prof Kelly Fan, Cal. State Univ., East Bay. Outline. ALL variables must be categorical Goal one: verify a distribution of Y One-sample Chi-square test (SPSS lesson 40; SAS handout) - PowerPoint PPT Presentation

Text of Applied Statistics Using SAS and SPSS

  • *Applied Statistics Using SAS and SPSSTopic: Chi-square testsBy Prof Kelly Fan, Cal. State Univ., East Bay

  • *Outline ALL variables must be categoricalGoal one: verify a distribution of YOne-sample Chi-square test (SPSS lesson 40; SAS handout)Goal two: test the independence between two categorical variablesChi-square test for two-way contingency table (SPSS lesson 41; SAS section 3.G)McNemars test for paired data (SPSS lesson 44; SAS section 3.L) Measure the dependence (Phil and Kappa coefficients) (SPSS lesson 41, 44; SAS section 3.G, 3.M)

  • *Example: Postpartum Depression StudyAre women equally likely to show an increase, no change, or a decrease in depression as a function of childbirth?

    Are the proportions associated with a decrease, no change, and an increase in depression from before to after childbirth the same?

  • *Example: Postpartum Depression StudyFrom a random sample of 60 women

    Depression after birth in comparison with before birthObserved frequenciesHypothesized proportionsExpected frequenciesLess depressed (-1)141/320Neither less nor more depressed (0)331/320More depressed (1)131/320

  • *One-sample Chi-Square TestMust be a random sample

    The sample size must be large enough so that expected frequencies are greater than or equal to 5 for 80% or more of the categories

  • *One-sample Chi-Square TestTest statistic:

    Oi = the observed frequency of i-th categoryei = the expected frequency of i-th category

  • *SPSS OutputWeight your data by count firstAnalyze >> Nonparametric Tests >> Legacy Dialogs >> Chi Square, count as test variable

  • *ConclusionReject Ho

    The proportions associated with a decrease, no change, and an increase in depression from before to after childbirth are significantly different to 1/3, 1/3, 1/3.

  • *Example: Postpartum Depression Study

    Are the proportions associated with a change and no change from before to after childbirth the same?

  • *Example: Postpartum Depression StudyFrom a random sample of 60 women

    Depression after birth in comparison with before birthObserved frequenciesHypothesized proportionsExpected frequenciesSame amount of depression (0)331/230More or less depressed (1)271/230

  • *SPSS Output

  • *Two-way Contingency TablesReport frequencies on two variables

    Such tables are also called crosstabs.

  • *Contingency Tables (Crosstabs)1991 General Social Survey

    FrequencyParty IdentificationDemocratIndependentRepublicanRaceWhite341105405Black1031511

  • *Crosstabs Analysis (Two-way Chi-square test)Chi-square test for testing the independence between two variables:

    For a fixed column, the distribution of frequencies over rows keeps the same regardless of the columnFor a fixed row, the distribution of frequencies over columns keeps the same regardless of the row

  • *Measure of dependence for 2x2 tablesThe phi coefficient measures the association between two categorical variables-1 < phi < 1| phi | indicates the strength of the associationIf the two variables are both ordinal, then the sign of phi indicate the direction of association

  • SPSS OutputP. 332 333

    *

  • *SAS OutputStatistic DF Value ProbChi-Square 2 79.4310
  • Measure of dependence for non-2x2 tablesCramers V

    Range from 0 to 1V may be viewed as the association between two variables as a percentage of their maximum possible variation.V= phi for 2x2, 2x3 and 3x2 tables*

  • *Fishers Exact Test for IndependenceThe Chi-squared tests are ONLY for large samples:

    The sample size must be large enough so that expected frequencies are greater than or equal to 5 for 80% or more of the categories

  • *SAS/SPSS OutputSAS output: Fisher's Exact Test Table Probability (P) 3.823E-22 Pr
  • *Matched-pair DataComparing categorical responses for two paired samplesWhen eitherEach sample has the same subjects (or say subjects are measured twice)OrA natural pairing exists between each subject in one sample and a subject form the other sample (eg. Twins)

  • *Example: Rating for Prime Minister

    Second SurveyFirst SurveyApproveDisapproveApprove794150Disapprove86570

  • *Marginal HomogeneityThe probabilities of success for both samples are identical

    Eg. The probability of approve at the first and 2nd surveys are identical

  • *McNemar Test (for 2x2 Tables only)SAS: Section 3.L; SPSS: Lesson 44

    Ho: marginal homogeneityHa: no marginal homogeneity

    Exact p-valueApproximate p-value (When n12+n21>10)

  • *SAS Output McNemar's Test Statistic (S) 17.3559 DF 1 Asymptotic Pr > S = S 3.716E-05

    Simple Kappa Coefficient Kappa 0.6996 ASE 0.0180 95% Lower Conf Limit 0.6644 95% Upper Conf Limit 0.7348

    Sample Size = 1600Level of agreement

  • SPSS Output*SPSS: p. 361 and in two-samples tests window tick McNemar and click exact, then tick exact: