Troubleshooting
Problem
I see that the CROSSTABS procedure has a set of risk statistics for 2x2 tables that includes the odds ratio for case-control studies and cohort-based relative risk estimates. These statistics don't give me what I need from my 2x2 table, which is sensitivity and specificity, the positive predictive value (PPV), the negative predictive value (NPV), and the positive and negative likelihood ratios (LR+ and LR-). Can I get SPSS Statistics to produce these values along with confidence intervals?
Resolving The Problem
None of these statistics are formally built into SPSS Statistics procedure, except for sensitivity, which is available in the ROC procedure (along with 1 - specificity). ROC does not produce confidence intervals for sensitivity though. All of these can be produced without custom programming. The PPV, NPV, sensitivity, and specificity values require the Advanced Statistics module in order to obtain confidence intervals without custom programming.
The following commands can be used to produce all six of the desired statistics, along with 95% confidence intervals. You would need only to replace the counts (29, 1, 19 & 11) with your actual data values. If you already have data in a file, you can skip the reading in of data. Your variable names need to be Predicted and Actual, unless you want to change the names in a number of places in the commands. Note also that the structure of the data is such that the upper left-hand cell of the 2x2 table defined by the Predicted and Actual values contains those who were positive on both prediction and actual outcome, consistent with the structure required by the RISK statistics in CROSSTABS and the usual convention in epidemiological tables. If your data are coded so that 0 is negative and 1 is positive, you would want to recode 0 to 2 for both Predicted and Actual.
*Read in example data.
DATA LIST LIST / Predicted Actual Count.
BEGIN DATA.
1 1 29
1 2 1
2 1 19
2 2 11
END DATA.
FORMATS ALL (F8.0).
WEIGHT BY Count.
*Positive Predictive Value (Estimate for Intercept in GENLIN output).
TEMPORARY.
SELECT IF Predicted=1.
GENLIN Actual (REFERENCE=LAST)
/MODEL DISTRIBUTION=BINOMIAL LINK=IDENTITY
/CRITERIA CITYPE=PROFILE
/PRINT SOLUTION.
*Negative Predictive Value (Estimate for Intercept in GENLIN output).
TEMPORARY.
SELECT IF Predicted=2.
GENLIN Actual (REFERENCE=FIRST)
/MODEL DISTRIBUTION=BINOMIAL LINK=IDENTITY
/CRITERIA CITYPE=PROFILE
/PRINT SOLUTION.
*Sensitivity (Estimate for Intercept in GENLIN output).
TEMPORARY.
SELECT IF Actual=1.
GENLIN Predicted (REFERENCE=LAST)
/MODEL DISTRIBUTION=BINOMIAL LINK=IDENTITY
/CRITERIA CITYPE=PROFILE
/PRINT SOLUTION.
*Specificity (Estimate for Intercept in GENLIN output).
TEMPORARY.
SELECT IF Actual=2.
GENLIN Predicted (REFERENCE=FIRST)
/MODEL DISTRIBUTION=BINOMIAL LINK=IDENTITY
/CRITERIA CITYPE=PROFILE
/PRINT SOLUTION.
*LR+ & LR- as cohort risk estimates. Use file with cells b & c flipped.
*LR+ is estimate for cohort Actual = 1. LR- is estimate for Actual = 2.
DO IF Predicted <> Actual.
RECODE Predicted Actual (1=2) (2=1).
END IF.
CROSSTABS
/TABLES=Predicted BY Actual
/FORMAT=AVALUE NOTABLES
/STATISTICS=RISK.
*Return original codings (flip cells b & c back to original values).
DO IF Predicted <> Actual.
RECODE Predicted Actual (1=2) (2=1).
END IF.
EXECUTE
Related Information
Historical Number
83184
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21483380