rm(list=ls())


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

library(haven)
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
library(magrittr)
library(geeM)
## Loading required package: Matrix
# Read data ---------------------------

gee_nobl_dt <- read_sas("/Volumes/caas/MERITS/RESOURCES/Data Processing/Data Analysis/Outcome Analyses 2016/Manuscript Revisions_2020/Aditya Khanna Analyses 2022/RESOURCES-AK-R/../GEEOUTCOME2021NOBL-frombackup.sas7bdat") #no baseline data
dim(gee_nobl_dt) 
## [1] 604  37
# Specify corstr = ar1 ---------------------------

corstr = "ar1"


# Create covariate data objects ---------------------------

covariates_nobl_dt <- 
  cbind.data.frame(
    cAGE = gee_nobl_dt$AGE-mean(gee_nobl_dt$AGE),
    cBLCGSMD = gee_nobl_dt$BLCGSMD - mean(gee_nobl_dt$BLCGSMD),
    MI = as.factor(gee_nobl_dt$MI),
    CBT = as.factor(gee_nobl_dt$CBT),
    TIME=as.factor(gee_nobl_dt$TIME),
    #CBT=as.factor(gee_nobl_dt$CBT),
    M3ENVDAYS = gee_nobl_dt$M3ENVDAYS,
    M6ENVDAYS = gee_nobl_dt$M6ENVDAYS ,
    MIBYCBT = as.factor(gee_nobl_dt$MIBYCBT),
    MIBYTIME = as.factor(gee_nobl_dt$MIBYTIME),
    CBTBYTIME = as.factor(gee_nobl_dt$CBTBYTIME),
    MIBYCBTBYTIME = as.factor(gee_nobl_dt$MIBYCBTBYTIME),
    id = gee_nobl_dt$id,
    log_unctrldays = gee_nobl_dt$log_unctrldays
  )

# DV = LONGABS ---------------------------

## check outcome variable(s) distributions
summary(gee_nobl_dt$CLONGABS)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   0.000   0.000   0.000   6.178   3.000  60.000      42
hist(gee_nobl_dt$CLONGABS)

summary(gee_nobl_dt$LCLONGABS)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##  0.0000  0.0000  0.0000  0.3622  0.6021  1.7853      42
hist(gee_nobl_dt$LCLONGABS)

## create dataframe
LONGABS_nobl_dt <- as.data.frame(
  cbind.data.frame(CLONGABS = gee_nobl_dt$CLONGABS,
                   LCLONGABS = gee_nobl_dt$LCLONGABS,
                   covariates_nobl_dt)
)

class(LONGABS_nobl_dt)
## [1] "data.frame"
dim(LONGABS_nobl_dt)
## [1] 604  15
summary(LONGABS_nobl_dt)  
##     CLONGABS        LCLONGABS           cAGE            cBLCGSMD       MI     
##  Min.   : 0.000   Min.   :0.0000   Min.   :-2.8880   Min.   :-10.926   0:302  
##  1st Qu.: 0.000   1st Qu.:0.0000   1st Qu.:-0.7921   1st Qu.: -7.029   1:302  
##  Median : 0.000   Median :0.0000   Median : 0.1148   Median : -1.926          
##  Mean   : 6.178   Mean   :0.3622   Mean   : 0.0000   Mean   :  0.000          
##  3rd Qu.: 3.000   3rd Qu.:0.6021   3rd Qu.: 0.7997   3rd Qu.:  5.860          
##  Max.   :60.000   Max.   :1.7853   Max.   : 2.3312   Max.   : 49.419          
##  NA's   :42       NA's   :42                                                  
##    CBT      TIME      M3ENVDAYS       M6ENVDAYS     MIBYCBT    MIBYTIME
##  0   :274   0:302   Min.   : 0.00   Min.   : 0.00   0   :438   0:453   
##  1   :318   1:302   1st Qu.: 0.00   1st Qu.: 0.00   1   :158   1:151   
##  NA's: 12           Median :10.00   Median : 0.00   NA's:  8           
##                     Mean   :21.26   Mean   :19.87                      
##                     3rd Qu.:41.00   3rd Qu.:36.00                      
##                     Max.   :60.00   Max.   :60.00                      
##                     NA's   :38      NA's   :46                         
##  CBTBYTIME  MIBYCBTBYTIME       id        log_unctrldays 
##  0   :439   0   :521      Min.   :  1.0   Min.   :0.000  
##  1   :159   1   : 79      1st Qu.: 78.0   1st Qu.:2.833  
##  NA's:  6   NA's:  4      Median :154.5   Median :3.496  
##                           Mean   :157.1   Mean   :3.094  
##                           3rd Qu.:238.0   3rd Qu.:4.111  
##                           Max.   :316.0   Max.   :4.111  
## 
colnames(LONGABS_nobl_dt)
##  [1] "CLONGABS"       "LCLONGABS"      "cAGE"           "cBLCGSMD"      
##  [5] "MI"             "CBT"            "TIME"           "M3ENVDAYS"     
##  [9] "M6ENVDAYS"      "MIBYCBT"        "MIBYTIME"       "CBTBYTIME"     
## [13] "MIBYCBTBYTIME"  "id"             "log_unctrldays"
## restrict to complete cases
LONGABS_nobl_dt_na.omit <- na.omit(LONGABS_nobl_dt)  
dim(LONGABS_nobl_dt_na.omit)  
## [1] 556  15
summary(LONGABS_nobl_dt_na.omit)
##     CLONGABS        LCLONGABS           cAGE             cBLCGSMD       
##  Min.   : 0.000   Min.   :0.0000   Min.   :-2.88795   Min.   :-10.9258  
##  1st Qu.: 0.000   1st Qu.:0.0000   1st Qu.:-0.83042   1st Qu.: -7.4924  
##  Median : 0.000   Median :0.0000   Median : 0.01890   Median : -1.9258  
##  Mean   : 6.237   Mean   :0.3648   Mean   :-0.02631   Mean   : -0.1177  
##  3rd Qu.: 3.000   3rd Qu.:0.6021   3rd Qu.: 0.79424   3rd Qu.:  5.6075  
##  Max.   :60.000   Max.   :1.7853   Max.   : 2.33123   Max.   : 49.4190  
##  MI      CBT     TIME      M3ENVDAYS       M6ENVDAYS     MIBYCBT MIBYTIME
##  0:282   0:256   0:278   Min.   : 0.00   Min.   : 0.00   0:408   0:419   
##  1:274   1:300   1:278   1st Qu.: 0.00   1st Qu.: 0.00   1:148   1:137   
##                          Median : 9.50   Median : 0.00                   
##                          Mean   :21.14   Mean   :19.94                   
##                          3rd Qu.:41.00   3rd Qu.:36.00                   
##                          Max.   :60.00   Max.   :60.00                   
##  CBTBYTIME MIBYCBTBYTIME       id        log_unctrldays 
##  0:406     0:482         Min.   :  1.0   Min.   :0.000  
##  1:150     1: 74         1st Qu.: 77.0   1st Qu.:3.178  
##                          Median :152.5   Median :3.998  
##                          Mean   :154.7   Mean   :3.328  
##                          3rd Qu.:235.0   3rd Qu.:4.111  
##                          Max.   :316.0   Max.   :4.111
colnames(LONGABS_nobl_dt_na.omit)
##  [1] "CLONGABS"       "LCLONGABS"      "cAGE"           "cBLCGSMD"      
##  [5] "MI"             "CBT"            "TIME"           "M3ENVDAYS"     
##  [9] "M6ENVDAYS"      "MIBYCBT"        "MIBYTIME"       "CBTBYTIME"     
## [13] "MIBYCBTBYTIME"  "id"             "log_unctrldays"
## define formulae
LCLONGABS.nobl.main = 
  LCLONGABS~ #logged
  cAGE +
  cBLCGSMD+
  MI +
  CBT +
  TIME + 
  offset( log_unctrldays)

CLONGABS.nobl.main = 
  CLONGABS~ #unlogged
  cAGE +
  cBLCGSMD+
  MI +
  CBT +
  TIME + 
  offset( log_unctrldays)


LCLONGABS.nobl.interaction = 
  LCLONGABS~ #logged
  cAGE +
  cBLCGSMD+
  MI +
  CBT +
  TIME + 
  MI*CBT+
  MI*TIME+
  CBT*TIME+
  MI*CBT*TIME+
  offset( log_unctrldays)

CLONGABS.nobl.interaction = 
  CLONGABS~ #unlogged
  cAGE +
  cBLCGSMD+
  MI +
  CBT +
  TIME + 
  MI*CBT+
  MI*TIME+
  CBT*TIME+
  MI*CBT*TIME+
  offset( log_unctrldays)



# DV = LONGABS ---------------------------

# modeling
## fit main model

#relevel MI and CBT
LONGABS_nobl_dt$MI_ref1 <- LONGABS_nobl_dt$MI %>% relevel("1")
LONGABS_nobl_dt$CBT_ref1 <- LONGABS_nobl_dt$CBT %>% relevel("1")
LONGABS_nobl_dt$TIME_ref1 <- LONGABS_nobl_dt$TIME %>% relevel("1")

CLONGABS_nobl_main <- geem(formula = 
                             CLONGABS ~ cAGE + cBLCGSMD + MI + CBT + TIME,
                           data = LONGABS_nobl_dt,
                           id=id,
                           family = MASS::negative.binomial(1),
                           corstr = corstr
)


## print main model summary
summary(CLONGABS_nobl_main) #unlogged
##             Estimates Model SE Robust SE     wald        p
## (Intercept)  1.725000  0.23570   0.22090  7.80600 0.000000
## cAGE        -0.128900  0.11610   0.11420 -1.12900 0.258900
## cBLCGSMD    -0.001244  0.01455   0.01597 -0.07790 0.937900
## MI1         -0.747300  0.25370   0.24840 -3.00800 0.002628
## CBT1         0.666200  0.25430   0.24460  2.72400 0.006453
## TIME1        0.008899  0.13590   0.13410  0.06635 0.947100
## 
##  Estimated Correlation Parameter:  0.5516 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.821 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  282    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  560
## fit interaction models

CLONGABS_nobl_interaction <- geem(formula = CLONGABS.nobl.interaction,
                                  data = LONGABS_nobl_dt,
                                  id=id,
                                  family = MASS::negative.binomial(1),
                                  corstr = corstr
)



## print interaction models' summary
summary(CLONGABS_nobl_interaction) #unlogged
##                Estimates Model SE Robust SE    wald       p
## (Intercept)     -1.93700  0.24060   0.22920 -8.4500 0.00000
## cAGE            -0.17350  0.09237   0.10340 -1.6780 0.09328
## cBLCGSMD        -0.01200  0.01158   0.01789 -0.6710 0.50220
## MI1             -0.54560  0.35440   0.36740 -1.4850 0.13750
## CBT1             0.31990  0.32360   0.29100  1.0990 0.27160
## TIME1           -0.07626  0.24310   0.23590 -0.3233 0.74650
## MI1:CBT1         0.32140  0.46990   0.47210  0.6809 0.49600
## MI1:TIME1       -0.47490  0.37020   0.40590 -1.1700 0.24200
## CBT1:TIME1       0.32360  0.32630   0.27670  1.1690 0.24220
## MI1:CBT1:TIME1  -0.06697  0.48430   0.50950 -0.1315 0.89540
## 
##  Estimated Correlation Parameter:  0.5029 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  2.94 
## 
##  Number of GEE iterations: 17 
##  Number of Clusters:  282    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  560
# DV = LONGABS ---------------------------

# #relevel MI and CBT
LONGABS_nobl_dt$MI_ref1 <- LONGABS_nobl_dt$MI %>% relevel("1")
LONGABS_nobl_dt$CBT_ref1 <- LONGABS_nobl_dt$CBT %>% relevel("1")
LONGABS_nobl_dt$TIME_ref1 <- LONGABS_nobl_dt$TIME %>% relevel("1")

# ignore missing values
## create an indicator column for any missing values 
LONGABS_nobl_dt$any_na <- LONGABS_nobl_dt %>% apply(1, function(x){any(is.na(x))}) 

## left join the dataset by the id column using the group_by() function
LONGABS_nobl_dt %<>% left_join(LONGABS_nobl_dt %>% group_by(id) %>% 
                                 summarise(any_na2 = any(any_na)), by="id")


## filter out rows with any NAs
LONGABS_nobl_dt %<>% filter(any_na2 != T)

# modeling
## main model
LONGABS_nobl_main <- geem(formula = CLONGABS.nobl.main,
                          data = LONGABS_nobl_dt,
                          id=id,
                          family = MASS::negative.binomial(1),
                          corstr = corstr
)
## Warning in geem(formula = CLONGABS.nobl.main, data = LONGABS_nobl_dt, id = id,
## : Did not converge
## print main model summary
summary(LONGABS_nobl_main)
##             Estimates Model SE Robust SE    wald        p
## (Intercept)  -1.97100  0.18990   0.20800 -9.4740 0.000000
## cAGE         -0.14630  0.09258   0.10710 -1.3660 0.171900
## cBLCGSMD     -0.01598  0.01151   0.02026 -0.7886 0.430400
## MI1          -0.59970  0.20440   0.21530 -2.7860 0.005342
## CBT1          0.60390  0.20600   0.22100  2.7330 0.006283
## TIME1        -0.12680  0.11960   0.11920 -1.0640 0.287500
## 
##  Estimated Correlation Parameter:  0.4962 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  2.955 
## 
##  Number of GEE iterations: 20 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556
## interaction model
LONGABS_nobl_interaction <- geem(formula = CLONGABS ~ cAGE + cBLCGSMD + MI + CBT + TIME + MI * CBT + MI * TIME +
                                   CBT * TIME + MI * CBT * TIME,
                                 #mi=0, cbt=0, time=0
                                 data = LONGABS_nobl_dt,
                                 id=id,
                                 family = MASS::negative.binomial(1),
                                 corstr = corstr
)

LONGABS_nobl_interaction_TIMEref1 <- geem(formula =
                                            CLONGABS ~ cAGE + cBLCGSMD + MI + CBT + TIME_ref1 + MI * CBT + MI * TIME_ref1 +
                                            CBT * TIME_ref1 + MI * CBT * TIME_ref1,
                                          #mi=0, cbt=0, time=1
                                          data = LONGABS_nobl_dt,
                                          id=id,
                                          family = MASS::negative.binomial(1),
                                          corstr = corstr
)


LONGABS_nobl_interaction_MIref1 <-
  geem(formula = CLONGABS ~ cAGE + cBLCGSMD + MI_ref1 + CBT + TIME + MI_ref1 * CBT + MI_ref1 * TIME +
         CBT * TIME + MI_ref1 * CBT * TIME,
       #ref: Mi=1, Cbt=0, Time=0
       data = LONGABS_nobl_dt,
       id=id,
       family = MASS::negative.binomial(1),
       corstr = corstr
  )

LONGABS_nobl_interaction_MIref1_TIMEref1 <-
  geem(formula = CLONGABS ~ cAGE + cBLCGSMD + MI_ref1 + CBT + TIME_ref1 +
         MI_ref1 * CBT + MI_ref1 * TIME_ref1 +
         CBT * TIME_ref1 + MI_ref1 * CBT * TIME_ref1,
       #ref: Mi=1, Cbt=0, Time=1
       data = LONGABS_nobl_dt,
       id=id,
       family = MASS::negative.binomial(1),
       corstr = corstr
  )

LONGABS_nobl_interaction_CBTref1 <-
  geem(formula = CLONGABS ~ cAGE + cBLCGSMD + MI + CBT_ref1 + TIME + MI * CBT_ref1 + MI *
         TIME + CBT_ref1 * TIME + MI * CBT_ref1 * TIME,
       #ref: Mi=0, Cbt=1, Time = 0
       data = LONGABS_nobl_dt,
       id=id,
       family = MASS::negative.binomial(1),
       corstr = corstr
  )

LONGABS_nobl_interaction_CBTref1_TIMEref1 <-
  geem(formula = CLONGABS ~ cAGE + cBLCGSMD + MI + CBT_ref1 + TIME_ref1 +
         MI * CBT_ref1 + MI * TIME_ref1 + CBT_ref1 * TIME_ref1 + 
         MI * CBT_ref1 * TIME_ref1,
       #ref: Mi=0, Cbt=1, Time = 1
       data = LONGABS_nobl_dt,
       id=id,
       family = MASS::negative.binomial(1),
       corstr = corstr
  )

LONGABS_nobl_interaction_MIref1_CBTref1 <-
  geem(formula = CLONGABS ~ cAGE + cBLCGSMD + MI_ref1 + CBT_ref1 + TIME + MI_ref1 * CBT_ref1 + MI_ref1 *
         TIME + CBT_ref1 * TIME + MI_ref1 * CBT_ref1 * TIME,
       #ref: Mi=1, Cbt=1, Time=0
       data = LONGABS_nobl_dt,
       id=id,
       family = MASS::negative.binomial(1),
       corstr = corstr
  )

LONGABS_nobl_interaction_MIref1_CBTref1_TIMEref1 <-
  geem(formula = CLONGABS ~ cAGE + cBLCGSMD + MI_ref1 + CBT_ref1 + TIME_ref1 +
         MI_ref1 * CBT_ref1 + MI_ref1 * TIME_ref1 +
         CBT_ref1 * TIME_ref1 + MI_ref1 * CBT_ref1 * TIME_ref1,
       #ref: Mi=1, Cbt=1, Time=1
       data = LONGABS_nobl_dt,
       id=id,
       family = MASS::negative.binomial(1),
       corstr = corstr
  )


## print interaction model summary
summary(LONGABS_nobl_interaction) #base: MI=0, CBT=0, Time=0
##                 Estimates Model SE Robust SE     wald       p
## (Intercept)     1.6550000  0.29820   0.25250  6.55500 0.00000
## cAGE           -0.1379000  0.11640   0.11550 -1.19500 0.23230
## cBLCGSMD        0.0007003  0.01457   0.01521  0.04605 0.96330
## MI1            -0.5604000  0.43700   0.37890 -1.47900 0.13920
## CBT1            0.5545000  0.40080   0.31870  1.74000 0.08184
## TIME1           0.2209000  0.28000   0.26050  0.84810 0.39640
## MI1:CBT1        0.2036000  0.58100   0.51850  0.39270 0.69460
## MI1:TIME1      -0.6803000  0.42240   0.47810 -1.42300 0.15470
## CBT1:TIME1      0.0351800  0.37770   0.30920  0.11380 0.90940
## MI1:CBT1:TIME1  0.2018000  0.55760   0.58310  0.34600 0.72930
## 
##  Estimated Correlation Parameter:  0.545 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.796 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556
summary(LONGABS_nobl_interaction_TIMEref1) #base: MI=0, CBT=0, Time=1
##                      Estimates Model SE Robust SE     wald       p
## (Intercept)          1.8760000  0.29340   0.30820  6.08800 0.00000
## cAGE                -0.1379000  0.11640   0.11550 -1.19500 0.23230
## cBLCGSMD             0.0007003  0.01457   0.01521  0.04605 0.96330
## MI1                 -1.2410000  0.45210   0.53510 -2.31900 0.02041
## CBT1                 0.5897000  0.39510   0.35560  1.65800 0.09723
## TIME_ref10          -0.2209000  0.28000   0.26050 -0.84810 0.39640
## MI1:CBT1             0.4054000  0.59250   0.66560  0.60900 0.54250
## MI1:TIME_ref10       0.6803000  0.42240   0.47810  1.42300 0.15470
## CBT1:TIME_ref10     -0.0351800  0.37770   0.30920 -0.11380 0.90940
## MI1:CBT1:TIME_ref10 -0.2018000  0.55760   0.58310 -0.34600 0.72930
## 
##  Estimated Correlation Parameter:  0.545 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.796 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556
summary(LONGABS_nobl_interaction_MIref1) #ref: MI=1, CBT=0, Time=0
##                      Estimates Model SE Robust SE     wald         p
## (Intercept)          1.0950000  0.31880   0.27900  3.92400 8.727e-05
## cAGE                -0.1379000  0.11640   0.11550 -1.19500 2.323e-01
## cBLCGSMD             0.0007003  0.01457   0.01521  0.04605 9.633e-01
## MI_ref10             0.5604000  0.43700   0.37890  1.47900 1.392e-01
## CBT1                 0.7581000  0.41910   0.40670  1.86400 6.228e-02
## TIME1               -0.4594000  0.31630   0.40090 -1.14600 2.518e-01
## MI_ref10:CBT1       -0.2036000  0.58100   0.51850 -0.39270 6.946e-01
## MI_ref10:TIME1       0.6803000  0.42240   0.47810  1.42300 1.547e-01
## CBT1:TIME1           0.2369000  0.41020   0.49430  0.47930 6.317e-01
## MI_ref10:CBT1:TIME1 -0.2018000  0.55760   0.58310 -0.34600 7.293e-01
## 
##  Estimated Correlation Parameter:  0.545 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.796 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556
summary(LONGABS_nobl_interaction_MIref1_TIMEref1) #ref: MI=1, CBT=0, Time=1
##                           Estimates Model SE Robust SE     wald       p
## (Intercept)               0.6352000  0.34350   0.42150  1.50700 0.13180
## cAGE                     -0.1379000  0.11640   0.11550 -1.19500 0.23230
## cBLCGSMD                  0.0007003  0.01457   0.01521  0.04605 0.96330
## MI_ref10                  1.2410000  0.45210   0.53510  2.31900 0.02041
## CBT1                      0.9951000  0.44020   0.55310  1.79900 0.07202
## TIME_ref10                0.4594000  0.31630   0.40090  1.14600 0.25180
## MI_ref10:CBT1            -0.4054000  0.59250   0.66560 -0.60900 0.54250
## MI_ref10:TIME_ref10      -0.6803000  0.42240   0.47810 -1.42300 0.15470
## CBT1:TIME_ref10          -0.2369000  0.41020   0.49430 -0.47930 0.63170
## MI_ref10:CBT1:TIME_ref10  0.2018000  0.55760   0.58310  0.34600 0.72930
## 
##  Estimated Correlation Parameter:  0.545 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.796 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556
summary(LONGABS_nobl_interaction_CBTref1) #ref: MI=0, CBT=1, Time=0
##                      Estimates Model SE Robust SE     wald       p
## (Intercept)          2.2100000  0.26730   0.19520 11.32000 0.00000
## cAGE                -0.1379000  0.11640   0.11550 -1.19500 0.23230
## cBLCGSMD             0.0007003  0.01457   0.01521  0.04605 0.96330
## MI1                 -0.3568000  0.38190   0.34760 -1.02700 0.30470
## CBT_ref10           -0.5545000  0.40080   0.31870 -1.74000 0.08184
## TIME1                0.2561000  0.25350   0.16670  1.53600 0.12450
## MI1:CBT_ref10       -0.2036000  0.58100   0.51850 -0.39270 0.69460
## MI1:TIME1           -0.4786000  0.36400   0.33300 -1.43700 0.15070
## CBT_ref10:TIME1     -0.0351800  0.37770   0.30920 -0.11380 0.90940
## MI1:CBT_ref10:TIME1 -0.2018000  0.55760   0.58310 -0.34600 0.72930
## 
##  Estimated Correlation Parameter:  0.545 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.796 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556
summary(LONGABS_nobl_interaction_CBTref1_TIMEref1) #ref: MI=0, CBT=1, Time=1
##                           Estimates Model SE Robust SE     wald       p
## (Intercept)               2.4660000  0.26420   0.17860 13.81000 0.00000
## cAGE                     -0.1379000  0.11640   0.11550 -1.19500 0.23230
## cBLCGSMD                  0.0007003  0.01457   0.01521  0.04605 0.96330
## MI1                      -0.8354000  0.38220   0.38850 -2.15000 0.03153
## CBT_ref10                -0.5897000  0.39510   0.35560 -1.65800 0.09723
## TIME_ref10               -0.2561000  0.25350   0.16670 -1.53600 0.12450
## MI1:CBT_ref10            -0.4054000  0.59250   0.66560 -0.60900 0.54250
## MI1:TIME_ref10            0.4786000  0.36400   0.33300  1.43700 0.15070
## CBT_ref10:TIME_ref10      0.0351800  0.37770   0.30920  0.11380 0.90940
## MI1:CBT_ref10:TIME_ref10  0.2018000  0.55760   0.58310  0.34600 0.72930
## 
##  Estimated Correlation Parameter:  0.545 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.796 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556
summary(LONGABS_nobl_interaction_MIref1_CBTref1) #ref: MI=1, CBT=1, Time=0
##                           Estimates Model SE Robust SE     wald       p
## (Intercept)               1.8530000  0.27250   0.28890  6.41200 0.00000
## cAGE                     -0.1379000  0.11640   0.11550 -1.19500 0.23230
## cBLCGSMD                  0.0007003  0.01457   0.01521  0.04605 0.96330
## MI_ref10                  0.3568000  0.38190   0.34760  1.02700 0.30470
## CBT_ref10                -0.7581000  0.41910   0.40670 -1.86400 0.06228
## TIME1                    -0.2225000  0.26110   0.28850 -0.77130 0.44050
## MI_ref10:CBT_ref10        0.2036000  0.58100   0.51850  0.39270 0.69460
## MI_ref10:TIME1            0.4786000  0.36400   0.33300  1.43700 0.15070
## CBT_ref10:TIME1          -0.2369000  0.41020   0.49430 -0.47930 0.63170
## MI_ref10:CBT_ref10:TIME1  0.2018000  0.55760   0.58310  0.34600 0.72930
## 
##  Estimated Correlation Parameter:  0.545 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.796 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556
summary(LONGABS_nobl_interaction_MIref1_CBTref1_TIMEref1) #ref: MI=1, CBT=1, Time=1
##                                Estimates Model SE Robust SE     wald         p
## (Intercept)                    1.6300000  0.27590   0.34740  4.69300 0.0000027
## cAGE                          -0.1379000  0.11640   0.11550 -1.19500 0.2323000
## cBLCGSMD                       0.0007003  0.01457   0.01521  0.04605 0.9633000
## MI_ref10                       0.8354000  0.38220   0.38850  2.15000 0.0315300
## CBT_ref10                     -0.9951000  0.44020   0.55310 -1.79900 0.0720200
## TIME_ref10                     0.2225000  0.26110   0.28850  0.77130 0.4405000
## MI_ref10:CBT_ref10             0.4054000  0.59250   0.66560  0.60900 0.5425000
## MI_ref10:TIME_ref10           -0.4786000  0.36400   0.33300 -1.43700 0.1507000
## CBT_ref10:TIME_ref10           0.2369000  0.41020   0.49430  0.47930 0.6317000
## MI_ref10:CBT_ref10:TIME_ref10 -0.2018000  0.55760   0.58310 -0.34600 0.7293000
## 
##  Estimated Correlation Parameter:  0.545 
##  Correlation Structure:  ar1 
##  Est. Scale Parameter:  4.796 
## 
##  Number of GEE iterations: 4 
##  Number of Clusters:  278    Maximum Cluster Size:  2 
##  Number of observations with nonzero weight:  556