rm(list=ls())


# Load libraries ---------------------------

library(foreign)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
# Set wd for generated output ---------------------------
setwd("/Volumes/caas/CMHIV/WISE/AK-R-output")


# Load data ---------------------------

load(file="table1.RData")
options(na.action='na.pass')


# Obtain outcomes with correct 0-1 coding ---------------------------
# see https://stackoverflow.com/questions/38678378/factor-levels-default-to-1-and-2-in-r-dummy-variable

## smoking plans

vuln_dt$scrn7r_b
##   [1] plans to not smoke plans to not smoke plans to not smoke
##   [4] plans to smoke     plans to smoke     plans to not smoke
##   [7] plans to smoke     plans to smoke     plans to not smoke
##  [10] plans to not smoke plans to smoke     plans to not smoke
##  [13] plans to not smoke plans to smoke     plans to smoke    
##  [16] plans to smoke     plans to not smoke plans to not smoke
##  [19] plans to not smoke plans to not smoke plans to not smoke
##  [22] plans to smoke     plans to not smoke plans to smoke    
##  [25] plans to not smoke plans to not smoke plans to not smoke
##  [28] plans to not smoke plans to not smoke plans to not smoke
##  [31] plans to not smoke plans to smoke     plans to not smoke
##  [34] plans to not smoke plans to not smoke plans to not smoke
##  [37] plans to not smoke plans to not smoke plans to not smoke
##  [40] plans to smoke     plans to not smoke plans to not smoke
##  [43] plans to smoke     plans to smoke     plans to not smoke
##  [46] plans to not smoke plans to not smoke plans to not smoke
##  [49] plans to smoke     plans to not smoke plans to smoke    
##  [52] plans to smoke     plans to not smoke plans to not smoke
##  [55] plans to smoke     plans to smoke     plans to not smoke
##  [58] plans to smoke     plans to not smoke plans to smoke    
##  [61] plans to not smoke plans to not smoke plans to smoke    
##  [64] plans to not smoke plans to not smoke plans to not smoke
##  [67] plans to smoke     plans to smoke     plans to smoke    
##  [70] plans to not smoke plans to not smoke plans to smoke    
##  [73] plans to not smoke plans to not smoke plans to smoke    
##  [76] plans to smoke     plans to not smoke plans to smoke    
##  [79] plans to not smoke plans to not smoke plans to smoke    
##  [82] plans to not smoke plans to not smoke plans to smoke    
##  [85] plans to smoke     plans to smoke     plans to not smoke
##  [88] plans to not smoke plans to smoke     plans to not smoke
##  [91] plans to smoke     plans to smoke     plans to not smoke
##  [94] plans to smoke     plans to not smoke plans to smoke    
##  [97] plans to smoke     plans to not smoke plans to smoke    
## [100] plans to smoke     plans to not smoke plans to smoke    
## [103] plans to not smoke plans to not smoke plans to smoke    
## [106] plans to smoke     plans to not smoke plans to not smoke
## [109] plans to not smoke plans to not smoke plans to not smoke
## [112] plans to smoke     plans to not smoke plans to smoke    
## [115] plans to not smoke plans to not smoke plans to not smoke
## [118] plans to smoke     plans to smoke     plans to smoke    
## [121] plans to smoke     plans to smoke     plans to not smoke
## [124] plans to not smoke plans to smoke     plans to smoke    
## [127] plans to not smoke plans to smoke     plans to not smoke
## [130] plans to smoke     plans to smoke     plans to smoke    
## [133] plans to not smoke plans to not smoke plans to not smoke
## [136] plans to not smoke plans to not smoke plans to smoke    
## [139] plans to not smoke plans to smoke     plans to not smoke
## [142] plans to smoke     plans to smoke     plans to not smoke
## [145] plans to smoke     plans to not smoke plans to smoke    
## [148] plans to not smoke plans to smoke     plans to not smoke
## [151] plans to not smoke plans to smoke     plans to not smoke
## [154] plans to smoke     plans to not smoke plans to not smoke
## [157] plans to smoke     plans to not smoke plans to smoke    
## [160] plans to not smoke plans to not smoke plans to smoke    
## [163] plans to smoke     plans to smoke     plans to smoke    
## [166] plans to smoke     plans to smoke     plans to smoke    
## [169] plans to smoke     plans to smoke     plans to smoke    
## [172] plans to not smoke plans to not smoke plans to not smoke
## [175] plans to not smoke plans to not smoke plans to smoke    
## [178] plans to not smoke plans to not smoke plans to smoke    
## [181] plans to smoke     plans to smoke     plans to smoke    
## [184] <NA>               plans to smoke     plans to not smoke
## [187] plans to smoke     plans to smoke     plans to smoke    
## [190] plans to smoke     plans to not smoke plans to smoke    
## [193] plans to smoke     plans to smoke     plans to not smoke
## [196] plans to smoke     plans to smoke     plans to not smoke
## [199] plans to smoke     plans to smoke     plans to smoke    
## [202] plans to smoke     plans to smoke     plans to smoke    
## [205] plans to smoke     plans to not smoke plans to smoke    
## [208] plans to smoke     plans to smoke     plans to smoke    
## [211] plans to not smoke plans to not smoke plans to smoke    
## [214] plans to not smoke plans to smoke     plans to smoke    
## [217] plans to smoke     plans to smoke     plans to smoke    
## [220] plans to not smoke plans to not smoke plans to smoke    
## [223] plans to not smoke plans to smoke     plans to not smoke
## [226] plans to not smoke plans to smoke     plans to smoke    
## [229] plans to smoke     plans to smoke     plans to smoke    
## [232] plans to smoke     plans to not smoke plans to not smoke
## [235] plans to smoke     plans to smoke     plans to not smoke
## [238] plans to not smoke plans to smoke     plans to smoke    
## [241] plans to not smoke plans to not smoke plans to not smoke
## [244] plans to smoke     plans to smoke     plans to smoke    
## [247] plans to smoke    
## Levels: plans to smoke plans to not smoke
levels(vuln_dt$scrn7r_b)
## [1] "plans to smoke"     "plans to not smoke"
str(vuln_dt$scrn7r_b)
##  Factor w/ 2 levels "plans to smoke",..: 2 2 2 1 1 2 1 1 2 2 ...
storage.mode(vuln_dt$scrn7r_b)
## [1] "integer"
as.integer(vuln_dt$scrn7r_b)
##   [1]  2  2  2  1  1  2  1  1  2  2  1  2  2  1  1  1  2  2  2  2  2  1  2  1  2
##  [26]  2  2  2  2  2  2  1  2  2  2  2  2  2  2  1  2  2  1  1  2  2  2  2  1  2
##  [51]  1  1  2  2  1  1  2  1  2  1  2  2  1  2  2  2  1  1  1  2  2  1  2  2  1
##  [76]  1  2  1  2  2  1  2  2  1  1  1  2  2  1  2  1  1  2  1  2  1  1  2  1  1
## [101]  2  1  2  2  1  1  2  2  2  2  2  1  2  1  2  2  2  1  1  1  1  1  2  2  1
## [126]  1  2  1  2  1  1  1  2  2  2  2  2  1  2  1  2  1  1  2  1  2  1  2  1  2
## [151]  2  1  2  1  2  2  1  2  1  2  2  1  1  1  1  1  1  1  1  1  1  2  2  2  2
## [176]  2  1  2  2  1  1  1  1 NA  1  2  1  1  1  1  2  1  1  1  2  1  1  2  1  1
## [201]  1  1  1  1  1  2  1  1  1  1  2  2  1  2  1  1  1  1  1  2  2  1  2  1  2
## [226]  2  1  1  1  1  1  1  2  2  1  1  2  2  1  1  2  2  2  1  1  1  1
scrn7r_b.out <- as.numeric(model.matrix(~vuln_dt$scrn7r_b)[,2]) #key step
length(scrn7r_b.out)
## [1] 247
length(vuln_dt$scrn7r_b)
## [1] 247
xtabs(~factor(vuln_dt$scrn7r_b) + factor(scrn7r_b.out))
##                         factor(scrn7r_b.out)
## factor(vuln_dt$scrn7r_b)   0   1
##       plans to smoke     126   0
##       plans to not smoke   0 120
## quit status 
vuln_dt$Final_QuitStatus
##   [1] Smoking         Quit at 3 weeks Smoking         Smoking        
##   [5] Smoking         Smoking         Smoking         Smoking        
##   [9] Smoking         Smoking         Smoking         Smoking        
##  [13] Smoking         Quit at 3 weeks Smoking         Smoking        
##  [17] Smoking         Smoking         Quit at 3 weeks Smoking        
##  [21] Smoking         Smoking         Smoking         Smoking        
##  [25] Smoking         Smoking         Smoking         Smoking        
##  [29] Smoking         Smoking         Smoking         Smoking        
##  [33] Smoking         Quit at 3 weeks Quit at 3 weeks Quit at 3 weeks
##  [37] Smoking         Smoking         Smoking         Smoking        
##  [41] Smoking         Smoking         Smoking         Smoking        
##  [45] Smoking         Quit at 3 weeks Smoking         Smoking        
##  [49] Smoking         Smoking         Smoking         Smoking        
##  [53] Quit at 3 weeks Quit at 3 weeks Smoking         Smoking        
##  [57] Smoking         Smoking         Smoking         Quit at 3 weeks
##  [61] Smoking         Smoking         Smoking         Quit at 3 weeks
##  [65] Quit at 3 weeks Smoking         Smoking         Smoking        
##  [69] Smoking         Smoking         Smoking         Smoking        
##  [73] Smoking         Smoking         Smoking         Smoking        
##  [77] Smoking         Smoking         Smoking         Smoking        
##  [81] Smoking         Smoking         Quit at 3 weeks Smoking        
##  [85] Smoking         Quit at 3 weeks Smoking         Smoking        
##  [89] Quit at 3 weeks Smoking         Smoking         Smoking        
##  [93] Smoking         Smoking         Smoking         Smoking        
##  [97] Smoking         Smoking         Smoking         Smoking        
## [101] Quit at 3 weeks Smoking         Smoking         Quit at 3 weeks
## [105] Quit at 3 weeks Smoking         Smoking         Smoking        
## [109] Smoking         Smoking         Smoking         Smoking        
## [113] Smoking         Smoking         Smoking         Smoking        
## [117] Smoking         Smoking         Smoking         Smoking        
## [121] Smoking         Smoking         Smoking         Smoking        
## [125] Smoking         Smoking         Quit at 3 weeks Smoking        
## [129] Smoking         Smoking         Smoking         Smoking        
## [133] Quit at 3 weeks Smoking         Quit at 3 weeks Quit at 3 weeks
## [137] Smoking         Smoking         Quit at 3 weeks Smoking        
## [141] Quit at 3 weeks Smoking         Quit at 3 weeks Smoking        
## [145] Smoking         Smoking         Smoking         Smoking        
## [149] Smoking         Smoking         Smoking         Smoking        
## [153] Quit at 3 weeks Smoking         Smoking         Smoking        
## [157] Smoking         Smoking         Smoking         Smoking        
## [161] Smoking         Smoking         Smoking         Quit at 3 weeks
## [165] Smoking         Quit at 3 weeks Smoking         Smoking        
## [169] Smoking         Smoking         Smoking         Smoking        
## [173] Quit at 3 weeks Smoking         Smoking         Smoking        
## [177] Smoking         Smoking         Smoking         Smoking        
## [181] Smoking         Smoking         Quit at 3 weeks Smoking        
## [185] Smoking         Quit at 3 weeks Smoking         Smoking        
## [189] Smoking         Smoking         Smoking         Quit at 3 weeks
## [193] Smoking         Smoking         Smoking         Smoking        
## [197] Smoking         Smoking         Quit at 3 weeks Smoking        
## [201] Smoking         Smoking         Quit at 3 weeks Smoking        
## [205] Smoking         Smoking         Smoking         Smoking        
## [209] Smoking         Smoking         Smoking         Smoking        
## [213] Smoking         Smoking         Smoking         Smoking        
## [217] Smoking         Smoking         Smoking         Smoking        
## [221] Smoking         Smoking         Smoking         Smoking        
## [225] Smoking         Smoking         Quit at 3 weeks Quit at 3 weeks
## [229] Smoking         Smoking         Smoking         Smoking        
## [233] Quit at 3 weeks Quit at 3 weeks Quit at 3 weeks Smoking        
## [237] Smoking         Smoking         Smoking         Smoking        
## [241] Smoking         Quit at 3 weeks Smoking         Smoking        
## [245] Smoking         Smoking         Smoking        
## Levels: Smoking Quit at 3 weeks
vuln_dt$Final_QuitStatus
##   [1] Smoking         Quit at 3 weeks Smoking         Smoking        
##   [5] Smoking         Smoking         Smoking         Smoking        
##   [9] Smoking         Smoking         Smoking         Smoking        
##  [13] Smoking         Quit at 3 weeks Smoking         Smoking        
##  [17] Smoking         Smoking         Quit at 3 weeks Smoking        
##  [21] Smoking         Smoking         Smoking         Smoking        
##  [25] Smoking         Smoking         Smoking         Smoking        
##  [29] Smoking         Smoking         Smoking         Smoking        
##  [33] Smoking         Quit at 3 weeks Quit at 3 weeks Quit at 3 weeks
##  [37] Smoking         Smoking         Smoking         Smoking        
##  [41] Smoking         Smoking         Smoking         Smoking        
##  [45] Smoking         Quit at 3 weeks Smoking         Smoking        
##  [49] Smoking         Smoking         Smoking         Smoking        
##  [53] Quit at 3 weeks Quit at 3 weeks Smoking         Smoking        
##  [57] Smoking         Smoking         Smoking         Quit at 3 weeks
##  [61] Smoking         Smoking         Smoking         Quit at 3 weeks
##  [65] Quit at 3 weeks Smoking         Smoking         Smoking        
##  [69] Smoking         Smoking         Smoking         Smoking        
##  [73] Smoking         Smoking         Smoking         Smoking        
##  [77] Smoking         Smoking         Smoking         Smoking        
##  [81] Smoking         Smoking         Quit at 3 weeks Smoking        
##  [85] Smoking         Quit at 3 weeks Smoking         Smoking        
##  [89] Quit at 3 weeks Smoking         Smoking         Smoking        
##  [93] Smoking         Smoking         Smoking         Smoking        
##  [97] Smoking         Smoking         Smoking         Smoking        
## [101] Quit at 3 weeks Smoking         Smoking         Quit at 3 weeks
## [105] Quit at 3 weeks Smoking         Smoking         Smoking        
## [109] Smoking         Smoking         Smoking         Smoking        
## [113] Smoking         Smoking         Smoking         Smoking        
## [117] Smoking         Smoking         Smoking         Smoking        
## [121] Smoking         Smoking         Smoking         Smoking        
## [125] Smoking         Smoking         Quit at 3 weeks Smoking        
## [129] Smoking         Smoking         Smoking         Smoking        
## [133] Quit at 3 weeks Smoking         Quit at 3 weeks Quit at 3 weeks
## [137] Smoking         Smoking         Quit at 3 weeks Smoking        
## [141] Quit at 3 weeks Smoking         Quit at 3 weeks Smoking        
## [145] Smoking         Smoking         Smoking         Smoking        
## [149] Smoking         Smoking         Smoking         Smoking        
## [153] Quit at 3 weeks Smoking         Smoking         Smoking        
## [157] Smoking         Smoking         Smoking         Smoking        
## [161] Smoking         Smoking         Smoking         Quit at 3 weeks
## [165] Smoking         Quit at 3 weeks Smoking         Smoking        
## [169] Smoking         Smoking         Smoking         Smoking        
## [173] Quit at 3 weeks Smoking         Smoking         Smoking        
## [177] Smoking         Smoking         Smoking         Smoking        
## [181] Smoking         Smoking         Quit at 3 weeks Smoking        
## [185] Smoking         Quit at 3 weeks Smoking         Smoking        
## [189] Smoking         Smoking         Smoking         Quit at 3 weeks
## [193] Smoking         Smoking         Smoking         Smoking        
## [197] Smoking         Smoking         Quit at 3 weeks Smoking        
## [201] Smoking         Smoking         Quit at 3 weeks Smoking        
## [205] Smoking         Smoking         Smoking         Smoking        
## [209] Smoking         Smoking         Smoking         Smoking        
## [213] Smoking         Smoking         Smoking         Smoking        
## [217] Smoking         Smoking         Smoking         Smoking        
## [221] Smoking         Smoking         Smoking         Smoking        
## [225] Smoking         Smoking         Quit at 3 weeks Quit at 3 weeks
## [229] Smoking         Smoking         Smoking         Smoking        
## [233] Quit at 3 weeks Quit at 3 weeks Quit at 3 weeks Smoking        
## [237] Smoking         Smoking         Smoking         Smoking        
## [241] Smoking         Quit at 3 weeks Smoking         Smoking        
## [245] Smoking         Smoking         Smoking        
## Levels: Smoking Quit at 3 weeks
levels(vuln_dt$Final_QuitStatus)
## [1] "Smoking"         "Quit at 3 weeks"
str(vuln_dt$Final_QuitStatus)
##  Factor w/ 2 levels "Smoking","Quit at 3 weeks": 1 2 1 1 1 1 1 1 1 1 ...
storage.mode(vuln_dt$Final_QuitStatus)
## [1] "integer"
as.integer(vuln_dt$Final_QuitStatus)
##   [1] 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1
##  [38] 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 1 1 1 1 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1
##  [75] 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 1 1 1 1
## [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 2 2 1 1 2 1 2 1 2 1 1 1 1 1
## [149] 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1
## [186] 2 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [223] 1 1 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 1 1 2 1 1 1 1 1
Final_QuitStatus.out <- as.numeric(model.matrix(~vuln_dt$Final_QuitStatus)[,2]) #key step
length(Final_QuitStatus.out)
## [1] 247
length(vuln_dt$Final_QuitStatus)
## [1] 247
xtabs(~factor(vuln_dt$Final_QuitStatus) + factor(Final_QuitStatus.out))
##                                 factor(Final_QuitStatus.out)
## factor(vuln_dt$Final_QuitStatus)   0   1
##                  Smoking         207   0
##                  Quit at 3 weeks   0  40
# Control Variable: TRT_Group ---------------------------
vuln_dt$trt_grp
##   [1] Intervention Intervention Control      Intervention Control     
##   [6] Intervention Intervention Control      Control      Control     
##  [11] Control      Intervention Intervention Intervention Control     
##  [16] Control      Control      Control      Control      Control     
##  [21] Intervention Intervention Intervention Intervention Intervention
##  [26] Control      Intervention Control      Intervention Control     
##  [31] Intervention Intervention Intervention Intervention Control     
##  [36] Control      Control      Control      Control      Intervention
##  [41] Intervention Intervention Control      Control      Control     
##  [46] Intervention Control      Control      Intervention Intervention
##  [51] Intervention Control      Intervention Intervention Intervention
##  [56] Control      Control      Intervention Intervention Intervention
##  [61] Control      Control      Control      Intervention Intervention
##  [66] Control      Control      Intervention Control      Control     
##  [71] Intervention Intervention Intervention Control      Intervention
##  [76] Intervention Control      Control      Control      Intervention
##  [81] Control      Control      Intervention Intervention Control     
##  [86] Intervention Intervention Intervention Intervention Control     
##  [91] Control      Control      Control      Control      Intervention
##  [96] Intervention Intervention Intervention Intervention Control     
## [101] Control      Control      Intervention Intervention Intervention
## [106] Intervention Control      Control      Intervention Intervention
## [111] Control      Control      Intervention Intervention Intervention
## [116] Control      Control      Control      Control      Control     
## [121] Intervention Intervention Control      Control      Control     
## [126] Intervention Intervention Control      Control      Control     
## [131] Intervention Intervention Intervention Control      Intervention
## [136] Intervention Control      Intervention Control      Control     
## [141] Intervention Control      Intervention Intervention Control     
## [146] Control      Control      Control      Intervention Intervention
## [151] Control      Control      Control      Control      Intervention
## [156] Control      Intervention Control      Intervention Control     
## [161] Intervention Control      Intervention Intervention Intervention
## [166] Control      Control      Intervention Intervention Intervention
## [171] Intervention Control      Intervention Control      Intervention
## [176] Control      Intervention Control      Control      Control     
## [181] Control      Intervention Intervention Control      Control     
## [186] Control      Intervention Control      Control      Intervention
## [191] Control      Intervention Intervention Control      Intervention
## [196] Control      Control      Intervention Intervention Control     
## [201] Intervention Intervention Control      Intervention Control     
## [206] Control      Control      Intervention Control      Intervention
## [211] Intervention Intervention Control      Control      Intervention
## [216] Control      Control      Intervention Control      Control     
## [221] Intervention Intervention Intervention Control      Control     
## [226] Control      Intervention Intervention Control      Control     
## [231] Intervention Intervention Intervention Intervention Intervention
## [236] Control      Control      Control      Intervention Control     
## [241] Intervention Intervention Control      Control      Control     
## [246] Intervention Control     
## Levels: Control Intervention
# Adjustment variables ---------------------------
drugp1 <- na_if(vuln_dt$drugp1, "Not Applicable")
levels(drugp1)
## [1] "No"               "Yes"              "Don't Know"       "Refuse to Answer"
## [5] "Not Applicable"
# Logistic Regressions (Smoking plans) ---------------------------

outcomes <- cbind(scrn7r_b.out, Final_QuitStatus.out)


## Future Vulnerability

FPV.logreg.scrn7rb <- 
glm(scrn7r_b.out ~ FPV + 
      vuln_dt$trt_grp+
      drugp1+ 
      vuln_dt$smhis1_6m+
      vuln_dt$hispanic+
      vuln_dt$ftnd2, 
    family="binomial",
    na.action = 'na.omit'
)

FPV.logreg.finalquit <- 
  glm(Final_QuitStatus.out ~ FPV + vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2+
        scrn7r_b.out, 
      family="binomial",
      na.action = 'na.omit'
  )

summary(FPV.logreg.scrn7rb)
## 
## Call:
## glm(formula = scrn7r_b.out ~ FPV + vuln_dt$trt_grp + drugp1 + 
##     vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2, family = "binomial", 
##     na.action = "na.omit")
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7336  -1.0083  -0.0002   1.0586   1.8590  
## 
## Coefficients:
##                                       Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                           15.62091 3956.18058   0.004   0.9968  
## FPV                                    0.10165    0.03983   2.552   0.0107 *
## vuln_dt$trt_grpIntervention           -0.10410    0.30054  -0.346   0.7291  
## drugp1Yes                              0.46075    0.30924   1.490   0.1362  
## vuln_dt$smhis1_6mMore than 6 months    0.78532    0.30935   2.539   0.0111 *
## vuln_dt$hispanic                      -0.72153    0.40745  -1.771   0.0766 .
## vuln_dt$ftnd25                         0.07651 4845.25570   0.000   1.0000  
## vuln_dt$ftnd26                         0.11549 5594.88402   0.000   1.0000  
## vuln_dt$ftnd27                        -1.02647 5594.88399   0.000   0.9999  
## vuln_dt$ftnd29                       -35.85612 5594.88400  -0.006   0.9949  
## vuln_dt$ftnd210                      -17.75064 3956.18051  -0.004   0.9964  
## vuln_dt$ftnd211                       -1.02647 5594.88399   0.000   0.9999  
## vuln_dt$ftnd212                        0.15581 5594.88399   0.000   1.0000  
## vuln_dt$ftnd213                      -17.01402 3956.18075  -0.004   0.9966  
## vuln_dt$ftnd215                      -17.74642 3956.18052  -0.004   0.9964  
## vuln_dt$ftnd218                      -34.95051 4184.67742  -0.008   0.9933  
## vuln_dt$ftnd220                      -17.96155 3956.18050  -0.005   0.9964  
## vuln_dt$ftnd221                        0.11549 5594.88402   0.000   1.0000  
## vuln_dt$ftnd222                      -16.81283 3956.18069  -0.004   0.9966  
## vuln_dt$ftnd225                      -18.08144 3956.18055  -0.005   0.9964  
## vuln_dt$ftnd228                       -0.92482 5594.88399   0.000   0.9999  
## vuln_dt$ftnd230                      -17.36596 3956.18052  -0.004   0.9965  
## vuln_dt$ftnd233                      -35.01664 5594.88402  -0.006   0.9950  
## vuln_dt$ftnd235                      -17.87687 3956.18063  -0.005   0.9964  
## vuln_dt$ftnd238                      -34.98878 5594.88402  -0.006   0.9950  
## vuln_dt$ftnd240                      -17.51812 3956.18052  -0.004   0.9965  
## vuln_dt$ftnd245                      -34.54468 4841.67990  -0.007   0.9943  
## vuln_dt$ftnd260                        0.04674 4258.96462   0.000   1.0000  
## vuln_dt$ftnd290                       -0.34526 5594.88401   0.000   1.0000  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 322.66  on 232  degrees of freedom
## Residual deviance: 261.40  on 204  degrees of freedom
##   (14 observations deleted due to missingness)
## AIC: 319.4
## 
## Number of Fisher Scoring iterations: 16
summary(FPV.logreg.finalquit)
## 
## Call:
## glm(formula = Final_QuitStatus.out ~ FPV + vuln_dt$trt_grp + 
##     drugp1 + vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2 + 
##     scrn7r_b.out, family = "binomial", na.action = "na.omit")
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.86779  -0.56513  -0.31000  -0.00013   2.94720  
## 
## Coefficients:
##                                       Estimate Std. Error z value Pr(>|z|)   
## (Intercept)                           13.06749 6522.63889   0.002  0.99840   
## FPV                                   -0.01628    0.05233  -0.311  0.75571   
## vuln_dt$trt_grpIntervention            1.59468    0.48706   3.274  0.00106 **
## drugp1Yes                              0.54351    0.47034   1.156  0.24786   
## vuln_dt$smhis1_6mMore than 6 months    1.41618    0.50170   2.823  0.00476 **
## vuln_dt$hispanic                       1.13885    0.55667   2.046  0.04077 * 
## vuln_dt$ftnd25                       -34.56024 7987.22375  -0.004  0.99655   
## vuln_dt$ftnd26                       -32.39008 9224.40412  -0.004  0.99720   
## vuln_dt$ftnd27                         1.18770 9224.40408   0.000  0.99990   
## vuln_dt$ftnd29                       -33.36532 9224.40412  -0.004  0.99711   
## vuln_dt$ftnd210                      -17.59088 6522.63877  -0.003  0.99785   
## vuln_dt$ftnd211                        1.18770 9224.40408   0.000  0.99990   
## vuln_dt$ftnd212                        0.59235 9224.40408   0.000  0.99995   
## vuln_dt$ftnd213                      -33.63442 7941.80779  -0.004  0.99662   
## vuln_dt$ftnd215                      -17.52327 6522.63878  -0.003  0.99786   
## vuln_dt$ftnd218                      -16.13871 6522.63885  -0.002  0.99803   
## vuln_dt$ftnd220                      -17.25088 6522.63876  -0.003  0.99789   
## vuln_dt$ftnd221                      -32.39008 9224.40412  -0.004  0.99720   
## vuln_dt$ftnd222                      -17.27267 6522.63889  -0.003  0.99789   
## vuln_dt$ftnd225                      -34.67321 6745.87661  -0.005  0.99590   
## vuln_dt$ftnd228                      -35.96072 9224.40408  -0.004  0.99689   
## vuln_dt$ftnd230                      -18.10693 6522.63880  -0.003  0.99779   
## vuln_dt$ftnd233                      -31.34051 9224.40415  -0.003  0.99729   
## vuln_dt$ftnd235                      -16.06195 6522.63887  -0.002  0.99804   
## vuln_dt$ftnd238                      -32.88693 9224.40414  -0.004  0.99716   
## vuln_dt$ftnd240                      -17.76466 6522.63878  -0.003  0.99783   
## vuln_dt$ftnd245                      -33.15972 7760.43911  -0.004  0.99659   
## vuln_dt$ftnd260                      -35.24758 6981.12038  -0.005  0.99597   
## vuln_dt$ftnd290                      -32.93359 9224.40411  -0.004  0.99715   
## scrn7r_b.out                           1.04957    0.48004   2.186  0.02879 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 207.26  on 232  degrees of freedom
## Residual deviance: 144.19  on 203  degrees of freedom
##   (14 observations deleted due to missingness)
## AIC: 204.19
## 
## Number of Fisher Scoring iterations: 17
## Future Precaution

FUTPREC.logreg.scrn7rb <- 
  glm(scrn7r_b.out ~ FUTPREC + 
        vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2, 
      family="binomial",
      na.action = 'na.omit'
  )

FUTPREC.logreg.finalquit <- 
  glm(Final_QuitStatus.out ~ FUTPREC + vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2+
        scrn7r_b.out, 
      family="binomial",
      na.action = 'na.omit'
  )

summary(FUTPREC.logreg.scrn7rb)
## 
## Call:
## glm(formula = scrn7r_b.out ~ FUTPREC + vuln_dt$trt_grp + drugp1 + 
##     vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2, family = "binomial", 
##     na.action = "na.omit")
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.62143  -0.99281  -0.00022   1.07350   2.06745  
## 
## Coefficients:
##                                      Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                           15.9950  3956.1805   0.004   0.9968  
## FUTPREC                                0.4325     0.1788   2.419   0.0156 *
## vuln_dt$trt_grpIntervention           -0.2460     0.2974  -0.827   0.4081  
## drugp1Yes                              0.3951     0.3046   1.297   0.1945  
## vuln_dt$smhis1_6mMore than 6 months    0.6318     0.3063   2.063   0.0391 *
## vuln_dt$hispanic                      -0.6515     0.4093  -1.592   0.1115  
## vuln_dt$ftnd25                        -0.7127  4798.7096   0.000   0.9999  
## vuln_dt$ftnd26                        -0.1590  5594.8840   0.000   1.0000  
## vuln_dt$ftnd27                        -0.9399  5594.8839   0.000   0.9999  
## vuln_dt$ftnd29                       -35.8855  5594.8839  -0.006   0.9949  
## vuln_dt$ftnd210                      -18.0692  3956.1804  -0.005   0.9964  
## vuln_dt$ftnd211                       -0.9399  5594.8839   0.000   0.9999  
## vuln_dt$ftnd212                        0.1068  5594.8839   0.000   1.0000  
## vuln_dt$ftnd213                      -17.6901  3956.1807  -0.004   0.9964  
## vuln_dt$ftnd215                      -18.2201  3956.1804  -0.005   0.9963  
## vuln_dt$ftnd218                      -35.1026  4184.9605  -0.008   0.9933  
## vuln_dt$ftnd220                      -18.1778  3956.1804  -0.005   0.9963  
## vuln_dt$ftnd221                        0.9944  5594.8840   0.000   0.9999  
## vuln_dt$ftnd222                      -17.2474  3956.1806  -0.004   0.9965  
## vuln_dt$ftnd225                      -18.0720  3956.1805  -0.005   0.9964  
## vuln_dt$ftnd228                       -0.5074  5594.8839   0.000   0.9999  
## vuln_dt$ftnd230                      -17.5039  3956.1805  -0.004   0.9965  
## vuln_dt$ftnd233                      -35.0028  5594.8840  -0.006   0.9950  
## vuln_dt$ftnd235                      -17.8890  3956.1805  -0.005   0.9964  
## vuln_dt$ftnd238                      -35.9229  5594.8840  -0.006   0.9949  
## vuln_dt$ftnd240                      -17.6356  3956.1805  -0.004   0.9964  
## vuln_dt$ftnd245                      -35.2811  4845.1933  -0.007   0.9942  
## vuln_dt$ftnd260                        0.1066  4247.8417   0.000   1.0000  
## vuln_dt$ftnd290                       -0.5541  5594.8840   0.000   0.9999  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 326.74  on 235  degrees of freedom
## Residual deviance: 266.38  on 207  degrees of freedom
##   (11 observations deleted due to missingness)
## AIC: 324.38
## 
## Number of Fisher Scoring iterations: 16
summary(FUTPREC.logreg.finalquit)
## 
## Call:
## glm(formula = Final_QuitStatus.out ~ FUTPREC + vuln_dt$trt_grp + 
##     drugp1 + vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2 + 
##     scrn7r_b.out, family = "binomial", na.action = "na.omit")
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.88804  -0.55374  -0.29858  -0.00014   3.07147  
## 
## Coefficients:
##                                      Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                           13.2157  6522.6388   0.002 0.998383    
## FUTPREC                               -0.2149     0.2718  -0.791 0.429208    
## vuln_dt$trt_grpIntervention            1.6754     0.4985   3.361 0.000776 ***
## drugp1Yes                              0.6006     0.4689   1.281 0.200265    
## vuln_dt$smhis1_6mMore than 6 months    1.5415     0.5143   2.997 0.002726 ** 
## vuln_dt$hispanic                       1.1721     0.5590   2.097 0.036032 *  
## vuln_dt$ftnd25                       -34.2098  7987.5317  -0.004 0.996583    
## vuln_dt$ftnd26                       -31.9994  9224.4041  -0.003 0.997232    
## vuln_dt$ftnd27                         1.3153  9224.4040   0.000 0.999886    
## vuln_dt$ftnd29                       -33.2792  9224.4041  -0.004 0.997121    
## vuln_dt$ftnd210                      -17.3774  6522.6387  -0.003 0.997874    
## vuln_dt$ftnd211                        1.3153  9224.4040   0.000 0.999886    
## vuln_dt$ftnd212                        0.7439  9224.4040   0.000 0.999936    
## vuln_dt$ftnd213                      -33.1558  7945.7884  -0.004 0.996671    
## vuln_dt$ftnd215                      -17.3456  6522.6387  -0.003 0.997878    
## vuln_dt$ftnd218                      -15.9758  6522.6388  -0.002 0.998046    
## vuln_dt$ftnd220                      -17.0641  6522.6387  -0.003 0.997913    
## vuln_dt$ftnd221                      -32.5724  9224.4041  -0.004 0.997183    
## vuln_dt$ftnd222                      -17.0174  6522.6388  -0.003 0.997918    
## vuln_dt$ftnd225                      -34.6249  6739.7002  -0.005 0.995901    
## vuln_dt$ftnd228                      -36.0317  9224.4040  -0.004 0.996883    
## vuln_dt$ftnd230                      -17.8601  6522.6387  -0.003 0.997815    
## vuln_dt$ftnd233                      -31.0655  9224.4041  -0.003 0.997313    
## vuln_dt$ftnd235                      -16.0341  6522.6388  -0.002 0.998039    
## vuln_dt$ftnd238                      -32.4637  9224.4041  -0.004 0.997192    
## vuln_dt$ftnd240                      -17.5809  6522.6387  -0.003 0.997849    
## vuln_dt$ftnd245                      -32.8030  7739.1968  -0.004 0.996618    
## vuln_dt$ftnd260                      -35.1284  6982.9978  -0.005 0.995986    
## vuln_dt$ftnd290                      -32.6000  9224.4041  -0.004 0.997180    
## scrn7r_b.out                           1.0771     0.4797   2.245 0.024741 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 208.32  on 235  degrees of freedom
## Residual deviance: 144.37  on 206  degrees of freedom
##   (11 observations deleted due to missingness)
## AIC: 204.37
## 
## Number of Fisher Scoring iterations: 17
## Relative Pessimism

RELPESS.logreg.scrn7rb <- 
  glm(scrn7r_b.out ~ RELPESS + 
        vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2, 
      family="binomial",
      na.action = 'na.omit'
  )

RELPESS.logreg.finalquit <- 
  glm(Final_QuitStatus.out ~ RELPESS + vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2+
        scrn7r_b.out, 
      family="binomial",
      na.action = 'na.omit'
  )

summary(RELPESS.logreg.scrn7rb)
## 
## Call:
## glm(formula = scrn7r_b.out ~ RELPESS + vuln_dt$trt_grp + drugp1 + 
##     vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2, family = "binomial", 
##     na.action = "na.omit")
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4963  -1.0576  -0.0002   1.0964   1.8345  
## 
## Coefficients:
##                                       Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                           16.76192 3956.18046   0.004   0.9966  
## RELPESS                                0.11468    0.13522   0.848   0.3964  
## vuln_dt$trt_grpIntervention           -0.15180    0.29090  -0.522   0.6018  
## drugp1Yes                              0.45397    0.30062   1.510   0.1310  
## vuln_dt$smhis1_6mMore than 6 months    0.73962    0.30344   2.437   0.0148 *
## vuln_dt$hispanic                      -0.61990    0.40044  -1.548   0.1216  
## vuln_dt$ftnd25                        -0.23969 4737.36977   0.000   1.0000  
## vuln_dt$ftnd26                         0.46012 5594.88395   0.000   0.9999  
## vuln_dt$ftnd27                        -0.35232 5594.88393   0.000   0.9999  
## vuln_dt$ftnd29                       -35.94207 5594.88393  -0.006   0.9949  
## vuln_dt$ftnd210                      -17.70991 3956.18041  -0.004   0.9964  
## vuln_dt$ftnd211                       -0.58168 5594.88392   0.000   0.9999  
## vuln_dt$ftnd212                        0.72155 5594.88393   0.000   0.9999  
## vuln_dt$ftnd213                      -16.94708 3956.18065  -0.004   0.9966  
## vuln_dt$ftnd215                      -17.84834 3956.18042  -0.005   0.9964  
## vuln_dt$ftnd218                      -35.04495 4198.15927  -0.008   0.9933  
## vuln_dt$ftnd220                      -17.84006 3956.18040  -0.005   0.9964  
## vuln_dt$ftnd221                        0.68947 5594.88396   0.000   0.9999  
## vuln_dt$ftnd222                      -16.79194 3956.18059  -0.004   0.9966  
## vuln_dt$ftnd225                      -17.85450 3956.18045  -0.005   0.9964  
## vuln_dt$ftnd228                       -0.73458 5594.88393   0.000   0.9999  
## vuln_dt$ftnd230                      -17.20060 3956.18043  -0.004   0.9965  
## vuln_dt$ftnd233                      -34.82492 5594.88395  -0.006   0.9950  
## vuln_dt$ftnd235                      -17.70929 3956.18052  -0.004   0.9964  
## vuln_dt$ftnd238                      -35.25874 5594.88395  -0.006   0.9950  
## vuln_dt$ftnd240                      -17.38535 3956.18042  -0.004   0.9965  
## vuln_dt$ftnd245                      -34.77264 4843.47720  -0.007   0.9943  
## vuln_dt$ftnd260                        0.23683 4261.44082   0.000   1.0000  
## vuln_dt$ftnd290                       -0.07031 5594.88394   0.000   1.0000  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 326.74  on 235  degrees of freedom
## Residual deviance: 271.87  on 207  degrees of freedom
##   (11 observations deleted due to missingness)
## AIC: 329.87
## 
## Number of Fisher Scoring iterations: 16
summary(RELPESS.logreg.finalquit)
## 
## Call:
## glm(formula = Final_QuitStatus.out ~ RELPESS + vuln_dt$trt_grp + 
##     drugp1 + vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2 + 
##     scrn7r_b.out, family = "binomial", na.action = "na.omit")
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.79075  -0.53462  -0.28540  -0.00015   2.97047  
## 
## Coefficients:
##                                       Estimate Std. Error z value Pr(>|z|)   
## (Intercept)                           13.40035 6522.63887   0.002  0.99836   
## RELPESS                               -0.20900    0.20268  -1.031  0.30245   
## vuln_dt$trt_grpIntervention            1.58670    0.48662   3.261  0.00111 **
## drugp1Yes                              0.55458    0.46570   1.191  0.23372   
## vuln_dt$smhis1_6mMore than 6 months    1.45174    0.50422   2.879  0.00399 **
## vuln_dt$hispanic                       1.22363    0.56286   2.174  0.02971 * 
## vuln_dt$ftnd25                       -34.46943 7923.60425  -0.004  0.99653   
## vuln_dt$ftnd26                       -32.38516 9224.40412  -0.004  0.99720   
## vuln_dt$ftnd27                         0.73596 9224.40408   0.000  0.99994   
## vuln_dt$ftnd29                       -33.20640 9224.40412  -0.004  0.99713   
## vuln_dt$ftnd210                      -17.68392 6522.63877  -0.003  0.99784   
## vuln_dt$ftnd211                        1.15396 9224.40408   0.000  0.99990   
## vuln_dt$ftnd212                        0.06691 9224.40408   0.000  0.99999   
## vuln_dt$ftnd213                      -33.67382 7921.85910  -0.004  0.99661   
## vuln_dt$ftnd215                      -17.63255 6522.63878  -0.003  0.99784   
## vuln_dt$ftnd218                      -15.98204 6522.63885  -0.002  0.99804   
## vuln_dt$ftnd220                      -17.24266 6522.63876  -0.003  0.99789   
## vuln_dt$ftnd221                      -32.80316 9224.40413  -0.004  0.99716   
## vuln_dt$ftnd222                      -17.24334 6522.63890  -0.003  0.99789   
## vuln_dt$ftnd225                      -34.72789 6742.82788  -0.005  0.99589   
## vuln_dt$ftnd228                      -35.69951 9224.40408  -0.004  0.99691   
## vuln_dt$ftnd230                      -17.98121 6522.63880  -0.003  0.99780   
## vuln_dt$ftnd233                      -31.06075 9224.40415  -0.003  0.99731   
## vuln_dt$ftnd235                      -16.21125 6522.63887  -0.002  0.99802   
## vuln_dt$ftnd238                      -33.06982 9224.40414  -0.004  0.99714   
## vuln_dt$ftnd240                      -17.78915 6522.63878  -0.003  0.99782   
## vuln_dt$ftnd245                      -33.07418 7761.21400  -0.004  0.99660   
## vuln_dt$ftnd260                      -35.26936 6988.72710  -0.005  0.99597   
## vuln_dt$ftnd290                      -32.80041 9224.40411  -0.004  0.99716   
## scrn7r_b.out                           1.04574    0.47637   2.195  0.02815 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 208.32  on 235  degrees of freedom
## Residual deviance: 143.90  on 206  degrees of freedom
##   (11 observations deleted due to missingness)
## AIC: 203.9
## 
## Number of Fisher Scoring iterations: 17
## Current Vulnerability

ropbais5.logreg.scrn7rb <- 
  glm(scrn7r_b.out ~ ropbais5 + 
        vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2,  
      family="binomial",
      na.action = 'na.omit'
  )

ropbais5.logreg.finalquit <- 
  glm(Final_QuitStatus.out ~ ropbais5 + vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2+
        scrn7r_b.out, 
      family="binomial",
      na.action = 'na.omit'
  )

summary(ropbais5.logreg.scrn7rb)
## 
## Call:
## glm(formula = scrn7r_b.out ~ ropbais5 + vuln_dt$trt_grp + drugp1 + 
##     vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2, family = "binomial", 
##     na.action = "na.omit")
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.67318  -0.98262  -0.00018   0.99929   2.05350  
## 
## Coefficients:
##                                       Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                           15.93033 3956.18050   0.004 0.996787    
## ropbais51                              1.06379    0.31536   3.373 0.000743 ***
## ropbais5Don't Know                   -17.08468 3956.18036  -0.004 0.996554    
## vuln_dt$trt_grpIntervention           -0.06408    0.30135  -0.213 0.831608    
## drugp1Yes                              0.53413    0.31311   1.706 0.088028 .  
## vuln_dt$smhis1_6mMore than 6 months    0.75828    0.31168   2.433 0.014980 *  
## vuln_dt$hispanic                      -0.65639    0.41569  -1.579 0.114330    
## vuln_dt$ftnd25                        -0.27516 4807.21115   0.000 0.999954    
## vuln_dt$ftnd26                         0.57195 5594.88398   0.000 0.999918    
## vuln_dt$ftnd27                        -0.65639 5594.88396   0.000 0.999906    
## vuln_dt$ftnd29                       -34.78881 5594.88397  -0.006 0.995039    
## vuln_dt$ftnd210                      -17.18885 3956.18046  -0.004 0.996533    
## vuln_dt$ftnd211                       -0.65639 5594.88396   0.000 0.999906    
## vuln_dt$ftnd212                        1.59792 5594.88396   0.000 0.999772    
## vuln_dt$ftnd213                      -16.36906 3956.18072  -0.004 0.996699    
## vuln_dt$ftnd215                      -17.17000 3956.18047  -0.004 0.996537    
## vuln_dt$ftnd218                      -34.59309 4170.37354  -0.008 0.993382    
## vuln_dt$ftnd220                      -17.39441 3956.18046  -0.004 0.996492    
## vuln_dt$ftnd221                        0.57195 5594.88398   0.000 0.999918    
## vuln_dt$ftnd222                      -16.32785 3956.18064  -0.004 0.996707    
## vuln_dt$ftnd225                      -17.64028 3956.18051  -0.004 0.996442    
## vuln_dt$ftnd228                       -0.65639 5594.88396   0.000 0.999906    
## vuln_dt$ftnd230                      -16.47622 3956.18048  -0.004 0.996677    
## vuln_dt$ftnd233                      -34.56019 5594.88398  -0.006 0.995071    
## vuln_dt$ftnd235                      -17.22744 3956.18059  -0.004 0.996526    
## vuln_dt$ftnd238                      -34.25468 5594.88399  -0.006 0.995115    
## vuln_dt$ftnd240                      -16.75025 3956.18048  -0.004 0.996622    
## vuln_dt$ftnd245                      -34.15343 4777.66914  -0.007 0.994296    
## vuln_dt$ftnd260                        0.69903 4242.60040   0.000 0.999869    
## vuln_dt$ftnd290                        0.03782 5594.88397   0.000 0.999995    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 326.74  on 235  degrees of freedom
## Residual deviance: 259.19  on 206  degrees of freedom
##   (11 observations deleted due to missingness)
## AIC: 319.19
## 
## Number of Fisher Scoring iterations: 16
summary(ropbais5.logreg.finalquit)
## 
## Call:
## glm(formula = Final_QuitStatus.out ~ ropbais5 + vuln_dt$trt_grp + 
##     drugp1 + vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2 + 
##     scrn7r_b.out, family = "binomial", na.action = "na.omit")
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.91272  -0.52983  -0.30110  -0.00013   2.93121  
## 
## Coefficients:
##                                      Estimate Std. Error z value Pr(>|z|)   
## (Intercept)                           13.0947  6522.6388   0.002  0.99840   
## ropbais51                             -0.3580     0.4481  -0.799  0.42432   
## ropbais5Don't Know                   -15.4257  6522.6387  -0.002  0.99811   
## vuln_dt$trt_grpIntervention            1.5705     0.4865   3.228  0.00125 **
## drugp1Yes                              0.5058     0.4664   1.084  0.27821   
## vuln_dt$smhis1_6mMore than 6 months    1.4870     0.5029   2.957  0.00311 **
## vuln_dt$hispanic                       1.1660     0.5618   2.076  0.03794 * 
## vuln_dt$ftnd25                       -34.4379  7988.1176  -0.004  0.99656   
## vuln_dt$ftnd26                       -32.4029  9224.4041  -0.004  0.99720   
## vuln_dt$ftnd27                         1.1660  9224.4040   0.000  0.99990   
## vuln_dt$ftnd29                       -33.6535  9224.4041  -0.004  0.99709   
## vuln_dt$ftnd210                      -17.7728  6522.6387  -0.003  0.99783   
## vuln_dt$ftnd211                        1.1660  9224.4040   0.000  0.99990   
## vuln_dt$ftnd212                        0.1477  9224.4040   0.000  0.99999   
## vuln_dt$ftnd213                      -33.7149  7956.3971  -0.004  0.99662   
## vuln_dt$ftnd215                      -17.7221  6522.6387  -0.003  0.99783   
## vuln_dt$ftnd218                      -16.1808  6522.6388  -0.002  0.99802   
## vuln_dt$ftnd220                      -17.3770  6522.6387  -0.003  0.99787   
## vuln_dt$ftnd221                      -32.4029  9224.4041  -0.004  0.99720   
## vuln_dt$ftnd222                      -17.4164  6522.6388  -0.003  0.99787   
## vuln_dt$ftnd225                      -34.7192  6747.4620  -0.005  0.99589   
## vuln_dt$ftnd228                      -35.9661  9224.4040  -0.004  0.99689   
## vuln_dt$ftnd230                      -18.2821  6522.6387  -0.003  0.99776   
## vuln_dt$ftnd233                      -31.3028  9224.4041  -0.003  0.99729   
## vuln_dt$ftnd235                      -16.1697  6522.6388  -0.002  0.99802   
## vuln_dt$ftnd238                      -33.1477  9224.4041  -0.004  0.99713   
## vuln_dt$ftnd240                      -17.9590  6522.6387  -0.003  0.99780   
## vuln_dt$ftnd245                      -33.2029  7794.2402  -0.004  0.99660   
## vuln_dt$ftnd260                      -35.3656  6985.7003  -0.005  0.99596   
## vuln_dt$ftnd290                      -32.9086  9224.4041  -0.004  0.99715   
## scrn7r_b.out                           1.1001     0.4871   2.258  0.02393 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 208.32  on 235  degrees of freedom
## Residual deviance: 144.28  on 205  degrees of freedom
##   (11 observations deleted due to missingness)
## AIC: 206.28
## 
## Number of Fisher Scoring iterations: 17
## Future Pessimism

OPBIAS4R_2way.logreg.scrn7rb <- 
  glm(scrn7r_b.out ~ OPBIAS4R_2way + 
        vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2, 
      family="binomial",
      na.action = 'na.omit'
  )

OPBIAS4R_2way.logreg.finalquit <- 
  glm(Final_QuitStatus.out ~ OPBIAS4R_2way + vuln_dt$trt_grp+
        drugp1+ 
        vuln_dt$smhis1_6m+
        vuln_dt$hispanic+
        vuln_dt$ftnd2+
        scrn7r_b.out, 
      family="binomial",
      na.action = 'na.omit'
  )

summary(OPBIAS4R_2way.logreg.scrn7rb)
## 
## Call:
## glm(formula = scrn7r_b.out ~ OPBIAS4R_2way + vuln_dt$trt_grp + 
##     drugp1 + vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2, 
##     family = "binomial", na.action = "na.omit")
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.59109  -1.02683  -0.00021   1.08572   1.80243  
## 
## Coefficients:
##                                      Estimate Std. Error z value Pr(>|z|)   
## (Intercept)                           17.0774  3956.1803   0.004  0.99656   
## OPBIAS4R_2way1                         0.2831     0.3184   0.889  0.37396   
## vuln_dt$trt_grpIntervention           -0.1810     0.2953  -0.613  0.53997   
## drugp1Yes                              0.4650     0.3049   1.525  0.12724   
## vuln_dt$smhis1_6mMore than 6 months    0.7886     0.3061   2.576  0.00999 **
## vuln_dt$hispanic                      -0.5839     0.4083  -1.430  0.15264   
## vuln_dt$ftnd25                        -0.3549  4754.7441   0.000  0.99994   
## vuln_dt$ftnd26                         0.4887  5594.8839   0.000  0.99993   
## vuln_dt$ftnd27                        -0.5839  5594.8838   0.000  0.99992   
## vuln_dt$ftnd29                       -35.8971  5594.8838  -0.006  0.99488   
## vuln_dt$ftnd210                      -18.0005  3956.1803  -0.005  0.99637   
## vuln_dt$ftnd211                       -0.5839  5594.8838   0.000  0.99992   
## vuln_dt$ftnd212                        0.4650  5594.8838   0.000  0.99993   
## vuln_dt$ftnd213                      -16.9274  3956.1805  -0.004  0.99659   
## vuln_dt$ftnd215                      -17.8794  3956.1803  -0.005  0.99639   
## vuln_dt$ftnd218                      -35.1042  4195.8621  -0.008  0.99332   
## vuln_dt$ftnd220                      -17.9305  3956.1803  -0.005  0.99638   
## vuln_dt$ftnd221                        0.4887  5594.8839   0.000  0.99993   
## vuln_dt$ftnd222                      -16.9147  3956.1805  -0.004  0.99659   
## vuln_dt$ftnd225                      -17.9793  3956.1803  -0.005  0.99637   
## vuln_dt$ftnd228                       -0.8670  5594.8838   0.000  0.99988   
## vuln_dt$ftnd230                      -17.2898  3956.1803  -0.004  0.99651   
## vuln_dt$ftnd233                      -34.6435  5594.8839  -0.006  0.99506   
## vuln_dt$ftnd235                      -17.7782  3956.1804  -0.004  0.99641   
## vuln_dt$ftnd238                      -35.4321  5594.8839  -0.006  0.99495   
## vuln_dt$ftnd240                      -17.5382  3956.1803  -0.004  0.99646   
## vuln_dt$ftnd245                      -34.8997  4831.5410  -0.007  0.99424   
## vuln_dt$ftnd260                        0.1616  4260.2653   0.000  0.99997   
## vuln_dt$ftnd290                        0.0237  5594.8838   0.000  1.00000   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 321.00  on 231  degrees of freedom
## Residual deviance: 264.71  on 203  degrees of freedom
##   (15 observations deleted due to missingness)
## AIC: 322.71
## 
## Number of Fisher Scoring iterations: 16
summary(OPBIAS4R_2way.logreg.finalquit)
## 
## Call:
## glm(formula = Final_QuitStatus.out ~ OPBIAS4R_2way + vuln_dt$trt_grp + 
##     drugp1 + vuln_dt$smhis1_6m + vuln_dt$hispanic + vuln_dt$ftnd2 + 
##     scrn7r_b.out, family = "binomial", na.action = "na.omit")
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.90923  -0.51967  -0.30496  -0.00014   2.98321  
## 
## Coefficients:
##                                      Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                           12.3929  6522.6387   0.002 0.998484    
## OPBIAS4R_2way1                        -0.8019     0.5104  -1.571 0.116143    
## vuln_dt$trt_grpIntervention            1.7523     0.5073   3.454 0.000552 ***
## drugp1Yes                              0.4872     0.4660   1.045 0.295827    
## vuln_dt$smhis1_6mMore than 6 months    1.4349     0.5141   2.791 0.005252 ** 
## vuln_dt$hispanic                       1.3897     0.5883   2.362 0.018167 *  
## vuln_dt$ftnd25                       -33.8542  7932.7916  -0.004 0.996595    
## vuln_dt$ftnd26                       -32.0679  9224.4040  -0.003 0.997226    
## vuln_dt$ftnd27                         1.3897  9224.4040   0.000 0.999880    
## vuln_dt$ftnd29                       -32.8811  9224.4040  -0.004 0.997156    
## vuln_dt$ftnd210                      -17.1902  6522.6386  -0.003 0.997897    
## vuln_dt$ftnd211                        1.3897  9224.4040   0.000 0.999880    
## vuln_dt$ftnd212                        0.4872  9224.4040   0.000 0.999958    
## vuln_dt$ftnd213                      -33.4582  7924.4311  -0.004 0.996631    
## vuln_dt$ftnd215                      -17.0321  6522.6386  -0.003 0.997917    
## vuln_dt$ftnd218                      -15.4217  6522.6387  -0.002 0.998114    
## vuln_dt$ftnd220                      -16.8310  6522.6386  -0.003 0.997941    
## vuln_dt$ftnd221                      -32.0679  9224.4040  -0.003 0.997226    
## vuln_dt$ftnd222                      -16.3816  6522.6387  -0.003 0.997996    
## vuln_dt$ftnd225                      -34.2734  6731.4338  -0.005 0.995938    
## vuln_dt$ftnd228                      -34.9405  9224.4040  -0.004 0.996978    
## vuln_dt$ftnd230                      -17.4816  6522.6386  -0.003 0.997862    
## vuln_dt$ftnd233                      -30.9590  9224.4040  -0.003 0.997322    
## vuln_dt$ftnd235                      -15.8108  6522.6387  -0.002 0.998066    
## vuln_dt$ftnd238                      -32.3939  9224.4040  -0.004 0.997198    
## vuln_dt$ftnd240                      -17.1661  6522.6386  -0.003 0.997900    
## vuln_dt$ftnd245                      -32.2839  7825.7776  -0.004 0.996708    
## vuln_dt$ftnd260                      -35.1661  6953.8682  -0.005 0.995965    
## vuln_dt$ftnd290                      -32.5551  9224.4040  -0.004 0.997184    
## scrn7r_b.out                           1.1089     0.4943   2.243 0.024866 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 203.61  on 231  degrees of freedom
## Residual deviance: 138.54  on 202  degrees of freedom
##   (15 observations deleted due to missingness)
## AIC: 198.54
## 
## Number of Fisher Scoring iterations: 17
# Save object ---------------------------

save.image(file="table2-adjusted.RData")