From 13a9a8d389e9387f3b4053a1bf790b59471cdc55 Mon Sep 17 00:00:00 2001 From: Alistair Johnson Date: Wed, 17 May 2017 10:46:04 -0400 Subject: [PATCH] fix GLM to output probabilities for prop score --- notebooks/aline/aline_propensity_score.Rmd | 4 ++-- notebooks/aline/aline_propensity_score.html | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/notebooks/aline/aline_propensity_score.Rmd b/notebooks/aline/aline_propensity_score.Rmd index 283cbfc..5c76cc0 100644 --- a/notebooks/aline/aline_propensity_score.Rmd +++ b/notebooks/aline/aline_propensity_score.Rmd @@ -97,9 +97,9 @@ glm_fitted = glm(aline_flag ~ age + gender + weight_first + # labs bun_first + chloride_first + creatinine_first + hgb_first + platelet_first + potassium_first + - sodium_first + tco2_first + wbc_first, data=dataset, na.action = na.exclude) + sodium_first + tco2_first + wbc_first, data=dataset, family="binomial", na.action = na.exclude) -X <- fitted(glm_fitted) +X <- fitted(glm_fitted, type="response") y <- dataset$day_28_flag Tr <- dataset$aline_flag diff --git a/notebooks/aline/aline_propensity_score.html b/notebooks/aline/aline_propensity_score.html index 8d85599..e603f37 100644 --- a/notebooks/aline/aline_propensity_score.html +++ b/notebooks/aline/aline_propensity_score.html @@ -166,9 +166,9 @@

May 15, 2017

# labs bun_first + chloride_first + creatinine_first + hgb_first + platelet_first + potassium_first + - sodium_first + tco2_first + wbc_first, data=dataset, na.action = na.exclude) + sodium_first + tco2_first + wbc_first, data=dataset, family="binomial", na.action = na.exclude) -X <- fitted(glm_fitted) +X <- fitted(glm_fitted, type="response") y <- dataset$day_28_flag Tr <- dataset$aline_flag @@ -189,9 +189,9 @@

May 15, 2017

outcome <- data.frame(aline_pt=dat[ps$index.treated,"hosp_exp_flag"], match_pt=dat[ps$index.control,"hosp_exp_flag"]) head(outcome)
##   aline_pt match_pt
-## 1        0        1
+## 1        1        1
 ## 2        0        0
-## 3        0        0
+## 3        1        0
 ## 4        0        0
 ## 5        0        0
 ## 6        0        0
@@ -200,18 +200,18 @@

May 15, 2017

tab.match1
##      Matched Control
 ## Aline   0   1
-##     0 573 100
-##     1  90  11
+## 0 564 93 +## 1 86 13
tab.match1[1,2]/tab.match1[2,1]
-
## [1] 1.111111
+
## [1] 1.081395
paste("95% Confint", round(exp(c(log(tab.match1[2,1]/tab.match1[1,2]) - qnorm(0.975)*sqrt(1/tab.match1[1,2] +1/tab.match1[2,1]),log(tab.match1[2,1]/tab.match1[1,2]) + qnorm(0.975)*sqrt(1/tab.match1[1,2] +1/tab.match1[2,1])) ),2))
-
## [1] "95% Confint 0.68" "95% Confint 1.2"
+
## [1] "95% Confint 0.69" "95% Confint 1.24"
mcnemar.test(tab.match1) # for 1-1 pairs
## 
 ##  McNemar's Chi-squared test with continuity correction
 ## 
 ## data:  tab.match1
-## McNemar's chi-squared = 0.42632, df = 1, p-value = 0.5138
+## McNemar's chi-squared = 0.20112, df = 1, p-value = 0.6538

The above p-value, which is > 0.05, tells us that we cannot reject the null hypothesis of the aline/non-aline groups having the same mortality rate. Assuming all assumptions of our modelling process are correct, we can infer from this that the use of an indwelling arterial catheter is not associated with a mortality benefit in these patients.