* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ . * File: phi.SPS . * Date: 18-Jan-2002 . * Author: Bruce Weaver, weaverb@mcmaster.ca . * Notes: Demonstration that phi for 2x2 table = Pearson r calculated on 2 dichotomous (0-1) variables. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ . DATA LIST LIST /pred (f2.0) status (f2.0) count(f5.0) . BEGIN DATA. 0 0 36 0 1 24 1 0 40 1 1 100 END DATA. val lab pred 0 'bars=yes' 1 'bars=no' / status 0 'YLC' 1 'Other' . weight by count. crosstabs pred by status /stat = chisqr phi. corr pred status . * NOTE that phi from the CROSSTABS output is exactly the same as Pearson r from the CORRELATIONS output . * The "shortcut" formula for phi given in textbooks was * useful in the days when folks did most of the calculations * by hand. But nowadays, it only obscures the fact that phi * is simply a Pearson r calculated on 2 dichotomous variables. * Demonstrate that phi = square root of chi-square / N . * Take values of chi-square and N from CROSSTABS output . compute phi = sqrt(17.609/200). exe. formats phi (f8.3). list var phi. * This yields the same result we obtained earlier. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ . * KAPPA example. DATA LIST LIST /obs2 (f2.0) obs1 (f2.0) count(f5.0) . BEGIN DATA. 0 0 78 0 1 42 1 0 48 1 1 132 END DATA. var lab obs1 'Observer 1' obs2 'Observer 2'. val lab obs1 obs2 0 'Yes' 1 'No'. weight by count. crosstabs obs2 by obs1 /stat = kappa. * For situations where one or more of the rows (or columns) in * the crosstabulation are empty, CROSSTABS will not compute * kappa. There are standalone programs that can be used in these * cases; or you can use the macro posted by Dave Nichols on the * SPSS website (URL given below). * ftp://ftp.spss.com/pub/spss/statistics/nichols/macros/nskappa.sps . * Finished. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .