Biostat 510
Homework 8
Due Thursday, April 9, 2009
/*Q1: Read in the data and create new variables*/
GET
FILE='C:\Documents and Settings\kwelch\Desktop\b510\afifi.sav'.
DATASET NAME DataSet2 WINDOW=FRONT.
RECODE SURVIVE (3=1) (1=0) INTO DIED.
EXECUTE.
RECODE SURVIVE (3=1) (1=2) INTO DIEDCAT.
EXECUTE.
VALUE LABELS DIEDCAT (1) DIED (2) LIVED.
IF SHOKTYPE = 2 SHOCKDUM=0.
IF SHOKTYPE >2 SHOCKDUM=1.
EXECUTE.
IF SHOKTYPE = 2 SHOCKCAT=2.
IF SHOKTYPE >2 SHOCKCAT=1.
EXECUTE.
VALUE LABELS SHOCKCAT (1) SHOCK (2) NO SHOCK.
IF (UR1=0) URINECAT1=0.
EXECUTE.
IF (UR1>0) URINECAT1=1.
EXECUTE.
format urinecat1 (f1.0).
IF (UR2=0) URINECAT2=0.
EXECUTE.
IF (UR2>0) URINECAT2=1.
EXECUTE.
format urinecat2 (f1.0).
VALUE LABELS SEX (1) MALE (2) FEMALE.
VALUE LABELS SHOKTYPE (2) NON-SHOCK
(3) HYPOVOLEMIC SHOCK
(4) CARDIOGENIC SHOCK
(5) BACTERIAL SHOCK
(6) NEUROGENIC SHOCK
(7) OTHER SHOCK.
/*Q1: Descriptive Statistics*/
DESCRIPTIVES VARIABLES=IDNUM AGE HEIGHT SEX SURVIVE SHOKTYPE SBP1 MAP1 HR1 DBP1 CVP1 BSA1 CI1 APP1
CT1 UR1 PL1 RC1 HGB1 HCT1 CARD1 SBP2 MAP2 HR2 DBP2 CVP2 BSA2 CI2 APP2 CT2 UR2 PL2 RC2 HGB2 HCT2
CARD2 shockdum URINECAT1 URINECAT2 DIED DIEDCAT SHOCKCAT
/STATISTICS=MEAN STDDEV MIN MAX.
/*Q2: Crosstabs SHOCKCAT by DIEDCAT*/
CROSSTABS
/TABLES=SHOCKCAT BY DIEDCAT
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ RISK
/CELLS=COUNT ROW EXPECTED
/COUNT ROUND CELL.
/*Q3: Logistic regression, using SHOKCKDUM to predict DIED*/
LOGISTIC REGRESSION VARIABLES DIED
/METHOD=ENTER shockdum
/PRINT=CI(95)
/CRITERIA=PIN(0.05) POUT(0.10) ITERATE(20) CUT(0.5).
/*Q4: Crosstab SHOKTYPE by DIEDCAT*/
CROSSTABS
/TABLES=SHOKTYPE BY DIEDCAT
/FORMAT=AVALUE TABLES
/STATISTICS=CHISQ
/CELLS=COUNT ROW
/COUNT ROUND CELL.
/*Q5: Logistic regression using SHOKTYPE to predict DIED*/
LOGISTIC REGRESSION VARIABLES DIED
/METHOD=ENTER SHOKTYPE
/CONTRAST (SHOKTYPE)=Indicator(1)
/PRINT=CI(95)
/CRITERIA=PIN(0.05) POUT(0.10) ITERATE(20) CUT(0.5).
/*Q6: Logistic regression using SBP1 to predict DIED*/
LOGISTIC REGRESSION VARIABLES DIED
/METHOD=ENTER SBP1
/PRINT=CI(95)
/CRITERIA=PIN(0.05) POUT(0.10) ITERATE(20) CUT(0.5).
/*Q7: Logistic regression using SBP1 and SHOKTYPE to predict DIED*/
LOGISTIC REGRESSION VARIABLES DIED
/METHOD=ENTER SBP1 SHOKTYPE
/CONTRAST (SHOKTYPE)=Indicator(1)
/PRINT=CI(95)
/CRITERIA=PIN(0.05) POUT(0.10) ITERATE(20) CUT(0.5).
/*Q8: Crosstab between URINECAT1 and URINECAT2*/
CROSSTABS
/TABLES=URINECAT1 BY URINECAT2
/FORMAT=AVALUE TABLES
/STATISTICS=MCNEMAR
/CELLS=COUNT TOTAL
/COUNT ROUND CELL.
/*Q9: BAR CHART WITH MEANS OF DIED BY SHOKTYPE*/
GRAPH
/BAR(SIMPLE)=MEAN(DIED) BY SHOKTYPE.
State the alpha level that you are using for any statistical tests carried out for this homework. Don’t forget to include the test statistic, df, and p-value for the results of any statistical tests that you report. Paste all commands for this homework in a syntax window and include this syntax as the first part of your write-up.
I used alpha=.05 for all statistical tests in this homework.
The questions in this homework use the Afifi data set (afifi.sav) which you created for homework 7, or you can download this SPSS data set from my web page (http://www.umich.edu/~kwelch).
1. Create new variables and value labels.
a) DIED = 1 if the person died, 0 if the person lived. This is the variable you will use for logistic regression models.
b) DIEDCAT = 1 if the person died, 2 if the person lived. This is the variable you will use for cross-tabs.
c) SHOCKDUM=1 if the person was in shock (shoktype=3,4,5,6,7), and SHOCKDUM=0 if the person was not in shock (shoktype=2). This variable already exists in the Afifi.sav dataset on the web, but you may need to create it if you're using your own version of the dataset.
d) SHOCKCAT = 1 if the person was in shock (shoktype=3,4,5,6,7), and SHOCKCAT= 2 if the person was not in shock (shoktype=2). This is the variable you will use for cross-tabs.
e) URINECAT1=1 if the person had any urinary output at time 1, and 0 if not.
f) URINECAT2=1 if the person had any urinary output at time 2, and 0 if not.
g) Create value labels for the variables DIEDCAT, SHOCKCAT, SEX, and SHOKTYPE.
h) Get descriptive statistics for all numeric variables in your dataset. Check the sample sizes for each variable to be sure that they match between the original variables and the new variables that you created.
Yes, the numbers match.
i) Include the descriptive statistics table in your write-up.
Descriptive Statistics // N / Minimum / Maximum / Mean / Std. Deviation /
IDNUM / 113 / 340 / 758 / 635.70 / 82.965 /
AGE / 113 / 16 / 90 / 54.63 / 16.597 /
HEIGHT / 112 / 140 / 187 / 164.95 / 9.234 /
SEX / 113 / 1 / 2 / 1.48 / .502 /
SURVIVE / 113 / 1 / 3 / 1.76 / .975 /
SHOKTYPE / 113 / 2 / 7 / 3.94 / 1.697 /
SBP1 / 111 / 26 / 171 / 105.86 / 30.769 /
MAP1 / 113 / 15 / 124 / 73.42 / 22.004 /
HR1 / 113 / 25 / 217 / 104.44 / 29.609 /
DBP1 / 113 / 10 / 108 / 58.53 / 18.541 /
CVP1 / 112 / .2 / 30.2 / 8.915 / 5.7239 /
BSA1 / 111 / 1.09 / 2.25 / 1.6874 / .19310 /
CI1 / 110 / .17 / 7.63 / 2.5705 / 1.48283 /
APP1 / 113 / 2.0 / 26.1 / 10.188 / 4.8900 /
CT1 / 112 / 8.1 / 59.0 / 22.701 / 10.5077 /
UR1 / 113 / 0 / 510 / 54.43 / 112.349 /
PL1 / 112 / 20.7 / 106.6 / 49.029 / 15.0604 /
RC1 / 113 / 10.7 / 85.8 / 21.401 / 8.7313 /
HGB1 / 113 / 6.6 / 18.0 / 11.436 / 2.5389 /
HCT1 / 113 / 20.0 / 54.0 / 34.879 / 7.8056 /
CARD1 / 113 / 1 / 1 / 1.00 / .000 /
SBP2 / 113 / 38 / 182 / 110.79 / 37.010 /
MAP2 / 113 / 22 / 117 / 73.21 / 27.083 /
HR2 / 113 / 25 / 221 / 96.39 / 29.648 /
DBP2 / 113 / 16 / 100 / 55.42 / 21.242 /
CVP2 / 113 / .1 / 31.9 / 8.581 / 5.1408 /
BSA2 / 113 / 1.09 / 2.25 / 1.6933 / .18782 /
CI2 / 113 / .66 / 7.94 / 2.9355 / 1.33581 /
APP2 / 113 / 1.3 / 23.2 / 9.116 / 4.8930 /
CT2 / 113 / 7.1 / 54.6 / 20.273 / 9.8013 /
UR2 / 113 / 0 / 850 / 77.52 / 135.985 /
PL2 / 113 / 33.3 / 106.6 / 54.088 / 13.3015 /
RC2 / 113 / 10.5 / 85.8 / 20.642 / 8.5442 /
HGB2 / 113 / 5.9 / 15.5 / 10.535 / 2.0166 /
HCT2 / 113 / 17.0 / 45.0 / 30.474 / 5.7599 /
CARD2 / 113 / 2 / 2 / 2.00 / .000 /
shockdum / 113 / 0 / 1 / .70 / .461 /
URINECAT1 / 113 / 0 / 1 / .57 / .498 /
URINECAT2 / 113 / 0 / 1 / .88 / .331 /
DIED / 113 / .00 / 1.00 / .3805 / .48768 /
DIEDCAT / 113 / 1.00 / 2.00 / 1.6195 / .48768 /
SHOCKCAT / 113 / 1.00 / 2.00 / 1.3009 / .46069 /
Valid N (listwise) / 104
2. Create a cross-tab between SHOCKCAT and DIEDCAT. Remember, SHOCKCAT is the risk factor, and DIEDCAT is the outcome, get the counts (they are included by default), the expected counts, and the row percentages, a Chi-square test and the relative risk and odds ratio.
a) What percentage of those patients who were in shock died? What percentage of those patients not in shock died?
50.6% of patients in shock died, while 8.8% of patients not in shock died.
b) Carry out a chi-square test of whether being in shock is independent of dying, and report the results of your test. (Use the Pearson chi-square test results).
The Pearson chi-square test statistic = 17.626, df=1, p < 0.001.
c) What is the risk ratio of dying, for a patient who was in shock compared to a patient who was not in shock? Include the risk ratio and the 95% confidence interval calculated by SPSS.
The risk ratio of dying for patients in shock, compared to patients not in shock is 5.738, with 95% CI =1.906 to 17.278.
d) What is the Odds Ratio of dying, for a patient who was in shock compared to a patient who was not in shock? Please include the odds ratio and the 95% confidence interval calculated by SPSS.
The odds ratio of dying for patients in shock, compared to patients not in shock is 10.598. wotj 05% CI=2.993 to 37.532.
e) Include the output from this cross-tab in your write-up.
SHOCKCAT * DIEDCAT Crosstabulation // DIEDCAT /
/ DIED / LIVED / Total /
SHOCKCAT / SHOCK / Count / 40 / 39 / 79 /
Expected Count / 30.1 / 48.9 / 79.0 /
% within SHOCKCAT / 50.6% / 49.4% / 100.0% /
NO SHOCK / Count / 3 / 31 / 34 /
Expected Count / 12.9 / 21.1 / 34.0 /
% within SHOCKCAT / 8.8% / 91.2% / 100.0% /
Total / Count / 43 / 70 / 113 /
Expected Count / 43.0 / 70.0 / 113.0 /
% within SHOCKCAT / 38.1% / 61.9% / 100.0%
Chi-Square Tests /
/ Value / df / Asymp. Sig. (2-sided) / Exact Sig. (2-sided) / Exact Sig. (1-sided) /
Pearson Chi-Square / 17.626a / 1 / .000 /
Continuity Correctionb / 15.897 / 1 / .000 /
Likelihood Ratio / 20.339 / 1 / .000 /
Fisher's Exact Test / .000 / .000 /
Linear-by-Linear Association / 17.470 / 1 / .000 /
N of Valid Cases / 113 /
a. 0 cells (.0%) have expected count less than 5. The minimum expected count is 12.94. /
b. Computed only for a 2x2 table
Risk Estimate /
/ Value / 95% Confidence Interval /
/ Lower / Upper /
Odds Ratio for SHOCKCAT (SHOCK / NO SHOCK) / 10.598 / 2.993 / 37.532 /
For cohort DIEDCAT = DIED / 5.738 / 1.906 / 17.278 /
For cohort DIEDCAT = LIVED / .541 / .423 / .693 /
N of Valid Cases / 113
3. Fit a logistic regression model, with DIED (the 0,1 variable) as the dependent variable, and SHOCKDUM (the 0,1 variable) as the predictor.
a) How many observations are included in the logistic regression model? What is the pseudo R-square for this model? (Report the Nagelkerke R-square.)
There are 113 observations in this model. The Nagelkerke pseudo R-square is 0.224 for this model.
b) Report the odds ratio of dying for those in shock compared to those not in shock, along with the 95% CI from this logistic regression model. Do these values agree with the Odds Ratio and 95% CI from the cross-tab in Question 2 above?
The odds ratio of dying for those in shock compared to those not in shock is 10.598, with 95% CI equal to 2.993 to 37.532. This is the same as in the cross-tabulation.
c) Is there a significant relationship between being in shock and dying? Report the Wald test chi-square, df, and p-value for this test.
Yes, there is a significant relationship between being in shock and dying, Wald chi-square = 13.389, df=1, p<0.001.
d) Include the following tables from the Logistic Regression output in your write-up: Case Processing Summary, Omnibus Test of Model Coefficients, Model Summary, and Variables in the Equation.
Case Processing Summary /Unweighted Casesa / N / Percent /
Selected Cases / Included in Analysis / 113 / 100.0 /
Missing Cases / 0 / .0 /
Total / 113 / 100.0 /
Unselected Cases / 0 / .0 /
Total / 113 / 100.0 /
a. If weight is in effect, see classification table for the total number of cases.
Omnibus Tests of Model Coefficients /
/ Chi-square / df / Sig. /
Step 1 / Step / 20.339 / 1 / .000 /
Block / 20.339 / 1 / .000 /
Model / 20.339 / 1 / .000
Model Summary /
Step / -2 Log likelihood / Cox & Snell R Square / Nagelkerke R Square /
1 / 129.798a / .165 / .224 /
a. Estimation terminated at iteration number 5 because parameter estimates changed by less than .001.
Variables in the Equation /
/ B / S.E. / Wald / df / Sig. / Exp(B) / 95.0% C.I.for EXP(B) /
/ Lower / Upper /
Step 1 / shockdum / 2.361 / .645 / 13.389 / 1 / .000 / 10.598 / 2.993 / 37.532 /
Constant / -2.335 / .605 / 14.918 / 1 / .000 / .097
4. Create a cross-tab between SHOKTYPE (the variable with 6 categories) and DIEDCAT, get a chi-square test of independence, row percents and expected values for this table.
a) Is there a significant relationship between SHOKTYPE and whether the patient died?
Yes there is a relationship between SHOKTYPE and whether the person died or not, Pearson Chi-square = 21.197, df=5, p=.001.
b) Include the output from this cross-tab in your write-up.
SHOKTYPE * DIEDCAT Crosstabulation // DIEDCAT /
/ DIED / LIVED / Total /
SHOKTYPE / NON-SHOCK / Count / 3 / 31 / 34 /
% within SHOKTYPE / 8.8% / 91.2% / 100.0% /
HYPOVOLEMIC SHOCK / Count / 10 / 7 / 17 /
% within SHOKTYPE / 58.8% / 41.2% / 100.0% /
CARDIOGENIC SHOCK / Count / 10 / 10 / 20 /
% within SHOKTYPE / 50.0% / 50.0% / 100.0% /
BACTERIAL SHOCK / Count / 6 / 10 / 16 /
% within SHOKTYPE / 37.5% / 62.5% / 100.0% /
NEUROGENIC SHOCK / Count / 7 / 9 / 16 /
% within SHOKTYPE / 43.8% / 56.2% / 100.0% /
OTHER SHOCK / Count / 7 / 3 / 10 /
% within SHOKTYPE / 70.0% / 30.0% / 100.0% /
Total / Count / 43 / 70 / 113 /
% within SHOKTYPE / 38.1% / 61.9% / 100.0%
Chi-Square Tests /
/ Value / df / Asymp. Sig. (2-sided) /
Pearson Chi-Square / 21.197a / 5 / .001 /
Likelihood Ratio / 23.765 / 5 / .000 /
Linear-by-Linear Association / 9.975 / 1 / .002 /
N of Valid Cases / 113
a. 1 cells (8.3%) have expected count less than 5. The minimum expected count is 3.81.
5. Fit a logistic regression model with DIED as the dependent variable and SHOKTYPE as the Categorical predictor.
a) You will need to include SHOKTYPE as a categorical predictor. Use SHOKTYPE=2 (the first category for this variable) as the reference category.