Background

This is a report focusing on end of life care preferences and their implementation by the clinical care team. In particular, we will focus on the National Quality Forum Measure #1626:

Percentage of vulnerable adults admitted to ICU who survive at least 48 hours who have their care preferences documented within 48 hours OR documentation as to why this was not done.

For our purposeses:

Care preference documentation within 48hrs of admission, age >74.

Care provider/Patient interactions from the MIMIC-III Intensive Care Unit Database are analyzed within the framework of a hospital admission utilizing a series of Mixed Effects Models. The patient is the random effect, so we can explain the difference in variance explained by patients compared to that explained by other effects (when the patient is introduced to other demographic and clinical variables) in the model.

It is important to note that the use of fixed and random effects is deliberate. A fixed effect is used when a categorical variable contains all levels of interest. A random effect is used when a categorical variable contains only a sample of all levels of interest, the samples which do not exist are unobserved variables and, since their distributions do not exist, they will be estimated. The levels of the random effect are assumed to be independent of each other; this assumption requires a priori knowledge of the phenomenon being modeled.

Model 0 (No Covariates)

  1. Care Provider (Random)

Model 1 (Patient Demographics)

  1. Gender
  2. Age
  3. Ethnicity
  4. Marrital Status
  5. Care Provider (Random)

Model 2 (Demographics + Clinical Variables)

  1. Demographics (Model 1)
  2. Sequential Organ Failure Assessment (SOFA)
  3. Care Provider (Random)

Model 3 (Demographics + Clinical Variables + ICU)

We will use the Sequential Organ Failure Assessment (SOFA) from Illness Severity Scores (github) to determine the severity of illness at admission.

  1. Demographics (as in Model 1)
  2. First Intensive Care Unit
  3. SOFA Score (As Model 2)
  4. Care Provider (Random)

Libraries

library("ggplot2") ## Graphing
library("GGally") ## Extension to ggplot
library("reshape2") ## for melt()
library("lme4") ## for Hierachal Models
library("sjPlot") ## Lovely Presentation of Model Output
library("rcompanion") ## Pairwise nominal test

Utility Functions

caremeasure_check

caremeasure_check will go through each hospital admission and keep only those admissions with attendings who have logged a patient note that was captured by MIMIC-III. In addition to checking for an attending physician, it will also check to see if the caremeasure was implimented.

caremeasure_check <- function(dat){
    ## Create Caremeasure Variable
    dat$NQF <- rep(0, each = nrow(dat))
    ## Temporary data frame
    tmp_frame <- data.frame()
    ## Results frame
    res <- data.frame()
    ## For each hospital admission
    for (name in unique(dat$HADM_ID)){
        ## Subset admission
        tmp_frame <- dat[dat$HADM_ID == name, ]
        ## If any care providers are "Attending"
        if (any("Attending" %in% tmp_frame$CG_DESCRIPTION)){
            ## Check if caremeasure was implemented
            if (any(tmp_frame$CIM.machine == 1)){
                tmp_frame$NQF <- rep(1, each = nrow(tmp_frame))
            }
            ## add hospital admission to results
            res <- rbind(res, tmp_frame)
        }
    }
    ## Return control to outer level
    return(res)
}

plotDat

plotDat is a simple plotting function.

plotDat <- function(dat, column, x_col, bs, mn, xl, yl){
  tmp <- as.matrix(table(dat[[column]], dat[[x_col]]))
  prop <- prop.table(tmp, margin = 2)#2 for column-wise proportions
  par(mar = c(5.0, 4.0, 4.0, 15), xpd = TRUE)
  barplot(prop, col = cm.colors(length(rownames(prop))), beside = bs, width = 2, main = mn, xlab = xl, ylab = yl)
  legend("topright", inset = c(-0.90,0), fill = cm.colors(length(rownames(prop))), legend=rownames(prop))
}

detach_packages

detach_packages will keep only base R packages, and will remove all other supplementary packages to avoid functional conflicts.

Load Data and Merge to Care Providers Table

The latest dataset with NeuroNER predictions will be used. Multiple clinicians are associated in the database with identical notes, and those notes will be re-introduced to the data set by performing an inner join between old and new data, which will apply labels to the old data (which contains duplicate notes associated with different care providers).

## Latest Dataset of NeuroNER Predictions
dat <- read.csv("~/nqf_caregivers/data/20180607_EOL_data_ICU.csv", header = T, stringsAsFactors = F)
dim(dat)
## [1] 10250    57
## Note: Notes had been logged by multiple Care providers, we will reintroduce those annotations

## Load Labeled Note Data for NQF Caremeasure Cohort (From NOTEEVENTS table)
tmp <- read.csv("~/nqf_caregivers/data/note_labels_over75.csv", header = T, stringsAsFactors = F)
dim(tmp)
## [1] 11575    25
## Keep only TEXT and ROW_ID from tmp
tmp <- tmp[ ,c("ROW_ID", "TEXT")]

## Inner join
dat <- merge(tmp, dat, by = "TEXT")

## Clean tmp
rm(tmp)

## Check column names
colnames(dat)
##  [1] "TEXT"                 "ROW_ID.x"             "SUBJECT_ID"          
##  [4] "HADM_ID"              "ROW_ID.y"             "CHARTDATE"           
##  [7] "CHARTTIME"            "STORETIME"            "CATEGORY"            
## [10] "DESCRIPTION"          "CGID"                 "ISERROR"             
## [13] "ADMITTIME"            "DISCHTIME"            "DEATHTIME"           
## [16] "ADMISSION_TYPE"       "ADMISSION_LOCATION"   "DISCHARGE_LOCATION"  
## [19] "INSURANCE"            "LANGUAGE"             "RELIGION"            
## [22] "MARITAL_STATUS"       "ETHNICITY"            "EDREGTIME"           
## [25] "EDOUTTIME"            "DIAGNOSIS"            "HOSPITAL_EXPIRE_FLAG"
## [28] "HAS_CHARTEVENTS_DATA" "GENDER"               "DOB"                 
## [31] "DOD"                  "DOD_HOSP"             "DOD_SSN"             
## [34] "EXPIRE_FLAG"          "ICUSTAY_ID"           "DBSOURCE"            
## [37] "FIRST_CAREUNIT"       "LAST_CAREUNIT"        "FIRST_WARDID"        
## [40] "LAST_WARDID"          "INTIME"               "OUTTIME"             
## [43] "LOS"                  "AGE"                  "ADMISSION_NUMBER"    
## [46] "DAYS_UNTIL_DEATH"     "TIME_SINCE_ADMIT"     "CGID.1"              
## [49] "HADM_ID.1"            "FAM.machine"          "CIM.machine"         
## [52] "LIM.machine"          "CAR.machine"          "COD.machine"         
## [55] "check.CGID"           "check.dadm_id"        "CIM.or.FAM"          
## [58] "Died.in.Hospital"
## What is HADM_ID.1?
head(table(dat$HADM_ID.1))
## 
##   #N/A 100102 100153 100347 100391 100525 
##     32      8      3     12     15      2
## What is HADM_ID?
head(table(dat$HADM_ID))
## 
## 100102 100153 100347 100391 100525 100575 
##      8      3     12     15      2     11
## #N/A? Clean HADM_ID.1
dat$HADM_ID.1 <- NULL

## What is CGID.1?
head(table(dat$CGID.1))
## 
##  #N/A 14010 14022 14037 14045 14056 
##    32    22     1    93    37    14
## What is CGID
head(table(dat$CGID))
## 
## 14010 14022 14037 14045 14056 14080 
##    22     1    93    37    14     6
## #N/A? Clean CGID.1
dat$CGID.1 <- NULL

## What is check.CGID
head(table(dat$check.CGID))
##     0 
## 11575
## Clean it
dat$check.CGID <- NULL

## What is check.dadm_id?
head(table(dat$check.dadm_id))
##     0 
## 11575
## Clean it
dat$check.dadm_id <- NULL

## Clean column names
dat$ROW_ID.y <- NULL

colnames(dat)[which(colnames(dat) == "ROW_ID.x")] <- "ROW_ID"


## Load CAREGIVERS Table for join on CGID
cg <- read.csv("~/nqf_caregivers/data/mimic/CAREGIVERS.csv", 
               header = T, stringsAsFactors = F)

## Change column name of "NOTEEVENTS.DESCRIPTION" to explicitly mention that it describes the note
colnames(dat)[which(colnames(dat) == "DESCRIPTION")] <- "NOTE_DESCRIPTION"

## Change column name of "CAREGIVERS. DESCRIPTION" to explicitly mention that it describes the careprovider
colnames(cg)[which(colnames(cg) == "DESCRIPTION")] <- "CG_DESCRIPTION"

## Remove ROW_ID from CG
cg$ROW_ID <- NULL

## Remove TEXT
dat$TEXT <- NULL

## Merge to caregivers
dat <- merge(dat, cg, by = "CGID")
dim(dat)
## [1] 11575    54
## Clean CG
rm(cg)

Load Severity of Illness Data

sofa <- read.csv("~/nqf_caregivers/data/sofa.csv", header = T, stringsAsFactors = F)
#oasis <- read.csv("~/nqf_caregivers/data/oasis.csv", header = T, stringsAsFactors = F)
#saps <- read.csv("~/nqf_caregivers/data/saps.csv", header = T, stringsAsFactors = F)

colnames(sofa) <- toupper(colnames(sofa))

dat <- merge(dat, sofa, by = c("SUBJECT_ID", "HADM_ID", "ICUSTAY_ID"))
dim(dat)
## [1] 11575    61
## Clean environment
rm(sofa)

Data Cleaning

## Clean ethnicity to Black/White/Other
dat[(grepl("WHITE|PORTUGUESE", dat$ETHNICITY)),]$ETHNICITY <- "WHITE" 
dat[(grepl("ASIAN", dat$ETHNICITY)),]$ETHNICITY <- "OTHER" 
dat[(grepl("BLACK", dat$ETHNICITY)),]$ETHNICITY <- "BLACK" 
dat[(grepl("HISPANIC", dat$ETHNICITY)),]$ETHNICITY <- "OTHER"
dat[(grepl("MIDDLE|NATIVE|MULTI|DECLINED|UNABLE|OTHER|NOT", dat$ETHNICITY)),]$ETHNICITY <- "OTHER"

## Clean Marital Status to Married, Single, Widowed, Unknown
dat$MARITAL_STATUS[dat$MARITAL_STATUS == ""] <- "UNKNOWN (DEFAULT)"
dat$MARITAL_STATUS[dat$MARITAL_STATUS == "UNKNOWN (DEFAULT)"] <- "UNKNOWN"
dat$MARITAL_STATUS[dat$MARITAL_STATUS == "SEPARATED"] <- "SINGLE"
dat$MARITAL_STATUS[dat$MARITAL_STATUS == "DIVORCED"] <- "SINGLE"

Check Attending and Caremeasure Implementation

tmp <- caremeasure_check(dat)

cat(length(unique(dat$CGID)) - length(unique(tmp$CGID)), "Clinicians dropped due to no attending data in notes.\n")
## 4 Clinicians dropped due to no attending data in notes.
cat(length(unique(dat$SUBJECT_ID)) - length(unique(tmp$SUBJECT_ID)), "Patients dropped due to no attending data in notes.\n")
## 78 Patients dropped due to no attending data in notes.
cat(length(unique(dat$HADM_ID)) - length(unique(tmp$HADM_ID)), "Hospital Admissions dropped due to no attending data in notes.\n")
## 95 Hospital Admissions dropped due to no attending data in notes.
cat(nrow(dat) - nrow(tmp), "Physician/Patient interactions dropped due to no attending data in notes.\n")
## 416 Physician/Patient interactions dropped due to no attending data in notes.

Data Collapsing (To Hospital Admission Level)

Data will be collapsed using the aggregate function, so we only view the patient’s hospital admission and whether or not the caremeasure was implemented in the first 48 hours.

temp <- aggregate(cbind(NQF,
                       AGE,
                       SOFA) ~ 
                     ETHNICITY +
                     GENDER +
                     MARITAL_STATUS +
                     FIRST_CAREUNIT +
                     HADM_ID +
                     SUBJECT_ID +
                     CGID,
                 data = tmp, 
                 FUN = mean)

Data Exploration

plotDat(temp, "NQF", "GENDER", F, "Gender", "Gender", "Frequency")

test <- table(temp$GENDER, temp$NQF)
test
##    
##        0    1
##   F  674 1816
##   M  848 1612
chisq.test(test)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  test
## X-squared = 31.505, df = 1, p-value = 1.989e-08
pairwiseNominalIndependence(
  as.matrix(test), 
  fisher = F, gtest = F, chisq = T, method = "fdr")
##   Comparison  p.Chisq p.adj.Chisq
## 1      F : M 1.99e-08    1.99e-08
plotDat(temp, "NQF","ETHNICITY", F, "Ethnicity", "Ethnicity", "Frequency")

test <- table(temp$ETHNICITY, temp$NQF)
test
##        
##            0    1
##   BLACK  119  328
##   OTHER  136  366
##   WHITE 1267 2734
chisq.test(test)
## 
##  Pearson's Chi-squared test
## 
## data:  test
## X-squared = 8.3129, df = 2, p-value = 0.01566
pairwiseNominalIndependence(
  as.matrix(test), 
  fisher = F, gtest = F, chisq = T, method = "fdr")
##      Comparison p.Chisq p.adj.Chisq
## 1 BLACK : OTHER  0.9290      0.9290
## 2 BLACK : WHITE  0.0331      0.0627
## 3 OTHER : WHITE  0.0418      0.0627
plotDat(temp, "NQF", "MARITAL_STATUS", F, "Marital Status", "Marital Status", "Frequency")

test <- table(temp$MARITAL_STATUS, temp$NQF)
test
##          
##              0    1
##   MARRIED  723 1348
##   SINGLE   240  752
##   UNKNOWN   93  118
##   WIDOWED  466 1210
chisq.test(test)
## 
##  Pearson's Chi-squared test
## 
## data:  test
## X-squared = 61.29, df = 3, p-value = 3.117e-13
pairwiseNominalIndependence(
  as.matrix(test), 
  fisher = F, gtest = F, chisq = T, method = "fdr")
##          Comparison  p.Chisq p.adj.Chisq
## 1  MARRIED : SINGLE 2.91e-09    1.75e-08
## 2 MARRIED : UNKNOWN 1.01e-02    1.21e-02
## 3 MARRIED : WIDOWED 3.99e-06    5.98e-06
## 4  SINGLE : UNKNOWN 7.61e-09    2.28e-08
## 5  SINGLE : WIDOWED 4.57e-02    4.57e-02
## 6 UNKNOWN : WIDOWED 1.60e-06    3.20e-06
plotDat(temp, "NQF", "FIRST_CAREUNIT", F, "First Careunit", "First Careunit", "Frequency")

test <- table(temp$FIRST_CAREUNIT, temp$NQF)
test
##        
##            0    1
##   CCU    191  521
##   CSRU   116   80
##   MICU   725 2297
##   SICU   311  322
##   TSICU  179  208
chisq.test(test)
## 
##  Pearson's Chi-squared test
## 
## data:  test
## X-squared = 288.53, df = 4, p-value < 2.2e-16
pairwiseNominalIndependence(
  as.matrix(test), 
  fisher = F, gtest = F, chisq = T, method = "fdr")
##      Comparison  p.Chisq p.adj.Chisq
## 1    CCU : CSRU 4.68e-17    1.01e-16
## 2    CCU : MICU 1.25e-01    1.39e-01
## 3    CCU : SICU 5.05e-17    1.01e-16
## 4   CCU : TSICU 1.17e-10    1.95e-10
## 5   CSRU : MICU 4.13e-27    2.07e-26
## 6   CSRU : SICU 1.74e-02    2.17e-02
## 7  CSRU : TSICU 4.21e-03    6.01e-03
## 8   MICU : SICU 4.98e-37    4.98e-36
## 9  MICU : TSICU 1.69e-20    5.63e-20
## 10 SICU : TSICU 4.08e-01    4.08e-01
boxplot(temp$AGE ~ temp$NQF, 
        main = "Caremeasure Implementation by Age",
        xlab = "Implementation (1 == Yes)",
        ylab = "Age (Years)")

t.test(temp$AGE ~ temp$NQF)
## 
##  Welch Two Sample t-test
## 
## data:  temp$AGE by temp$NQF
## t = -9.5237, df = 3141.1, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.763049 -1.161041
## sample estimates:
## mean in group 0 mean in group 1 
##        83.19766        84.65970
boxplot(temp$SOFA ~ temp$NQF, 
        main = "Caremeasure Implementation by SOFA Score",
        xlab = "Implementation (1 == Yes)",
        ylab = "SOFA Score")

t.test(temp$SOFA ~ temp$NQF)
## 
##  Welch Two Sample t-test
## 
## data:  temp$SOFA by temp$NQF
## t = -3.131, df = 2999.2, p-value = 0.001759
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.4562171 -0.1048522
## sample estimates:
## mean in group 0 mean in group 1 
##        4.664915        4.945449

Data Standardization and Factoring (for modeling)

Continuous data, Age and SOFA, will be standardized in the form:

\[z = \frac{x - \mu}{\sigma}\]

In this way, we can analyze the data in units of their deviation from the mean.

temp$AGE <- (temp$AGE - mean(temp$AGE))/sd(temp$AGE)
temp$SOFA <- (temp$SOFA - mean(temp$SOFA)/sd(temp$SOFA))
## Factor
temp <- within(temp, {
    ETHNICITY <- factor(ETHNICITY)
    GENDER <- factor(GENDER)
    MARITAL_STATUS <- factor(MARITAL_STATUS)
    FIRST_CAREUNIT <- factor(FIRST_CAREUNIT)
    SUBJECT_ID <- factor(SUBJECT_ID)
    CGID <- factor(CGID)
})

Baseline Model (Patient Random Effects)

m_initial <- glmer(NQF ~ (1 | CGID),
                   data = temp, 
                   family = binomial, 
                   control = glmerControl(optimizer = "bobyqa"),
                   nAGQ = 1) ## Default value 1, higher values increase estimate accuracy

## View
summary(m_initial)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: NQF ~ (1 | CGID)
##    Data: temp
## Control: glmerControl(optimizer = "bobyqa")
## 
##      AIC      BIC   logLik deviance df.resid 
##   5893.2   5906.2  -2944.6   5889.2     4948 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.4968 -0.9373  0.5306  0.6007  1.5058 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  CGID   (Intercept) 0.5855   0.7652  
## Number of obs: 4950, groups:  CGID, 493
## 
## Fixed effects:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   0.8776     0.0545    16.1   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Intraclass Correlation
sjstats::icc(m_initial)
## 
## Generalized linear mixed model
##  Family: binomial (logit)
## Formula: NQF ~ (1 | CGID)
## 
##   ICC (CGID): 0.151093

Model 1 (Patient Demographics)

  1. Gender
  2. Age
  3. Ethnicity
  4. Marrital Status
  5. Care Provider (Random)
m_dem <- glmer(NQF ~ GENDER +
                     AGE +
                     ETHNICITY +
                     MARITAL_STATUS +
                     (1 | CGID), 
                   data = temp, 
                   family = binomial, 
                   control = glmerControl(optimizer = "bobyqa"),
                   nAGQ = 1)

## View
summary(m_dem)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: NQF ~ GENDER + AGE + ETHNICITY + MARITAL_STATUS + (1 | CGID)
##    Data: temp
## Control: glmerControl(optimizer = "bobyqa")
## 
##      AIC      BIC   logLik deviance df.resid 
##   5757.0   5815.6  -2869.5   5739.0     4941 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.4809 -0.8908  0.4767  0.6286  1.8961 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  CGID   (Intercept) 0.5535   0.744   
## Number of obs: 4950, groups:  CGID, 493
## 
## Fixed effects:
##                       Estimate Std. Error z value Pr(>|z|)    
## (Intercept)            0.97803    0.14140   6.917 4.62e-12 ***
## GENDERM               -0.31492    0.07306  -4.310 1.63e-05 ***
## AGE                    0.30590    0.03498   8.746  < 2e-16 ***
## ETHNICITYOTHER         0.37528    0.16498   2.275  0.02293 *  
## ETHNICITYWHITE        -0.07192    0.12326  -0.583  0.55959    
## MARITAL_STATUSSINGLE   0.43297    0.09686   4.470 7.81e-06 ***
## MARITAL_STATUSUNKNOWN -0.49888    0.16745  -2.979  0.00289 ** 
## MARITAL_STATUSWIDOWED  0.11617    0.08508   1.365  0.17211    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##                 (Intr) GENDER AGE    ETHNICITYO ETHNICITYW MARITAL_STATUSS
## GENDERM         -0.312                                                    
## AGE              0.136 -0.034                                             
## ETHNICITYOT     -0.600 -0.072 -0.032                                      
## ETHNICITYWH     -0.794 -0.083 -0.087  0.684                               
## MARITAL_STATUSS -0.326  0.224  0.036  0.082      0.065                    
## MARITAL_STATUSU -0.152  0.094 -0.086 -0.115      0.030      0.162         
## MARITAL_STATUSW -0.437  0.356 -0.162  0.100      0.095      0.392         
##                 MARITAL_STATUSU
## GENDERM                        
## AGE                            
## ETHNICITYOT                    
## ETHNICITYWH                    
## MARITAL_STATUSS                
## MARITAL_STATUSU                
## MARITAL_STATUSW  0.219
sjt.glmer(m_dem)
    NQF
    Odds Ratio CI p
Fixed Parts
(Intercept)   2.66 2.02 – 3.51 <.001
GENDER (M)   0.73 0.63 – 0.84 <.001
AGE   1.36 1.27 – 1.45 <.001
ETHNICITY (OTHER)   1.46 1.05 – 2.01 .023
ETHNICITY (WHITE)   0.93 0.73 – 1.18 .560
MARITAL_STATUS (SINGLE)   1.54 1.28 – 1.86 <.001
MARITAL_STATUS (UNKNOWN)   0.61 0.44 – 0.84 .003
MARITAL_STATUS (WIDOWED)   1.12 0.95 – 1.33 .172
Random Parts
τ00, CGID   0.554
NCGID   493
ICCCGID   0.144
Observations   4950
Deviance   5255.467

Model 2 (Demographics + Clinical Variables)

  1. Demographics (Model 1)
  2. Sequential Organ Failure Assessment (SOFA)
  3. Care Provider (Random)
m_clin <- glmer(NQF ~ GENDER +
                      AGE +
                      ETHNICITY +
                      MARITAL_STATUS +
                      SOFA +
                      (1 | CGID), 
                   data = temp, 
                   family = binomial, 
                   control = glmerControl(optimizer = "bobyqa"),
                   nAGQ = 1)

## View
summary(m_clin)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: NQF ~ GENDER + AGE + ETHNICITY + MARITAL_STATUS + SOFA + (1 |  
##     CGID)
##    Data: temp
## Control: glmerControl(optimizer = "bobyqa")
## 
##      AIC      BIC   logLik deviance df.resid 
##   5746.9   5812.0  -2863.4   5726.9     4940 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3513 -0.8936  0.4738  0.6276  1.9269 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  CGID   (Intercept) 0.5427   0.7367  
## Number of obs: 4950, groups:  CGID, 493
## 
## Fixed effects:
##                       Estimate Std. Error z value Pr(>|z|)    
## (Intercept)            0.85392    0.14576   5.858 4.67e-09 ***
## GENDERM               -0.34036    0.07348  -4.632 3.63e-06 ***
## AGE                    0.31454    0.03512   8.955  < 2e-16 ***
## ETHNICITYOTHER         0.35805    0.16550   2.163 0.030508 *  
## ETHNICITYWHITE        -0.06769    0.12357  -0.548 0.583852    
## MARITAL_STATUSSINGLE   0.44041    0.09696   4.542 5.56e-06 ***
## MARITAL_STATUSUNKNOWN -0.47167    0.16784  -2.810 0.004952 ** 
## MARITAL_STATUSWIDOWED  0.12375    0.08514   1.454 0.146067    
## SOFA                   0.04119    0.01185   3.476 0.000508 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##                 (Intr) GENDER AGE    ETHNICITYO ETHNICITYW MARITAL_STATUSS
## GENDERM         -0.277                                                    
## AGE              0.114 -0.040                                             
## ETHNICITYOT     -0.578 -0.067 -0.036                                      
## ETHNICITYWH     -0.774 -0.083 -0.089  0.683                               
## MARITAL_STATUSS -0.320  0.223  0.038  0.078      0.062                    
## MARITAL_STATUSU -0.157  0.089 -0.082 -0.117      0.029      0.164         
## MARITAL_STATUSW -0.430  0.350 -0.158  0.100      0.095      0.393         
## SOFA            -0.239 -0.103  0.076 -0.025      0.009      0.025         
##                 MARITAL_STATUSU MARITAL_STATUSW
## GENDERM                                        
## AGE                                            
## ETHNICITYOT                                    
## ETHNICITYWH                                    
## MARITAL_STATUSS                                
## MARITAL_STATUSU                                
## MARITAL_STATUSW  0.219                         
## SOFA             0.045           0.026
sjt.glmer(m_clin)
    NQF
    Odds Ratio CI p
Fixed Parts
(Intercept)   2.35 1.77 – 3.13 <.001
GENDER (M)   0.71 0.62 – 0.82 <.001
AGE   1.37 1.28 – 1.47 <.001
ETHNICITY (OTHER)   1.43 1.03 – 1.98 .031
ETHNICITY (WHITE)   0.93 0.73 – 1.19 .584
MARITAL_STATUS (SINGLE)   1.55 1.28 – 1.88 <.001
MARITAL_STATUS (UNKNOWN)   0.62 0.45 – 0.87 .005
MARITAL_STATUS (WIDOWED)   1.13 0.96 – 1.34 .146
SOFA   1.04 1.02 – 1.07 <.001
Random Parts
τ00, CGID   0.543
NCGID   493
ICCCGID   0.142
Observations   4950
Deviance   5249.565

Model 3 (Demographics + Clinical Variables + ICU)

  1. Demographics (as in Model 1)
  2. SOFA Score (As Model 2)
  3. First Intensive Care Unit
  4. Care Provider (Random)
m_icu <- glmer(NQF ~ 
                   GENDER +
                   AGE +
                   ETHNICITY +
                   MARITAL_STATUS +
                   SOFA +
                   FIRST_CAREUNIT +
                   (1 | CGID), 
                data = temp, 
                family = binomial, 
                control = glmerControl(optimizer = "bobyqa"),
                nAGQ = 1)

## View
summary(m_icu)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: 
## NQF ~ GENDER + AGE + ETHNICITY + MARITAL_STATUS + SOFA + FIRST_CAREUNIT +  
##     (1 | CGID)
##    Data: temp
## Control: glmerControl(optimizer = "bobyqa")
## 
##      AIC      BIC   logLik deviance df.resid 
##   5657.3   5748.4  -2814.7   5629.3     4936 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3610 -0.8636  0.4787  0.6292  1.8411 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  CGID   (Intercept) 0.1741   0.4172  
## Number of obs: 4950, groups:  CGID, 493
## 
## Fixed effects:
##                       Estimate Std. Error z value Pr(>|z|)    
## (Intercept)            0.92976    0.16666   5.579 2.42e-08 ***
## GENDERM               -0.32698    0.07268  -4.499 6.83e-06 ***
## AGE                    0.32302    0.03469   9.312  < 2e-16 ***
## ETHNICITYOTHER         0.44556    0.16415   2.714 0.006642 ** 
## ETHNICITYWHITE        -0.06682    0.12173  -0.549 0.583039    
## MARITAL_STATUSSINGLE   0.43199    0.09573   4.513 6.40e-06 ***
## MARITAL_STATUSUNKNOWN -0.40796    0.16488  -2.474 0.013353 *  
## MARITAL_STATUSWIDOWED  0.14841    0.08422   1.762 0.078035 .  
## SOFA                   0.03611    0.01176   3.071 0.002133 ** 
## FIRST_CAREUNITCSRU    -1.14277    0.18868  -6.057 1.39e-09 ***
## FIRST_CAREUNITMICU     0.17583    0.10423   1.687 0.091600 .  
## FIRST_CAREUNITSICU    -0.80810    0.13391  -6.035 1.59e-09 ***
## FIRST_CAREUNITTSICU   -0.57089    0.15611  -3.657 0.000255 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 13 > 12.
## Use print(x, correlation=TRUE)  or
##   vcov(x)     if you need it
sjt.glmer(m_icu)
    NQF
    Odds Ratio CI p
Fixed Parts
(Intercept)   2.53 1.83 – 3.51 <.001
GENDER (M)   0.72 0.63 – 0.83 <.001
AGE   1.38 1.29 – 1.48 <.001
ETHNICITY (OTHER)   1.56 1.13 – 2.15 .007
ETHNICITY (WHITE)   0.94 0.74 – 1.19 .583
MARITAL_STATUS (SINGLE)   1.54 1.28 – 1.86 <.001
MARITAL_STATUS (UNKNOWN)   0.67 0.48 – 0.92 .013
MARITAL_STATUS (WIDOWED)   1.16 0.98 – 1.37 .078
SOFA   1.04 1.01 – 1.06 .002
FIRST_CAREUNIT (CSRU)   0.32 0.22 – 0.46 <.001
FIRST_CAREUNIT (MICU)   1.19 0.97 – 1.46 .092
FIRST_CAREUNIT (SICU)   0.45 0.34 – 0.58 <.001
FIRST_CAREUNIT (TSICU)   0.57 0.42 – 0.77 <.001
Random Parts
τ00, CGID   0.174
NCGID   493
ICCCGID   0.050
Observations   4950
Deviance   5406.885