Docsity

Data Analysis of Patient Outcomes Based on Shock Type and SBP1 - Prof. Kathleen B. Welch, Assignments of Biostatistics

Toggle sidebar
bg1
Biostat 510
Homework 5 Key
Due Tuesday, March 17, 2009
options nodate;
OPTIONS FORMCHAR="|----|+|---+=|-/\<>*";
libname b510 "C:\documents and settings\kwelch\Desktop\b510";
/*Q1: Create New Variables*/
data b510.afifi2;
set b510.afifi;
If survive=1 then died =0;
if survive=3 then died =1;
if died =1 then diedcat =1;
if died =0 then diedcat =2;
if shoktype in(3, 4, 5, 6, 7) then shockcat=1;
if shoktype = 2 then shockcat=2;
if ur1 >0 then urinecat1=1;
if ur1=0 then urinecat1=0;
if ur2 >0 then urinecat2=1;
if ur2=0 then urinecat2=0;
run;
proc format;
value sexfmt 1="Male" 2="female";
value shockfmt 2="Non-shock"
3="Hypovolemic"
4="Cardiogenic"
5="Bacterial"
6="Neurogenic"
7="Other";
value diedcatfmt 1="died" 2="lived";
value shockcatfmt 1="In Shock" 2="Not in Shock";
run;
/*Q2: Crosstabs*/
proc freq data= b510.afifi2;
tables shockcat*diedcat/chisq relrisk;
format shockcat shockcatfmt. diedcat diedcatfmt.;
run;
/*Q3: Logistic Regression*/
proc logistic data=b510.afifi2 descending;
model died=shockdum/rsquare;
run;
/*Q4: Crosstab between shocktype and diedcat*/
proc freq data= b510.afifi2;
tables shoktype*diedcat/chisq ;
format shoktype shockfmt. diedcat diedcatfmt.;
run;
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Data Analysis of Patient Outcomes Based on Shock Type and SBP1 - Prof. Kathleen B. Welch and more Assignments Biostatistics in PDF only on Docsity!

Biostat 510

Homework 5 Key

Due Tuesday, March 17, 2009

options nodate;

OPTIONS FORMCHAR="|----|+|---+=|-/<>*";

libname b510 "C:\documents and settings\kwelch\Desktop\b510";

/Q1: Create New Variables/

data b510.afifi2;

set b510.afifi;

If survive=1 then died =0;

if survive=3 then died =1;

if died =1 then diedcat =1;

if died =0 then diedcat =2;

if shoktype in(3, 4, 5, 6, 7) then shockcat=1;

if shoktype = 2 then shockcat=2;

if ur1 >0 then urinecat1=1;

if ur1=0 then urinecat1=0;

if ur2 >0 then urinecat2=1;

if ur2=0 then urinecat2=0;

run;

proc format;

value sexfmt 1="Male" 2="female";

value shockfmt 2="Non-shock"

3="Hypovolemic"

4="Cardiogenic"

5="Bacterial"

6="Neurogenic"

7="Other";

value diedcatfmt 1="died" 2="lived";

value shockcatfmt 1="In Shock" 2="Not in Shock";

run;

/Q2: Crosstabs/

proc freq data= b510.afifi2;

tables shockcat*diedcat/chisq relrisk;

format shockcat shockcatfmt. diedcat diedcatfmt.;

run;

/Q3: Logistic Regression/

proc logistic data=b510.afifi2 descending;

model died=shockdum/rsquare;

run;

/Q4: Crosstab between shocktype and diedcat/

proc freq data= b510.afifi2;

tables shoktype*diedcat/chisq ;

format shoktype shockfmt. diedcat diedcatfmt.;

run;

/Q5: Logistic Regression with shoktype as a categorical predictor/

proc logistic data=b510.afifi2 descending;

class shoktype(ref="2") /param=ref;

model died=shoktype/rsquare;

output out=outdat p=predict; /Extra Credit for this part/

run;

/Extra Credit for this part/

proc freq data=outdat;

tables shoktype*predict/list;

format predict 10.4;

run;

/Q6: Logistic regression with SBP1 as a continuous predictor/

proc logistic data=b510.afifi2 descending;

model died=sbp1/rsquare;

run;

/Q6: Logistic regression with SBP1 and shoktype as predictors/

proc logistic data=b510.afifi2 descending;

class shoktype(ref="2") / param=ref;

model died=sbp1 shoktype/rsquare;

run;

/Q7: Crosstabs for matched data/

proc freq data= b510.afifi2;

tables Urinecat1*urinecat2/agree nocol norow;

run;

/Q8: barchart to show percentage died for each category of shoktype/

proc sgplot data=b510.afifi2;

vbar shoktype/ response=died stat=mean;

format shoktype shockfmt.;

run;

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. I used alpha = 0.05 for all statistical tests. The questions in this homework use the Afifi data set (b510.afifi) which you created for homework 4, or you can download this SAS data set from my web page (http://www.umich.edu/ ~kwelch).

  1. Create new variables and formats. 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.

There is a significant association between being in shock and dying Pearson Chi-square (1df) = 17.63, p<0.0001. 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 SAS. Also, calculate this risk ratio (but not the 95% CI) by hand and include your work. The risk ratio of dying for those in shock compared to those patients not in shock is 4.7383, with 95% CI = (1.91, 17.28). The risk ratio can be calculated by hand as the probability of dying if you are in shock divided by the probability of dying if you are not in shock= .5063/.0882 =5.740. d) Interpret the risk ratio in words. This risk ratio means that the probability of dying if you are in shock is about 5.7 times greater than the probability of dying if you are not in shock. e) 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 SAS. Also, calculate this odds ratio by hand (you don't have to calculate the CI by hand) and show your work. The odds ratio is 10.593, with 95% CI=(2.99,37.53). The odds ratio can be calculated as the odds of dying if you are in shock divided by the odds of dying if you are not in shock = (.5063/.4937)/(.0882/.9118) = 1.0255/.09673 = 10.601. f) Interpret the odds ratio in words. The odds ratio means that the odds of dying for patients who are in shock are about 10.6 times higher than the odds of dying for patients who are not in shock. g) Are the risk ratio and odds ratio similar for this table? Why or why not? No, the odds ratio and risk ratio are not similar. In fact, the odds ratio is about twice as large as the risk ratio. This is because the probability of dying is not rare in both groups. It is about 50% in the shock group, and much less in the non-shock group. h) Include the output from this cross-tab in your write-up. shockcat diedcat Frequency | Percent | Row Pct | Col Pct |died |lived | Total -------------+--------+--------+ In Shock | 40 | 39 | 79 | 35.40 | 34.51 | 69. | 50.63 | 49.37 | | 93.02 | 55.71 | -------------+--------+--------+ Not in Shock | 3 | 31 | 34 | 2.65 | 27.43 | 30. | 8.82 | 91.18 | | 6.98 | 44.29 | -------------+--------+--------+ Total 43 70 113 38.05 61.95 100. Statistics for Table of shockcat by diedcat Statistic DF Value Prob


Chi-Square 1 17.6265 <. Likelihood Ratio Chi-Square 1 20.3389 <. Continuity Adj. Chi-Square 1 15.8975 <. Mantel-Haenszel Chi-Square 1 17.4705 <. Phi Coefficient 0.

Contingency Coefficient 0. Cramer's V 0. Fisher's Exact Test


Cell (1,1) Frequency (F) 40 Left-sided Pr <= F 1. Right-sided Pr >= F 1.142E- Table Probability (P) 1.043E- Two-sided Pr <= P 1.569E- Statistics for Table of shockcat by diedcat Estimates of the Relative Risk (Row1/Row2) Type of Study Value 95% Confidence Limits


Case-Control (Odds Ratio) 10.5983 2.9928 37. Cohort (Col1 Risk) 5.7384 1.9059 17. Cohort (Col2 Risk) 0.5414 0.4231 0. Sample Size = 113

  1. Fit a logistic regression model, with DIED as the dependent variable, and SHOCKDUM 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 max rescaled R-square.) There were 113 observations in this model. The maximum-rescaled pseudo R-square for this model was 0.2241. b) What does SAS say is the event whose probability you’re modeling? We are modeling the probability that died=1. c) 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 from this model is 10.598, with 95% CI= (2.993 to 37.531), which is the same as for the cross-tabs, within rounding error. d) 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, the Wald chi-square test statistic is 13.3888 with 1 df, and p=0.0003. e) Include the output from this logistic regression in your write-up.

43.75% of patients in shock type 6 (neurogenic shock) died 70.00% of patients in shock type 7 (other shock) died. b) Is there a significant relationship between SHOKTYPE and whether the patient died? Yes, there is a significant relationship between SHOKTYPE and whether the patient died, Pearson chi-square test statistic = 21.1971, with 5 df, p=0.0007. c) Include the output from this cross-tab in your write-up. SHOKTYPE diedcat Frequency | Percent | Row Pct | Col Pct |died |lived | Total ------------+--------+--------+ Non-shock | 3 | 31 | 34 | 2.65 | 27.43 | 30. | 8.82 | 91.18 | | 6.98 | 44.29 | ------------+--------+--------+ Hypovolemic | 10 | 7 | 17 | 8.85 | 6.19 | 15. | 58.82 | 41.18 | | 23.26 | 10.00 | ------------+--------+--------+ Cardiogenic | 10 | 10 | 20 | 8.85 | 8.85 | 17. | 50.00 | 50.00 | | 23.26 | 14.29 | ------------+--------+--------+ Bacterial | 6 | 10 | 16 | 5.31 | 8.85 | 14. | 37.50 | 62.50 | | 13.95 | 14.29 | ------------+--------+--------+ Neurogenic | 7 | 9 | 16 | 6.19 | 7.96 | 14. | 43.75 | 56.25 | | 16.28 | 12.86 | ------------+--------+--------+ Other | 7 | 3 | 10 | 6.19 | 2.65 | 8. | 70.00 | 30.00 | | 16.28 | 4.29 | ------------+--------+--------+ Total 43 70 113 38.05 61.95 100. Statistics for Table of SHOKTYPE by diedcat Statistic DF Value Prob


Chi-Square 5 21.1971 0. Likelihood Ratio Chi-Square 5 23.7654 0. Mantel-Haenszel Chi-Square 1 9.9754 0. Phi Coefficient 0. Contingency Coefficient 0. Cramer's V 0. Sample Size = 113

  1. Fit a logistic regression model with DIED as the dependent variable and SHOKTYPE as the predictor.

/Q5: Logistic Regression with shoktype as a categorical predictor/

proc logistic data=b510.afifi2 descending;

class shoktype(ref="2") /param=ref;

model died=shoktype/rsquare;

output out=outdat p=predict; /Extra Credit for this part/

run;

a) You will need to include SHOKTYPE in a class statement in your SAS code. Use SHOKTYPE=2 (non-shock) as the reference category. b) Check to be sure that SHOKTYPE=2 is the reference category for your model. How do you know that you have the correct reference category? We can see that Shoktype=2 is the reference category, because all the dummy variables included for shoktype have a value of zero for Shoktype=2. c) Which categories of SHOKTYPE have significantly different probabilities of dying than the non-shock group (SHOKTYPE=2)? Patients in each of the categories of shock (shoktype=3 through 7) have significantly greater probability of dying than patients not in shock (shoktype=2). For shoktype=3, the Wald chi- square with 1 df = 11.91, p=.0006. For shoktype=4, the Wald chi-sqaure with 1df = 9.64, p=.0019. For shoktype=5, the Wald chi-square with 1df = 5.27, p=.0218. For shoktype=6, the Wald chi-square with 1 df = 7.01, p=.0081. For shoktype=7, the Wald chi-sqaure with 1 df =12.03, p=.0005. d) What is the (maximum rescaled) pseudo R-square for this model? The maximum rescaled pseudo R-square for this model is 0.2580. e) Is there a significant overall relationship between SHOKTYPE and DIED? Report the Global Likelihood Ratio test of Beta=0. Also, report the Wald chi-square test from the table of Type 3 tests. Are these test results similar? Yes, there is a significant overall relationship between SHOKTYPE and DIED. The global Likelihood ratio chi-square test statistic is Ratio is 23.7654 with 5df, and p=0.0002. f) Save the predicted probabilities from this model. What is the predicted probability of dying for each category of shock type? Compare these predicted probabilities with the percentage who died for each shock type in the cross-tab in question 4.

/Extra Credit for this part/

proc freq data=outdat;

tables shoktype*predict/list;

format predict 10.4;

run;

The predicted probabilities of dying for each category of shock type are: SHOKTYPE predict


2 0. 3 0. 4 0. 5 0. 6 0. 7 0. g) Include the output from this logistic regression in your write-up. The LOGISTIC Procedure Model Information

Odds Ratio Estimates Point 95% Wald Effect Estimate Confidence Limits SHOKTYPE 3 vs 2 14.762 3.200 68. SHOKTYPE 4 vs 2 10.333 2.366 45. SHOKTYPE 5 vs 2 6.200 1.305 29. SHOKTYPE 6 vs 2 8.037 1.718 37. SHOKTYPE 7 vs 2 24.111 3.993 145.

  1. Fit a logistic regression model with DIED as the dependent variable and systolic blood pressure at time 1 (SBP1) as the predictor.

/Q6: Logistic regression with SBP1 as a continuous predictor/

proc logistic data=b510.afifi2 descending;

model died=sbp1/rsquare;

run;

a) What is the (maximum rescaled) pseudo R-square for this model? The maximum rescaled pseudo R-square for this model is .1628. b) Interpret the log-odds for SBP1 in this model? Why is it important that this estimated coefficient is negative? (Explain in words what this negative coefficient means). The estimated log odds for SBP1 is -.0261. This means that the log-odds of dying, and hence the probability of dying, decrease for each one-unit increase in SBP1. The importance of this estimate being negative is that having higher SBP1 is protective. c) What is the Odds Ratio for SBP1. i. Interpret this Odds ratio The odds ratio for SBP1 is 0.974, which means that the estimated odds of dying decrease by about 2.6% for each one-unit increase in SBP1. (100*.974 – 100 = 97.4-100 = -2.6%). d) Refit the model, but include SHOKTYPE, and SBP1 both as predictors. e) Is there a significant relationship between SHOKTYPE and the probability of dying in this new model? (look at the type3 test for SHOKTYPE). The relationship between SHOKTYPE and dying is significant in this model, after controlling for SBP1: Wald chi-square test statistic with 5df =11.9418, p= 0.0356. f) Is there a significant relationship between SBP1 and the probability of dying in this new model? (look at the type3 test for SBP1). Yes, there is a significant relationship between SBP1 and dying, after controlling for SHOKTYPE, Wald chi-square test statistic with 1df = 4.8641, p=0.0274. g) Include the output from both models fitted for this question in your write-up. The LOGISTIC Procedure Model Information Data Set B510.AFIFI Response Variable died Number of Response Levels 2 Model binary logit Optimization Technique Fisher's scoring Number of Observations Read 113 Number of Observations Used 111

Response Profile Ordered Total Value died Frequency 1 1 43 2 0 68 Probability modeled is died=1. NOTE: 2 observations were deleted due to missing values for the response or explanatory variables. Model Convergence Status Convergence criterion (GCONV=1E-8) satisfied. Model Fit Statistics Intercept Intercept and Criterion Only Covariates AIC 150.199 138. SC 152.909 143. -2 Log L 148.199 134. R-Square 0.1199 Max-rescaled R-Square 0. Testing Global Null Hypothesis: BETA= Test Chi-Square DF Pr > ChiSq Likelihood Ratio 14.1814 1 0. Score 13.4150 1 0. Wald 11.9840 1 0. Analysis of Maximum Likelihood Estimates Standard Wald Parameter DF Estimate Error Chi-Square Pr > ChiSq Intercept 1 2.2380 0.7892 8.0416 0. SBP1 1 -0.0261 0.00754 11.9840 0. Odds Ratio Estimates Point 95% Wald Effect Estimate Confidence Limits SBP1 0.974 0.960 0.

/Q6: Logistic regression with SBP1 and shoktype as predictors/

proc logistic data=b510.afifi2 descending;

class shoktype(ref="2") / param=ref;

model died=sbp1 shoktype/rsquare;

run;

Model Information Data Set B510.AFIFI Response Variable died Number of Response Levels 2 Model binary logit Optimization Technique Fisher's scoring Number of Observations Read 113 Number of Observations Used 111 Response Profile

SHOKTYPE 4 vs 2 7.570 1.614 35. SHOKTYPE 5 vs 2 3.476 0.679 17. SHOKTYPE 6 vs 2 4.602 0.907 23. SHOKTYPE 7 vs 2 17.111 2.685 109.

  1. Create a cross-tab with URINECAT1 as the row variable and URINECAT2 as the column variable. Include only the total percentages for this table, and not the row percents and column percents. a) What percentage of patients had any urinary output at time 1? 56.64% had any urinary output at time 1 (Urinecat1 = 1). b) What percentage of patients had any urinary output at time 2? 87.61% had any urinary output at time 2 (Urinecat2=1). c) Carry out a statistical test appropriate for matched data to compare the percentage of patients with any urinary output at time 1 with the percentage of patients with any urinary output at time 2. i. Report the results of your test. The appropriate statistical test for matched data is McNemar's test. The McNemar's chi-square test statistic is 34.4, with 1 df, p<0.0001. ii. What do you conclude from this test? Please explain your results, don't just say if they are significant or not. There was a significant increase in the percentage of patients who had any urinary output from time 1 to time 2 (the percentage increased from 56.6% to 87.6%). d) Include the cross-tab for this question in your write-up. Table of urinecat1 by urinecat urinecat1 urinecat Frequency| Percent | 0| 1| Total ---------+--------+--------+ 0 | 12 | 37 | 49 | 10.62 | 32.74 | 43. ---------+--------+--------+ 1 | 2 | 62 | 64 | 1.77 | 54.87 | 56. ---------+--------+--------+ Total 14 99 113 12.39 87.61 100. Statistics for Table of urinecat1 by urinecat McNemar's Test

Statistic (S) 31. DF 1 Pr > S <. Sample Size = 113

  1. Extra Credit: Create a bar chart showing the Mean of DIED for each level of SHOKTYPE. Include this bar chart in your write-up (don't put error bars on this chart). Interpret this bar chart. Include the printout of your SAS commands in your write-up. You will be graded on your SAS commands, the output and its appearance, and your interpretation.