diff --git a/404.html b/404.html index faf50bf3..785426f5 100644 --- a/404.html +++ b/404.html @@ -36,7 +36,7 @@
  • Terminology
  • Specify Core Inputs
  • Data Requirements & Preparation
  • -
  • Workflow for Continous Exposures
  • +
  • Workflow for Continous Exposures
  • Assessing Balance for Time-Varying Exposures
  • Customizing Weights Formulas
  • diff --git a/articles/Assessing_Balance_Tv.html b/articles/Assessing_Balance_Tv.html index 1c300eb3..e634948f 100644 --- a/articles/Assessing_Balance_Tv.html +++ b/articles/Assessing_Balance_Tv.html @@ -38,7 +38,7 @@
  • Terminology
  • Specify Core Inputs
  • Data Requirements & Preparation
  • -
  • Workflow for Continous Exposures
  • +
  • Workflow for Continous Exposures
  • Assessing Balance for Time-Varying Exposures
  • Customizing Weights Formulas
  • diff --git a/articles/Customize_Balancing_Formulas.html b/articles/Customize_Balancing_Formulas.html index 690bfc14..4c9f1df7 100644 --- a/articles/Customize_Balancing_Formulas.html +++ b/articles/Customize_Balancing_Formulas.html @@ -38,7 +38,7 @@
  • Terminology
  • Specify Core Inputs
  • Data Requirements & Preparation
  • -
  • Workflow for Continous Exposures
  • +
  • Workflow for Continous Exposures
  • Assessing Balance for Time-Varying Exposures
  • Customizing Weights Formulas
  • diff --git a/articles/Data_Requirements.html b/articles/Data_Requirements.html index 28fdda23..fb6fc7b2 100644 --- a/articles/Data_Requirements.html +++ b/articles/Data_Requirements.html @@ -38,7 +38,7 @@
  • Terminology
  • Specify Core Inputs
  • Data Requirements & Preparation
  • -
  • Workflow for Continous Exposures
  • +
  • Workflow for Continous Exposures
  • Assessing Balance for Time-Varying Exposures
  • Customizing Weights Formulas
  • @@ -98,12 +98,12 @@

    Data Requirements & Preparation

    - +

    Abridged example structure of a wide dataset formatted as required for the devMSMs. Column A denotes the ID variable, column B (green) denotes a time in-variant confounder (e.g., race, birth information), diff --git a/articles/Specify_Core_Inputs.html b/articles/Specify_Core_Inputs.html index a0455951..7cfd020a 100644 --- a/articles/Specify_Core_Inputs.html +++ b/articles/Specify_Core_Inputs.html @@ -38,7 +38,7 @@

  • Terminology
  • Specify Core Inputs
  • Data Requirements & Preparation
  • -
  • Workflow for Continous Exposures
  • +
  • Workflow for Continous Exposures
  • Assessing Balance for Time-Varying Exposures
  • Customizing Weights Formulas
  • diff --git a/articles/Terminology.html b/articles/Terminology.html index 42bcc28a..4eb3d092 100644 --- a/articles/Terminology.html +++ b/articles/Terminology.html @@ -38,7 +38,7 @@
  • Terminology
  • Specify Core Inputs
  • Data Requirements & Preparation
  • -
  • Workflow for Continous Exposures
  • +
  • Workflow for Continous Exposures
  • Assessing Balance for Time-Varying Exposures
  • Customizing Weights Formulas
  • @@ -80,12 +80,12 @@

    Terminology

    - +
    @@ -189,12 +189,12 @@

    Terminology

    -

    Summary of terminology used in devMSMs

    Term
    +

    Summary of the formula terminology used in the devMSMs package for creating balancing weights and assessing their performance in devMSMs (Workflows vignettes Steps 4-6). The different kinds @@ -289,12 +289,12 @@

    Terminology

    - +
    diff --git a/articles/Workflow_Continuous_Exposure.html b/articles/Workflow_Continuous_Exposure.html index 9e721d79..b4e2cc5d 100644 --- a/articles/Workflow_Continuous_Exposure.html +++ b/articles/Workflow_Continuous_Exposure.html @@ -32,13 +32,13 @@

    Summary of the 7 core functions of the devMSMs package.

    Function
    #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:---------------|:---------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.2410 |Min. :-2.4780 | #> | |1st Qu.:-0.3058 |1st Qu.:-0.3495 |1st Qu.:-0.4510 |1st Qu.:-0.5220 |1st Qu.:-0.4968 | #> | |Median : 0.3735 |Median : 0.2745 |Median : 0.1635 |Median : 0.1140 |Median : 0.1275 | #> | |Mean : 0.3405 |Mean : 0.2664 |Mean : 0.1591 |Mean : 0.1229 |Mean : 0.1159 | #> | |3rd Qu.: 0.9617 |3rd Qu.: 0.9217 |3rd Qu.: 0.8015 |3rd Qu.: 0.7750 |3rd Qu.: 0.7515 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.0140 |Max. : 3.1730 | #> | |NA's :258 |NA's :258 |NA's :258 |NA's :258 |NA's :258 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| NA.s| #> |------:|--------:|------:|---------:|--------:|-----:|----:| #> | -0.497| 0.29825| 0.488| 0.4989333| 0.7055| 1.448| 258| head(data_wide_f, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 s <- 1234 m <- 2 method <- \"rf\" maxit <- 0 imputed_data <- imputeData( data = data_wide_f, exposure = exposure, outcome = outcome, sep = \"\\\\.\", m = m, method = method, maxit = maxit, para_proc = FALSE, seed = s, read_imps_from_file = FALSE, home_dir = home_dir, save.out = save.out ) #> Creating 2 imputed datasets using the rf imputation method in mice::mice(). This may take some time to run. #> #> #> USER ALERT: Please view any logged events from the imputation below: #> Table: Logged Events from mice::mice head(mice::complete(imputed_data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 0 -4 1 3 #> 2 2 5 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 1 3 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.654 0.397 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 data <- imputed_data data(\"sim_data_imp_list\", package = \"devMSMs\") data <- sim_data_imp_list head(data[[1]], n = c(5, 10)) #> X ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 1 3 1 1 7 16 1 3 #> 2 2 2 4 -7 7 0 0 0 #> 3 3 3 6 5 20 -1 0 3 #> 4 4 4 24 25 17 11 0 3 #> 5 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 #> 1 -0.227 -0.652 #> 2 0.149 0.831 #> 3 1.145 0.033 #> 4 0.301 -0.501 #> 5 -0.247 0.084"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-1--single-long-data-frame","dir":"Articles","previous_headings":"","what":"P4.1. Single Long Data Frame","title":"Data Requirements & Preparation","text":"Users beginning single data frame long format (without missingness) can utilize helper function formatLongData() summarize exposure outcome data convert required variable names. First, load simulated longitudinal data long format (missingness) accompanies devMSMs. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (ESETA1) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (StrDif_Tot) measured 58 months. long data correctly formatted, formatLongData() allows users supply existing variables time (time_var), ID (id_var), missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. sep field allows specify delimeter integer indicates time point variable names. , format simulated long FLP data. get descriptive statistics summary exposure, ESETA1, outcome, StrDif_Tot.58, visual inspections. Users correctly formatted data long format option using following code transform data wide format, proceed using package (missing data) imputing (< 20% missing data MAR). transform newly formatted long data wide format, specifying idvar “ID”, timevar “WAVE”, supplying time points (encompassing exposure, confounder, outcome time points) data 6, 15, 24, 35, 58 times.","code":"data(\"sim_data_long_miss\", package = \"devMSMs\") data_long <- sim_data_long_miss head(data_long, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr RMomAgeU #> 1 1 0 1 27.245 0 0 1 15 24 29 #> 2 1 0 1 27.245 0 0 1 15 24 29 #> 3 1 0 1 27.245 0 0 1 15 24 29 #> 4 1 0 1 27.245 0 0 1 15 24 29 #> 5 1 0 1 27.245 0 0 1 15 24 29 factor_confounders <- c(\"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO\") integer_confounders <- c(\"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw\", \"EARS_TJo\", \"MDI\") data_long_f <- formatLongData( data = data_long, exposure = exposure, outcome = outcome, sep = \"\\\\.\", time_var = \"WAVE\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> Table: Summary of ESETA1 Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |15 | 0.2983433| 0.9261390| -2.699| 3.474| #> |24 | 0.1585387| 0.9575181| -2.858| 3.284| #> |35 | 0.1388395| 0.9475905| -3.046| 3.014| #> |58 | 0.0996006| 0.9924516| -2.478| 3.173| #> |6 | 0.3337979| 0.9298080| -2.809| 4.035| #> #> Table: Summary of StrDif_Tot Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |35 | 0.6009797| 0.2830620| -0.230| 1.536| #> |58 | 0.5029778| 0.2931918| -0.281| 1.448| #> Warning in formatLongData(data = data_long, exposure = exposure, outcome = #> outcome, : The following variables are characters. Please change them to #> integers and re-run: WAVE head(data_long_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr RMomAgeU #> 1 1 0 1 27.245 0 0 1 15 24 29 #> 2 1 0 1 27.245 0 0 1 15 24 29 #> 3 1 0 1 27.245 0 0 1 15 24 29 #> 4 1 0 1 27.245 0 0 1 15 24 29 #> 5 1 0 1 27.245 0 0 1 15 24 29 require(\"stats\", quietly = TRUE) sep <- \"\\\\.\" v <- sapply(strsplit(tv_conf[!grepl(\"\\\\:\", tv_conf)], sep), head, 1) v <- c(v[!duplicated(v)], sapply(strsplit(exposure[1], sep), head, 1)) data_wide_f <- stats::reshape( data = data_long_f, idvar = \"ID\", v.names = v, timevar = \"WAVE\", times = c(6, 15, 24, 35, 58), direction = \"wide\" ) data_wide_f <- data_wide_f[, colSums(is.na(data_wide_f)) < nrow(data_wide_f)] head(data_wide_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr #> 1 1 0 1 27.245 0 0 1 15 24 #> 6 10 1 0 16.014 0 1 0 13 18 #> 11 100 1 0 31.042 1 1 1 14 15 #> 16 1000 1 0 23.597 1 1 1 10 14 #> 21 1001 1 0 25.592 1 1 1 13 23 #> RMomAgeU #> 1 29 #> 6 30 #> 11 25 #> 16 31 #> 21 27"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-1a--format-long-data","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.1a. Format Long Data","title":"Data Requirements & Preparation","text":"long data correctly formatted, formatLongData() allows users supply existing variables time (time_var), ID (id_var), missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. sep field allows specify delimeter integer indicates time point variable names. , format simulated long FLP data. get descriptive statistics summary exposure, ESETA1, outcome, StrDif_Tot.58, visual inspections.","code":"factor_confounders <- c(\"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO\") integer_confounders <- c(\"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw\", \"EARS_TJo\", \"MDI\") data_long_f <- formatLongData( data = data_long, exposure = exposure, outcome = outcome, sep = \"\\\\.\", time_var = \"WAVE\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> Table: Summary of ESETA1 Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |15 | 0.2983433| 0.9261390| -2.699| 3.474| #> |24 | 0.1585387| 0.9575181| -2.858| 3.284| #> |35 | 0.1388395| 0.9475905| -3.046| 3.014| #> |58 | 0.0996006| 0.9924516| -2.478| 3.173| #> |6 | 0.3337979| 0.9298080| -2.809| 4.035| #> #> Table: Summary of StrDif_Tot Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |35 | 0.6009797| 0.2830620| -0.230| 1.536| #> |58 | 0.5029778| 0.2931918| -0.281| 1.448| #> Warning in formatLongData(data = data_long, exposure = exposure, outcome = #> outcome, : The following variables are characters. Please change them to #> integers and re-run: WAVE head(data_long_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr RMomAgeU #> 1 1 0 1 27.245 0 0 1 15 24 29 #> 2 1 0 1 27.245 0 0 1 15 24 29 #> 3 1 0 1 27.245 0 0 1 15 24 29 #> 4 1 0 1 27.245 0 0 1 15 24 29 #> 5 1 0 1 27.245 0 0 1 15 24 29"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-1b--tranform-formatted-long-data-to-wide","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.1b. Tranform Formatted Long Data to Wide","title":"Data Requirements & Preparation","text":"Users correctly formatted data long format option using following code transform data wide format, proceed using package (missing data) imputing (< 20% missing data MAR). transform newly formatted long data wide format, specifying idvar “ID”, timevar “WAVE”, supplying time points (encompassing exposure, confounder, outcome time points) data 6, 15, 24, 35, 58 times.","code":"require(\"stats\", quietly = TRUE) sep <- \"\\\\.\" v <- sapply(strsplit(tv_conf[!grepl(\"\\\\:\", tv_conf)], sep), head, 1) v <- c(v[!duplicated(v)], sapply(strsplit(exposure[1], sep), head, 1)) data_wide_f <- stats::reshape( data = data_long_f, idvar = \"ID\", v.names = v, timevar = \"WAVE\", times = c(6, 15, 24, 35, 58), direction = \"wide\" ) data_wide_f <- data_wide_f[, colSums(is.na(data_wide_f)) < nrow(data_wide_f)] head(data_wide_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr #> 1 1 0 1 27.245 0 0 1 15 24 #> 6 10 1 0 16.014 0 1 0 13 18 #> 11 100 1 0 31.042 1 1 1 14 15 #> 16 1000 1 0 23.597 1 1 1 10 14 #> 21 1001 1 0 25.592 1 1 1 13 23 #> RMomAgeU #> 1 29 #> 6 30 #> 11 25 #> 16 31 #> 21 27"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-2--single-wide-data-frame","dir":"Articles","previous_headings":"","what":"P4.2. Single Wide Data Frame","title":"Data Requirements & Preparation","text":"Alternatively, users start single data frame wide data (without missingness). , load single complete, wide data frame simulated FLP example. Data missingness common human data. read simulated wide FLP data missingness. Users beginning single unformatted data frame long format can utilize helper function formatWideData() summarize exposure outcome data convert required variable names. formatWideData() allows users supply existing variables ID (id_var) missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. user can also specify time point delimeter (sep). , format simulated wide FLP data listing variables make factors integers wide format (e.g., “variable.t”), well ID missingness indicators.","code":"data(\"sim_data_wide\", package = \"devMSMs\") data_wide <- sim_data_wide head(data_wide, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 data(\"sim_data_wide_miss\", package = \"devMSMs\") data_wide <- sim_data_wide_miss head(data_wide, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 factor_confounders <- c( \"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\" ) integer_confounders <- c( \"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"MDI.6\", \"MDI.15\" ) data_wide_f <- formatWideData( data = data_wide, exposure = exposure, outcome = outcome, sep = \"\\\\.\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:---------------|:---------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.2410 |Min. :-2.4780 | #> | |1st Qu.:-0.3058 |1st Qu.:-0.3495 |1st Qu.:-0.4510 |1st Qu.:-0.5220 |1st Qu.:-0.4968 | #> | |Median : 0.3735 |Median : 0.2745 |Median : 0.1635 |Median : 0.1140 |Median : 0.1275 | #> | |Mean : 0.3405 |Mean : 0.2664 |Mean : 0.1591 |Mean : 0.1229 |Mean : 0.1159 | #> | |3rd Qu.: 0.9617 |3rd Qu.: 0.9217 |3rd Qu.: 0.8015 |3rd Qu.: 0.7750 |3rd Qu.: 0.7515 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.0140 |Max. : 3.1730 | #> | |NA's :258 |NA's :258 |NA's :258 |NA's :258 |NA's :258 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| NA.s| #> |------:|--------:|------:|---------:|--------:|-----:|----:| #> | -0.497| 0.29825| 0.488| 0.4989333| 0.7055| 1.448| 258| head(data_wide_f, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-2a--format-wide-data","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.2a. Format Wide Data","title":"Data Requirements & Preparation","text":"Users beginning single unformatted data frame long format can utilize helper function formatWideData() summarize exposure outcome data convert required variable names. formatWideData() allows users supply existing variables ID (id_var) missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. user can also specify time point delimeter (sep). , format simulated wide FLP data listing variables make factors integers wide format (e.g., “variable.t”), well ID missingness indicators.","code":"factor_confounders <- c( \"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\" ) integer_confounders <- c( \"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"MDI.6\", \"MDI.15\" ) data_wide_f <- formatWideData( data = data_wide, exposure = exposure, outcome = outcome, sep = \"\\\\.\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:---------------|:---------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.2410 |Min. :-2.4780 | #> | |1st Qu.:-0.3058 |1st Qu.:-0.3495 |1st Qu.:-0.4510 |1st Qu.:-0.5220 |1st Qu.:-0.4968 | #> | |Median : 0.3735 |Median : 0.2745 |Median : 0.1635 |Median : 0.1140 |Median : 0.1275 | #> | |Mean : 0.3405 |Mean : 0.2664 |Mean : 0.1591 |Mean : 0.1229 |Mean : 0.1159 | #> | |3rd Qu.: 0.9617 |3rd Qu.: 0.9217 |3rd Qu.: 0.8015 |3rd Qu.: 0.7750 |3rd Qu.: 0.7515 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.0140 |Max. : 3.1730 | #> | |NA's :258 |NA's :258 |NA's :258 |NA's :258 |NA's :258 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| NA.s| #> |------:|--------:|------:|---------:|--------:|-----:|----:| #> | -0.497| 0.29825| 0.488| 0.4989333| 0.7055| 1.448| 258| head(data_wide_f, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-3--formatted-wide-data-with-missingness","dir":"Articles","previous_headings":"","what":"P4.3. Formatted Wide Data with Missingness","title":"Data Requirements & Preparation","text":"functions devMSMs package accept data form single data frame missing values m imputed datasets form either mids object (output mice package via imputeData()) list imputed datasets. developmental data humans amount missing data. Given creation IPTW balancing weights requires complete data, recommend imputing data. Imputation assumes missing data mechanism missing random (MAR) 20% missing data total (Leyrat et al., 2021). Given existing work demonstrating superiority, devMSMS implements ‘within’ approach imputed data, conducting steps imputed dataset pooling estimates using Rubin’s rules create final average predictions contrast comparisons Worfklows vignettes Step 5 (Leyrat et al, 2021; Granger et al., 2019). shown , users can use helper function impute wide data impute elsewhere read imputed data list use devMSMs. Users option using helper imputeData() function impute correctly formatted wide data. step can take run. user can specify many imputed datasets create (default m = 5). imputeData() draws mice() function mice package (van Buuren & Oudshoorn, 2011) conduct multiple imputation chained equations (mice). variables present dataset used impute missing data column. user can specify imputation method method field drawing following list: “pmm” (predictive mean matching), “midastouch” (weighted predictive mean matching), “sample” (random sample observed values), “rf” (random forest) “cart” (classification regression trees). Random forest imputation default given evidence efficiency superior performance (Shah et al., 2014). Please review mice documentation details. Additionally, users can specify integer value seed order offset random number generator mice() make reproducible imputations. parameter read_imps_from_file allow read already imputed data local storage (TRUE) re-run imputation code multiple times (FALSE; default). Users may use parameter supply mids object imputed data mice package (title ‘all_imp.rds’). sure inspect console warnings well resulting imputed datasets. variables missing data following imputation may need removed due high collinearity /low variability. required inputs function data frame wide format (formatted according pre-requirements listed ), m number imputed datasets create, path home directory (save.= TRUE), exposure (e.g., “variable”), outcome (e.g., “variable.t”). home directory path, exposure, outcome already defined user completed Specifying Core Inputs vignette. optional inputs follows. user can specify imputation method compatible mice() (see ). Additionally, user can specify maxit number interactions mice::mice() conduct (default 5). user can also specify para_proc, logical indicator indicating whether speed imputing using parallel processing (default = TRUE). draws 2 cores using functions parallel, doRNG, doParallel packages. user may also specify additional inputs accepted mice::mice() advise consulting [mice documentation] information. user can also indicate already created imputed datasets function wish read (read_imps_from_file = TRUE rather recreate (default). example, create 2 imputed datasets using default random forest method 0 iterations (just illustrative purposes), set seed reproducibility, assign output data use devMSMs. code takes time run. (Note: given challenges imputing data .rda files, set m = 2 maxit = 0 just illustrative purposes. recommend setting m = 5 maxit = 5 (mice default) running data.) inspect output console warnings mice(). mice object can now assigned data use deveMSMs package (see Workflows vignettes). Alternatively, user imputed datasets already created wide, formatted data using program mice, can read , list, files saved locally .csv files single folder. list can assigned data use deveMSMs package (see Workflows vignettes). , load list imputed data simulated FLP, example. (See example Rmarkdown file code files saved locally.)","code":"s <- 1234 m <- 2 method <- \"rf\" maxit <- 0 imputed_data <- imputeData( data = data_wide_f, exposure = exposure, outcome = outcome, sep = \"\\\\.\", m = m, method = method, maxit = maxit, para_proc = FALSE, seed = s, read_imps_from_file = FALSE, home_dir = home_dir, save.out = save.out ) #> Creating 2 imputed datasets using the rf imputation method in mice::mice(). This may take some time to run. #> #> #> USER ALERT: Please view any logged events from the imputation below: #> Table: Logged Events from mice::mice head(mice::complete(imputed_data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 0 -4 1 3 #> 2 2 5 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 1 3 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.654 0.397 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 data <- imputed_data data(\"sim_data_imp_list\", package = \"devMSMs\") data <- sim_data_imp_list head(data[[1]], n = c(5, 10)) #> X ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 1 3 1 1 7 16 1 3 #> 2 2 2 4 -7 7 0 0 0 #> 3 3 3 6 5 20 -1 0 3 #> 4 4 4 24 25 17 11 0 3 #> 5 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 #> 1 -0.227 -0.652 #> 2 0.149 0.831 #> 3 1.145 0.033 #> 4 0.301 -0.501 #> 5 -0.247 0.084"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-3a--multiply-impute-formatted-wide-data-frame-using-mice","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.3a. Multiply Impute Formatted, Wide Data Frame using MICE","title":"Data Requirements & Preparation","text":"Users option using helper imputeData() function impute correctly formatted wide data. step can take run. user can specify many imputed datasets create (default m = 5). imputeData() draws mice() function mice package (van Buuren & Oudshoorn, 2011) conduct multiple imputation chained equations (mice). variables present dataset used impute missing data column. user can specify imputation method method field drawing following list: “pmm” (predictive mean matching), “midastouch” (weighted predictive mean matching), “sample” (random sample observed values), “rf” (random forest) “cart” (classification regression trees). Random forest imputation default given evidence efficiency superior performance (Shah et al., 2014). Please review mice documentation details. Additionally, users can specify integer value seed order offset random number generator mice() make reproducible imputations. parameter read_imps_from_file allow read already imputed data local storage (TRUE) re-run imputation code multiple times (FALSE; default). Users may use parameter supply mids object imputed data mice package (title ‘all_imp.rds’). sure inspect console warnings well resulting imputed datasets. variables missing data following imputation may need removed due high collinearity /low variability. required inputs function data frame wide format (formatted according pre-requirements listed ), m number imputed datasets create, path home directory (save.= TRUE), exposure (e.g., “variable”), outcome (e.g., “variable.t”). home directory path, exposure, outcome already defined user completed Specifying Core Inputs vignette. optional inputs follows. user can specify imputation method compatible mice() (see ). Additionally, user can specify maxit number interactions mice::mice() conduct (default 5). user can also specify para_proc, logical indicator indicating whether speed imputing using parallel processing (default = TRUE). draws 2 cores using functions parallel, doRNG, doParallel packages. user may also specify additional inputs accepted mice::mice() advise consulting [mice documentation] information. user can also indicate already created imputed datasets function wish read (read_imps_from_file = TRUE rather recreate (default). example, create 2 imputed datasets using default random forest method 0 iterations (just illustrative purposes), set seed reproducibility, assign output data use devMSMs. code takes time run. (Note: given challenges imputing data .rda files, set m = 2 maxit = 0 just illustrative purposes. recommend setting m = 5 maxit = 5 (mice default) running data.) inspect output console warnings mice(). mice object can now assigned data use deveMSMs package (see Workflows vignettes).","code":"s <- 1234 m <- 2 method <- \"rf\" maxit <- 0 imputed_data <- imputeData( data = data_wide_f, exposure = exposure, outcome = outcome, sep = \"\\\\.\", m = m, method = method, maxit = maxit, para_proc = FALSE, seed = s, read_imps_from_file = FALSE, home_dir = home_dir, save.out = save.out ) #> Creating 2 imputed datasets using the rf imputation method in mice::mice(). This may take some time to run. #> #> #> USER ALERT: Please view any logged events from the imputation below: #> Table: Logged Events from mice::mice head(mice::complete(imputed_data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 0 -4 1 3 #> 2 2 5 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 1 3 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.654 0.397 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 data <- imputed_data"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-3b--read-in-as-a-list-of-wide-imputed-data-saved-locally","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.3b. Read in as a List of Wide Imputed Data Saved Locally","title":"Data Requirements & Preparation","text":"Alternatively, user imputed datasets already created wide, formatted data using program mice, can read , list, files saved locally .csv files single folder. list can assigned data use deveMSMs package (see Workflows vignettes). , load list imputed data simulated FLP, example. (See example Rmarkdown file code files saved locally.)","code":"data(\"sim_data_imp_list\", package = \"devMSMs\") data <- sim_data_imp_list head(data[[1]], n = c(5, 10)) #> X ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 1 3 1 1 7 16 1 3 #> 2 2 2 4 -7 7 0 0 0 #> 3 3 3 6 5 20 -1 0 3 #> 4 4 4 24 25 17 11 0 3 #> 5 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 #> 1 -0.227 -0.652 #> 2 0.149 0.831 #> 3 1.145 0.033 #> 4 0.301 -0.501 #> 5 -0.247 0.084"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Data Requirements & Preparation","text":"Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Kainz, K., Greifer, N., Givens, ., Swietek, K., Lombardi, B. M., Zietz, S., & Kohn, J. L. (2017). Improving Causal Inference: Recommendations Covariate Selection Balance Propensity Score Methods. Journal Society Social Work Research, 8(2), 279–303. https://doi.org/10.1086/691464 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-1-recommended-home-directory","dir":"Articles","previous_headings":"","what":"P3.1 Recommended: Home Directory","title":"Specify Core Inputs","text":"Users required specify home directory, quotations, path designated folder output package (without final forward slash), plan save intermediary final outputs package (default) setting save.= TRUE functions. sub directories created within home directory devMSMs functions automatically save.= TRUE.","code":"home_dir <- NA # home_dir <- '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa'"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-2-recommended-time-point-delimiter","dir":"Articles","previous_headings":"","what":"P3.2 Recommended: Time Point Delimiter","title":"Specify Core Inputs","text":"Users required use consistent delimiter parsing names time-varying variables (.e., exposure, time-varying confounders, outcome) name construct time point measured. default period user can specify delimiter. devMSMs assume integer final instance delimiter wihin variable name corresponds time point measured. delimiter shoudl used time-varying variables. Users can specify different delimiter character string regular expression (regex) form. , use default period time delimiter.","code":"sep <- \"\\\\.\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-3-required-exposure-variable","dir":"Articles","previous_headings":"","what":"P3.3 Required: Exposure Variable","title":"Specify Core Inputs","text":"exposure refers developmental construct hypothesized cause outcome. Users required specify exposure variable use functions devMSMs. exposure can either continuously distributed binary, package automatically detects. user must specify exposure, list character strings corresponding exposure variable wide format, appears dataset. time exposure measured appear suffix delimiter user’s choosing (time-varying confounders). user two options specifying exposure variablee, select option best serves theory regarding developmental timing practical constraints data modeling process. First, may specify exposure time points exposure measured data. means balancing formulas created (Steps 1a, 2a, 3b Workflows vignettes) IPTW weights created (Steps 2b, 3c Workflows vignettes) assessed (Steps 2c, 3a, 4 Workflows vignettes) time points. case, epochs specified, time points included exposure main effects final substantive model history comparison (Step 5 Workflows vignettes). Second, may specify subset theoretically important time points exposure measured data. means balancing formulas created IPTW weights created assessed time points. , epochs specified, subsetted time points included exposure main effects final substantive models. Importantly, exposure variables time point included exposure included time-varying confounders, used balancing purposes . specification exposure epochs kept consistent throughout use devMSMs package. user intends specify exposure epochs, user include time points encompassed epochs . user intend specify exposure epochs, exposure constitute exposure main effects final outcome model form basis histories used history comparison. case, user specifies 4 exposure time points, required conduct subset history comparisons (Step 5b Workflows vignettes), given base code (see hypotheses() function marginaleffects package) accommodate pairwise history comparisons 5 time points. example, elected create epochs infancy (6 15 months), toddlerhood (24 35 months), early childhood (58 months) include exposure time points.","code":"exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-4-required-for-continuous-exposure-high-and-low-cutoff-values","dir":"Articles","previous_headings":"","what":"P3.4 Required for Continuous Exposure: High and Low Cutoff Values","title":"Specify Core Inputs","text":"exposure variable continuously distributed (e.g., economic strain), inherent demarcation considered high versus low levels exposure. Given part MSM process involved examining different exposure histories –vary dose timing – development result different outcome levels, need specify considered high versus low levels exposure. continuous exposures, required recommended preliminary step Workflows vignette compareHistories() devMSMs function (see Workflows vignettes). specify hi_lo_cut, list two quantile values (0-1): first represents value considered high levels exposure second represents followed considered low levels exposure. values may revised following inspection sample distribution across resulting exposure histories recommended preliminary steps Workflows vignettes. final values used creating modeling effects exposure histories Step 5 Workflows vignettes. , specify 60th 30th percentiles demarcate high low levels economic strain exposure, respectively.","code":"hi_lo_cut <- c(0.6, 0.3)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-5-optional-exposure-epochs","dir":"Articles","previous_headings":"","what":"P3.5 Optional: Exposure Epochs","title":"Specify Core Inputs","text":"modeling effect exposure outcome MSM process, user option specify epochs exposure, grouping time points exposure meaningful categories. may useful cases user wishes establish balance using time points exposure measured, substantive hypotheses coarser timescales (e.g., infancy). epochs specified, time points exposure measured used creation exposure histories final step process. specified epoch must corresponding value (values can differ number entries shown ). specify epochs, users utilize optional epoch argument providing, character string, list user-created epoch labels, one exposure time point order listed exposure. user specifies exposure epochs, exposure main effects created epoch, exposure levels averaged epochs consist two time point values. exposure epochs arguments fitModel() compareHistories() devMSMs functions (see Workflows vignettes) specification kept consistent throughout use package vignettes. constitute main effects variables modeling relation exposure outcome (Workflows vignettes Step 5a) form basis estimating comparing exposure histories (Workflows vignettes Step 5b). epochs specified, exposure time points exposure field used aforementioned steps. , specify ‘infancy’ (“ESETA1.6”, “ESETA1.15), ‘toddlerhood’ (”ESETA1.24”, “ESETA1.35”), ‘childhood’ (“ESETA1.58”).","code":"epoch <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-6-recommended-hypotheses-relevant-exposure-histories","dir":"Articles","previous_headings":"","what":"P3.6 Recommended: Hypotheses-Relevant Exposure Histories","title":"Specify Core Inputs","text":"strongly recommend users selective histories, developmental sequences high low exposure (exposure time points epochs), vital testing hypotheses. recommend user estimates compares subset possible exposure histories using reference comparison fields (rather comparing possible exposure histories). user can specify custom subset exposure histories using reference comparison fields optional inputs compareHistories() devMSMs function (see Workflows vignettes). conduct customized comparisons, users must provide least one unique valid history (e.g., “l-l-l”) reference providing character string (list strings) lowercase l’s h’s (separated -), corresponding exposure epoch (exposure time point), signify sequence exposure levels (“low” “high”, respectively). supply reference history, comparisons provide least one unique valid history comparison , quotations, providing string (list strings) l’s h’s (separated “-”), corresponding exposure epoch, signify sequence exposure levels (“low” “high”, respectively) constitutes comparison exposure history/histories compared reference Step 5b Workflows vignettes. supply one comparisons, least one reference must specified. reference exposure history compared comparison history comparisons supplied multiple comparison correction. reference comparison specified, histories compared Step 5b Workflows vignettes. However, 4 exposure main effects (either epochs exposure time points), user required select subset history comparisons (Step 5b Workflows vignettes), given base code (see hypotheses() function marginaleffects package) accommodate pairwise history comparisons 5 time points). final reference comparison values established step used estimating comparing exposure histories Step 5b Workflows vignettes. , specify low economic strain epochs (“l-l-l”) reference event comparison high levels epochs (“h-h-h”) well histories contain 1 dose exposure high economic strain different epochs.","code":"reference <- c(\"l-l-l\") comparison <- c(\"h-h-h\", \"l-l-h\", \"h-l-l\", \"l-h-l\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-7-required-outcome-variable","dir":"Articles","previous_headings":"","what":"P3.7 Required: Outcome Variable","title":"Specify Core Inputs","text":"outcome refers developmental construct hypothesized caused exposure. Users also required specify outcome variable designated final time point, required input fitModel() compareHistories() functions devMSMs package. final time point equal (, ideally greater ) final exposure time point. Note instances outcome variable measured prior time points included time-varying confounders balancing purposes. Users must specify outcome, character string suffix time point collected, corresponding variable name wide data. outcome variables measured prior time points included time-varying confounders. example, specify behavior problems measured 58 months outcome.","code":"outcome <- \"StrDif_Tot.58\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-8-recommended-confounders","dir":"Articles","previous_headings":"","what":"P3.8 Recommended: Confounders","title":"Specify Core Inputs","text":"Specifying confounders critical successful implmentation MSMs. Confounders refer variables cause either exposure outcome, thus cause spurious relation exposure outcome. MSMs assume possible confounders measured. Time invariant confounders considered stable across developmental period studying. Specifying time invariant confounders ti_conf recommended use package input createFormulas() function devMSMS. Time invariant confounders include core demographic birth characteristics (e.g., sex, racial group membership, birth complications) might cause either exposure outcome, either directly proxy, suggested theory /evidenced strong associations existing literature. user wishes specify interactions, need manually create data listing . , user can also include interaction terms time invariant variables (e.g., “variable:variable”) inclusion balancing formula. Keep mind interactions include factor variables decomposed interactions factor level. ti_conf, list character strings, provide names confounders dataset time invariant. time suffix. , specify 18 time invariant confounders measured baseline study visit, prior first exposure time point. Time-varying confounders considered vary development, regardless many times measured dataset. Specifying time-varying confounders recommended use package input createFormulas() devMSMs function (see Workflows vignettes). tv_conf, list character strings, provide names variables wide format (e.g., “variable.t”) dataset time-varying, including exposure outcome variables specified respective fields (see ). time suffix following delimiter. Note time-varying confounders also include confounders measured repeatedly time points (e.g., InRatioCor) collected one several specific time points, missing time points, time invariant. Additionally, note user specify exposure time points tv_conf, lagged values exposure automatically included time-varying confounders creation formulas. user wishes specify interactions, need manually create data listing . , user can also include interaction terms time invariant variables (e.g., “variable:variable”) inclusion balancing formula. Keep mind interactions include factor variables decomposed interactions factor level. creating balancing formula exposure time point, default devMSMs include time-varying confounders measured exposure time point. often difficult differentiate confounders measured contemporaneously mediators, balancing mediator ill-advised. However, sometimes user may good evidence know given time-varying confounder mediator exposure even measured contemporaneously. case, may specify override package default retain given variable/set time-varying confoudners formulas exposure measured contemporaneously. concur_conf: list character strings, provide names time-varying confounders (wide format) wish included contemporaneously balancing formulas (overriding default include lagged confounders). user can now proceed Data Requirements Workflows vignettes.","code":"ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\") concur_conf <- \"B18Raw.6\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-8a-recommended-time-invariant-confounders","dir":"Articles","previous_headings":"","what":"P3.8a Recommended: Time Invariant Confounders","title":"Specify Core Inputs","text":"Time invariant confounders considered stable across developmental period studying. Specifying time invariant confounders ti_conf recommended use package input createFormulas() function devMSMS. Time invariant confounders include core demographic birth characteristics (e.g., sex, racial group membership, birth complications) might cause either exposure outcome, either directly proxy, suggested theory /evidenced strong associations existing literature. user wishes specify interactions, need manually create data listing . , user can also include interaction terms time invariant variables (e.g., “variable:variable”) inclusion balancing formula. Keep mind interactions include factor variables decomposed interactions factor level. ti_conf, list character strings, provide names confounders dataset time invariant. time suffix. , specify 18 time invariant confounders measured baseline study visit, prior first exposure time point.","code":"ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-8b-recommended-time-varying-confounders","dir":"Articles","previous_headings":"","what":"P3.8b Recommended: Time-varying Confounders","title":"Specify Core Inputs","text":"Time-varying confounders considered vary development, regardless many times measured dataset. Specifying time-varying confounders recommended use package input createFormulas() devMSMs function (see Workflows vignettes). tv_conf, list character strings, provide names variables wide format (e.g., “variable.t”) dataset time-varying, including exposure outcome variables specified respective fields (see ). time suffix following delimiter. Note time-varying confounders also include confounders measured repeatedly time points (e.g., InRatioCor) collected one several specific time points, missing time points, time invariant. Additionally, note user specify exposure time points tv_conf, lagged values exposure automatically included time-varying confounders creation formulas. user wishes specify interactions, need manually create data listing . , user can also include interaction terms time invariant variables (e.g., “variable:variable”) inclusion balancing formula. Keep mind interactions include factor variables decomposed interactions factor level.","code":"tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-8c-optional-concurrent-confounders","dir":"Articles","previous_headings":"","what":"P3.8c Optional: Concurrent Confounders","title":"Specify Core Inputs","text":"creating balancing formula exposure time point, default devMSMs include time-varying confounders measured exposure time point. often difficult differentiate confounders measured contemporaneously mediators, balancing mediator ill-advised. However, sometimes user may good evidence know given time-varying confounder mediator exposure even measured contemporaneously. case, may specify override package default retain given variable/set time-varying confoudners formulas exposure measured contemporaneously. concur_conf: list character strings, provide names time-varying confounders (wide format) wish included contemporaneously balancing formulas (overriding default include lagged confounders). user can now proceed Data Requirements Workflows vignettes.","code":"concur_conf <- \"B18Raw.6\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Specify Core Inputs","text":"Arel-Bundock, Vincent. 2024. marginaleffects: Predictions, Comparisons, Slopes, Marginal Means, Hypothesis Tests. https://CRAN.R-project.org/package=marginaleffects.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Terminology.html","id":"balancing-formula","dir":"Articles","previous_headings":"","what":"Balancing Formula","title":"Terminology","text":"table summarizes three formula type’s used. Table 2. Summary formula terminology used devMSMs package creating balancing weights assessing performance devMSMs (Workflows vignettes Steps 4-6). different kinds formulas vary respect inclusion time-varying confounders type specification create using createFormulas() function. type = \"full\" type = \"short\" type = \"update\"","code":"ESETA1.t ~ time-invariant confounders + time-varying confounders + lagged outcomes + lagged outcomes ESETA1.24 ~ B18Raw.15 + B18Raw.6 + BioDadInHH2 + CORTB.15 + CORTB.6 + DrnkFreq + ES.15 + ES.6 + gov_assist + HOMEETA1.15 + HOMEETA1.6 + HomeOwnd ... ESETA1.24 ~ B18Raw.15 + BioDadInHH2 + CORTB.15 + DrnkFreq + ES.15 + gov_assist + HOMEETA1.15 + HomeOwnd ... ESETA1.24 ~ B18Raw.15 + BioDadInHH2 + CORTB.15 + DrnkFreq + ES.6 + ES.15 + gov_assist + HOMEETA1.15 + HomeOwnd ..."},{"path":"https://istallworthy.github.io/devMSMs/articles/Terminology.html","id":"core-functions-of-devmsms","dir":"Articles","previous_headings":"","what":"7 core functions of devMSMs","title":"Terminology","text":"7 key functions used devMSMs workflow. Summary 7 core functions devMSMs package.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Workflow: Continuous Exposure","text":"devMSMs available CRAN, need install directly Github (https://github.com/istallworthy/devMSMs), shown . devMSMs functions option save objects ‘.rds’ files. Users can also save content print, summary, plot methods, illustrated sections . save, users must supply path home directory (home_dir) creating initial MSM object. Users can save home directory using default file labels (.txt file type) using save.= TRUE. saving tables, users option supply name file type (e.g., save.= “custom_name.png”). Allowable file types : .png, .html, .pdf, .tex, .md. sub-folders referenced function created automatically within home directory. recommend saving outputs future use provide commented examples . output saved , function automatically provides path file aid user reading output future. functions output tables. tinytables package can customized (e.g., dimensions, footnotes, captions, combined, etc.) according options provided package (https://vincentarelbundock.github.io/tinytable/vignettes/tinytable.html).","code":"options(repos = c(CRAN = \"https://cloud.r-project.org\")) install.packages(\"devtools\") #> Installing package into '/home/runner/work/_temp/Library' #> (as 'lib' is unspecified) require(\"devtools\", quietly = TRUE) devtools::install_github(\"istallworthy/devMSMs\", quiet = TRUE) library(devMSMs) devtools::install_github(\"istallworthy/devMSMsHelpers\", quiet = TRUE) library(devMSMsHelpers) save.out = FALSE"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"phase-0-preliminary-conceptual-data-preparation","dir":"Articles","previous_headings":"","what":"Phase 0: Preliminary Conceptual & Data Preparation","title":"Workflow: Continuous Exposure","text":"Please see accompanying manuscript steps P1 (creating hypotheses) P2 (creating DAG). first step create initial MSM object specifying core variables data use package. Please see Specifying Core Inputs vignette detail following core inputs. , specify data, exposure, time invariant time-varying confounders, well exposure epochs. several optional fields user specify MSM object. user also option specify concur_conf, indicating, list character strings, names time-varying confounders (e.g., “variable.time”) wish included concurrently weights formulas (overriding default include lagged confounders). done user strong evidence differentiate confounders mediators relation exposure contemporaneously. specify home directory given nature example, recommend save core function outputs. , use default period time delimiter. specify 6 time points exposure. , specify 60th 30th percentiles demarcate high low levels economic strain exposure, respectively. specify first two exposure time points (6 15 months) considered infancy, second two (34 25 months) toddlerhood, final (58 months) childhood. See Specify Core Inputs vignette information. , specify low economic strain epochs (“l-l-l”) reference event comparison high levels epochs (“h-h-h”) examine example question comparing causal effects 0 vs 3 doses exposure economic strain children’s behavior problems. specify outcome behavior problems 58 months. specify time-invariant time-varying confounders. specify concurrent confounders , given data, unable disentangle mediators colliders. highly recommend first implementing Data Requirements & Preparation Vignette https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html assigning variable, data, one following wide data formats (see Figure 1) use package: single data frame data wide format missing data mids object (output mice::mice()) data imputed wide format list data imputed wide format data frames See Data Preparation vignette detail. first load 2 imputed datasets mice object. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (“ESETA1”) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (“StrDif_Tot”) measured 58 months. (See Data Requirements & Preparation vignette beginning data types, including missing data). set seed reproducibility. , inspect MSMS object view confirm variables categorized. users, highly recommend use helper inspectData() function (complete dataset long wide format imputed data case missingness) summarize exposure, outcome, confounders inspect sample distribution among exposure histories. Based user-specified exposure epochs high low quantile values (continuous exposures), function outputs table showing sample distribution across histories. strongly suggest visually inspecting table revising designation epochs /high low quantile values (continuous exposures) history contains reasonable number participants. gold standard required number per history cell, users guard extrapolation beyond scope data. example, data, using 75th 25th percentile cutoffs, histories represented less two cases thus re-evaluated cutoffs. Users may wish revise epoch designation high low cutoff values, applicable. function conducts summaries history distribution inspection imputed dataset imputed data supplied. required inputs inspectData() : complete data (data frame wide long format, list imputed data frames wide format, mids object), exposure (e.g., “variable”), outcome (e.g., “variable.t”). exposure continuously distributed, user required supply hi_lo_cut values demarcating high low levels. Optional inputs home directory (save.= TRUE), epochs, high/low cutoff values continuous exposures, specification reference comparison histories. helper inspectData() function outputs following files home directory: correlation plot variables dataset, tables exposure outcome descriptive statistics, two summary tables confounders considered time point. , see summaries data types well reasonable cell counts specified histories, imputed dataset.","code":"# home_dir = '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa' sep <- \"\\\\.\" exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\") hi_lo_cut <- c(0.6, 0.3) epochs <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\") reference <- c(\"l-l-l\") comparison <- c(\"h-h-h\") outcome <- \"StrDif_Tot.58\" ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\") data(\"sim_data_mice\", package = \"devMSMs\") data <- sim_data_mice head(mice::complete(data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 7 16 1 3 #> 2 2 4 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.149 0.831 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 set.seed(1234) obj <- initMSM( data, exposure = c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\"), ti_conf = c(\"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\"), tv_conf = c(\"SAAmylase.6\",\"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\",\"RHasSO.35\", \"WndNbrhood.6\",\"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\"), epoch <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\"), sep = \"\\\\.\" ) print(obj) #> Exposure (continuous): ESETA1.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58 #> Corresponding epoch: Infancy, Infancy, Toddlerhood, Toddlerhood, Childhood #> Variable and their encodings: #> var type time #> ESETA1.6 exposure 6 #> ESETA1.15 exposure 15 #> ESETA1.24 exposure 24 #> ESETA1.35 exposure 35 #> ESETA1.58 exposure 58 #> SAAmylase.6 tv_conf 6 #> SAAmylase.15 tv_conf 15 #> SAAmylase.24 tv_conf 24 #> MDI.6 tv_conf 6 #> MDI.15 tv_conf 15 #> RHasSO.6 tv_conf 6 #> RHasSO.15 tv_conf 15 #> RHasSO.24 tv_conf 24 #> RHasSO.35 tv_conf 35 #> WndNbrhood.6 tv_conf 6 #> WndNbrhood.24 tv_conf 24 #> WndNbrhood.35 tv_conf 35 #> IBRAttn.6 tv_conf 6 #> IBRAttn.15 tv_conf 15 #> IBRAttn.24 tv_conf 24 #> B18Raw.6 tv_conf 6 #> B18Raw.15 tv_conf 15 #> B18Raw.24 tv_conf 24 #> HOMEETA1.6 tv_conf 6 #> HOMEETA1.15 tv_conf 15 #> HOMEETA1.24 tv_conf 24 #> HOMEETA1.35 tv_conf 35 #> InRatioCor.6 tv_conf 6 #> InRatioCor.15 tv_conf 15 #> InRatioCor.24 tv_conf 24 #> InRatioCor.35 tv_conf 35 #> CORTB.6 tv_conf 6 #> CORTB.15 tv_conf 15 #> CORTB.24 tv_conf 24 #> EARS_TJo.24 tv_conf 24 #> EARS_TJo.35 tv_conf 35 #> LESMnPos.24 tv_conf 24 #> LESMnPos.35 tv_conf 35 #> LESMnNeg.24 tv_conf 24 #> LESMnNeg.35 tv_conf 35 #> StrDif_Tot.35 tv_conf 35 #> fscore.35 tv_conf 35 #> state ti_conf -1 #> BioDadInHH2 ti_conf -1 #> PmAge2 ti_conf -1 #> PmBlac2 ti_conf -1 #> TcBlac2 ti_conf -1 #> PmMrSt2 ti_conf -1 #> PmEd2 ti_conf -1 #> KFASTScr ti_conf -1 #> RMomAgeU ti_conf -1 #> RHealth ti_conf -1 #> HomeOwnd ti_conf -1 #> SWghtLB ti_conf -1 #> SurpPreg ti_conf -1 #> SmokTotl ti_conf -1 #> DrnkFreq ti_conf -1 #> peri_health ti_conf -1 #> caregiv_health ti_conf -1 #> gov_assist ti_conf -1 inspectData(data = data, obj = obj, outcome = outcome, hi_lo_cut = hi_lo_cut, reference = reference, comparison = comparison, verbose = TRUE, save.out = save.out) #> Imputation 1 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.4193 |1st Qu.:-0.4153 |1st Qu.:-0.4665 |1st Qu.:-0.57050 |1st Qu.:-0.51100 | #> | |Median : 0.3030 |Median : 0.2165 |Median : 0.1445 |Median : 0.07300 |Median : 0.05650 | #> | |Mean : 0.2765 |Mean : 0.2115 |Mean : 0.1154 |Mean : 0.08565 |Mean : 0.07673 | #> | |3rd Qu.: 0.9000 |3rd Qu.: 0.8620 |3rd Qu.: 0.7258 |3rd Qu.: 0.74075 |3rd Qu.: 0.71425 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|---------:|--------:|-----:| #> | -0.497| 0.297| 0.48| 0.4897314| 0.689| 1.448| #> Imputation 2 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 218 | #> +---------------+-----+ #> | l-l-l | 115 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.3245 |1st Qu.:-0.4133 |1st Qu.:-0.5020 |1st Qu.:-0.56900 |1st Qu.:-0.53350 | #> | |Median : 0.3440 |Median : 0.2215 |Median : 0.1160 |Median : 0.07400 |Median : 0.08300 | #> | |Mean : 0.3201 |Mean : 0.2022 |Mean : 0.1229 |Mean : 0.08662 |Mean : 0.07949 | #> | |3rd Qu.: 0.9423 |3rd Qu.: 0.8482 |3rd Qu.: 0.7380 |3rd Qu.: 0.74625 |3rd Qu.: 0.70550 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|--------:|--------:|-----:| #> | -0.497| 0.29675| 0.472| 0.489219| 0.69325| 1.448| #> [[1]] #> NULL #> #> [[2]] #> NULL"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-p3--specify-core-inputs","dir":"Articles","previous_headings":"","what":"STEP P3. Specify Core Inputs","title":"Workflow: Continuous Exposure","text":"first step create initial MSM object specifying core variables data use package. Please see Specifying Core Inputs vignette detail following core inputs. , specify data, exposure, time invariant time-varying confounders, well exposure epochs. several optional fields user specify MSM object. user also option specify concur_conf, indicating, list character strings, names time-varying confounders (e.g., “variable.time”) wish included concurrently weights formulas (overriding default include lagged confounders). done user strong evidence differentiate confounders mediators relation exposure contemporaneously. specify home directory given nature example, recommend save core function outputs. , use default period time delimiter. specify 6 time points exposure. , specify 60th 30th percentiles demarcate high low levels economic strain exposure, respectively. specify first two exposure time points (6 15 months) considered infancy, second two (34 25 months) toddlerhood, final (58 months) childhood. See Specify Core Inputs vignette information. , specify low economic strain epochs (“l-l-l”) reference event comparison high levels epochs (“h-h-h”) examine example question comparing causal effects 0 vs 3 doses exposure economic strain children’s behavior problems. specify outcome behavior problems 58 months. specify time-invariant time-varying confounders. specify concurrent confounders , given data, unable disentangle mediators colliders.","code":"# home_dir = '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa' sep <- \"\\\\.\" exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\") hi_lo_cut <- c(0.6, 0.3) epochs <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\") reference <- c(\"l-l-l\") comparison <- c(\"h-h-h\") outcome <- \"StrDif_Tot.58\" ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-1-recommended-home-directory","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.1 Recommended: Home Directory","title":"Workflow: Continuous Exposure","text":"specify home directory given nature example, recommend save core function outputs.","code":"# home_dir = '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa'"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-2-recommended-time-point-delimiter","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.2 Recommended: Time Point Delimiter","title":"Workflow: Continuous Exposure","text":", use default period time delimiter.","code":"sep <- \"\\\\.\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-3-required-exposure-variable","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.3 Required: Exposure Variable","title":"Workflow: Continuous Exposure","text":"specify 6 time points exposure.","code":"exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-4--required-for-continuous-exposures-identify-high-and-low-cutoff-values","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.4. Required for Continuous Exposures: Identify High and Low Cutoff Values","title":"Workflow: Continuous Exposure","text":", specify 60th 30th percentiles demarcate high low levels economic strain exposure, respectively.","code":"hi_lo_cut <- c(0.6, 0.3)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-5-optional-exposure-epochs","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.5 Optional: Exposure Epochs","title":"Workflow: Continuous Exposure","text":"specify first two exposure time points (6 15 months) considered infancy, second two (34 25 months) toddlerhood, final (58 months) childhood.","code":"epochs <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-6-recommended-hypotheses-relevant-exposure-histories","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.6 Recommended: Hypotheses-Relevant Exposure Histories","title":"Workflow: Continuous Exposure","text":"See Specify Core Inputs vignette information. , specify low economic strain epochs (“l-l-l”) reference event comparison high levels epochs (“h-h-h”) examine example question comparing causal effects 0 vs 3 doses exposure economic strain children’s behavior problems.","code":"reference <- c(\"l-l-l\") comparison <- c(\"h-h-h\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-7-required-outcome-variable","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.7 Required: Outcome Variable","title":"Workflow: Continuous Exposure","text":"specify outcome behavior problems 58 months.","code":"outcome <- \"StrDif_Tot.58\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-8-recommended-confounders","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.8 Recommended: Confounders","title":"Workflow: Continuous Exposure","text":"specify time-invariant time-varying confounders.","code":"ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-8c-optional-concurrent-confounders","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.8c Optional: Concurrent Confounders","title":"Workflow: Continuous Exposure","text":"specify concurrent confounders , given data, unable disentangle mediators colliders.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-p4--data-preparation-inspection","dir":"Articles","previous_headings":"","what":"STEP P4. Data Preparation & Inspection","title":"Workflow: Continuous Exposure","text":"highly recommend first implementing Data Requirements & Preparation Vignette https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html assigning variable, data, one following wide data formats (see Figure 1) use package: single data frame data wide format missing data mids object (output mice::mice()) data imputed wide format list data imputed wide format data frames See Data Preparation vignette detail. first load 2 imputed datasets mice object. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (“ESETA1”) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (“StrDif_Tot”) measured 58 months. (See Data Requirements & Preparation vignette beginning data types, including missing data). set seed reproducibility. , inspect MSMS object view confirm variables categorized. users, highly recommend use helper inspectData() function (complete dataset long wide format imputed data case missingness) summarize exposure, outcome, confounders inspect sample distribution among exposure histories. Based user-specified exposure epochs high low quantile values (continuous exposures), function outputs table showing sample distribution across histories. strongly suggest visually inspecting table revising designation epochs /high low quantile values (continuous exposures) history contains reasonable number participants. gold standard required number per history cell, users guard extrapolation beyond scope data. example, data, using 75th 25th percentile cutoffs, histories represented less two cases thus re-evaluated cutoffs. Users may wish revise epoch designation high low cutoff values, applicable. function conducts summaries history distribution inspection imputed dataset imputed data supplied. required inputs inspectData() : complete data (data frame wide long format, list imputed data frames wide format, mids object), exposure (e.g., “variable”), outcome (e.g., “variable.t”). exposure continuously distributed, user required supply hi_lo_cut values demarcating high low levels. Optional inputs home directory (save.= TRUE), epochs, high/low cutoff values continuous exposures, specification reference comparison histories. helper inspectData() function outputs following files home directory: correlation plot variables dataset, tables exposure outcome descriptive statistics, two summary tables confounders considered time point. , see summaries data types well reasonable cell counts specified histories, imputed dataset.","code":"data(\"sim_data_mice\", package = \"devMSMs\") data <- sim_data_mice head(mice::complete(data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 7 16 1 3 #> 2 2 4 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.149 0.831 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 set.seed(1234) obj <- initMSM( data, exposure = c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\"), ti_conf = c(\"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\"), tv_conf = c(\"SAAmylase.6\",\"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\",\"RHasSO.35\", \"WndNbrhood.6\",\"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\"), epoch <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\"), sep = \"\\\\.\" ) print(obj) #> Exposure (continuous): ESETA1.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58 #> Corresponding epoch: Infancy, Infancy, Toddlerhood, Toddlerhood, Childhood #> Variable and their encodings: #> var type time #> ESETA1.6 exposure 6 #> ESETA1.15 exposure 15 #> ESETA1.24 exposure 24 #> ESETA1.35 exposure 35 #> ESETA1.58 exposure 58 #> SAAmylase.6 tv_conf 6 #> SAAmylase.15 tv_conf 15 #> SAAmylase.24 tv_conf 24 #> MDI.6 tv_conf 6 #> MDI.15 tv_conf 15 #> RHasSO.6 tv_conf 6 #> RHasSO.15 tv_conf 15 #> RHasSO.24 tv_conf 24 #> RHasSO.35 tv_conf 35 #> WndNbrhood.6 tv_conf 6 #> WndNbrhood.24 tv_conf 24 #> WndNbrhood.35 tv_conf 35 #> IBRAttn.6 tv_conf 6 #> IBRAttn.15 tv_conf 15 #> IBRAttn.24 tv_conf 24 #> B18Raw.6 tv_conf 6 #> B18Raw.15 tv_conf 15 #> B18Raw.24 tv_conf 24 #> HOMEETA1.6 tv_conf 6 #> HOMEETA1.15 tv_conf 15 #> HOMEETA1.24 tv_conf 24 #> HOMEETA1.35 tv_conf 35 #> InRatioCor.6 tv_conf 6 #> InRatioCor.15 tv_conf 15 #> InRatioCor.24 tv_conf 24 #> InRatioCor.35 tv_conf 35 #> CORTB.6 tv_conf 6 #> CORTB.15 tv_conf 15 #> CORTB.24 tv_conf 24 #> EARS_TJo.24 tv_conf 24 #> EARS_TJo.35 tv_conf 35 #> LESMnPos.24 tv_conf 24 #> LESMnPos.35 tv_conf 35 #> LESMnNeg.24 tv_conf 24 #> LESMnNeg.35 tv_conf 35 #> StrDif_Tot.35 tv_conf 35 #> fscore.35 tv_conf 35 #> state ti_conf -1 #> BioDadInHH2 ti_conf -1 #> PmAge2 ti_conf -1 #> PmBlac2 ti_conf -1 #> TcBlac2 ti_conf -1 #> PmMrSt2 ti_conf -1 #> PmEd2 ti_conf -1 #> KFASTScr ti_conf -1 #> RMomAgeU ti_conf -1 #> RHealth ti_conf -1 #> HomeOwnd ti_conf -1 #> SWghtLB ti_conf -1 #> SurpPreg ti_conf -1 #> SmokTotl ti_conf -1 #> DrnkFreq ti_conf -1 #> peri_health ti_conf -1 #> caregiv_health ti_conf -1 #> gov_assist ti_conf -1 inspectData(data = data, obj = obj, outcome = outcome, hi_lo_cut = hi_lo_cut, reference = reference, comparison = comparison, verbose = TRUE, save.out = save.out) #> Imputation 1 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.4193 |1st Qu.:-0.4153 |1st Qu.:-0.4665 |1st Qu.:-0.57050 |1st Qu.:-0.51100 | #> | |Median : 0.3030 |Median : 0.2165 |Median : 0.1445 |Median : 0.07300 |Median : 0.05650 | #> | |Mean : 0.2765 |Mean : 0.2115 |Mean : 0.1154 |Mean : 0.08565 |Mean : 0.07673 | #> | |3rd Qu.: 0.9000 |3rd Qu.: 0.8620 |3rd Qu.: 0.7258 |3rd Qu.: 0.74075 |3rd Qu.: 0.71425 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|---------:|--------:|-----:| #> | -0.497| 0.297| 0.48| 0.4897314| 0.689| 1.448| #> Imputation 2 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 218 | #> +---------------+-----+ #> | l-l-l | 115 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.3245 |1st Qu.:-0.4133 |1st Qu.:-0.5020 |1st Qu.:-0.56900 |1st Qu.:-0.53350 | #> | |Median : 0.3440 |Median : 0.2215 |Median : 0.1160 |Median : 0.07400 |Median : 0.08300 | #> | |Mean : 0.3201 |Mean : 0.2022 |Mean : 0.1229 |Mean : 0.08662 |Mean : 0.07949 | #> | |3rd Qu.: 0.9423 |3rd Qu.: 0.8482 |3rd Qu.: 0.7380 |3rd Qu.: 0.74625 |3rd Qu.: 0.70550 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|--------:|--------:|-----:| #> | -0.497| 0.29675| 0.472| 0.489219| 0.69325| 1.448| #> [[1]] #> NULL #> #> [[2]] #> NULL"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p4-3b--required-read-in-wide-data","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P4.3b. Required: Read in Wide Data","title":"Workflow: Continuous Exposure","text":"highly recommend first implementing Data Requirements & Preparation Vignette https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html assigning variable, data, one following wide data formats (see Figure 1) use package: single data frame data wide format missing data mids object (output mice::mice()) data imputed wide format list data imputed wide format data frames See Data Preparation vignette detail. first load 2 imputed datasets mice object. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (“ESETA1”) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (“StrDif_Tot”) measured 58 months. (See Data Requirements & Preparation vignette beginning data types, including missing data).","code":"data(\"sim_data_mice\", package = \"devMSMs\") data <- sim_data_mice head(mice::complete(data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 7 16 1 3 #> 2 2 4 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.149 0.831 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p4-4-required-create-msm-object","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P4.4 Required: Create MSM Object","title":"Workflow: Continuous Exposure","text":"set seed reproducibility. , inspect MSMS object view confirm variables categorized.","code":"set.seed(1234) obj <- initMSM( data, exposure = c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\"), ti_conf = c(\"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\"), tv_conf = c(\"SAAmylase.6\",\"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\",\"RHasSO.35\", \"WndNbrhood.6\",\"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\"), epoch <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\"), sep = \"\\\\.\" ) print(obj) #> Exposure (continuous): ESETA1.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58 #> Corresponding epoch: Infancy, Infancy, Toddlerhood, Toddlerhood, Childhood #> Variable and their encodings: #> var type time #> ESETA1.6 exposure 6 #> ESETA1.15 exposure 15 #> ESETA1.24 exposure 24 #> ESETA1.35 exposure 35 #> ESETA1.58 exposure 58 #> SAAmylase.6 tv_conf 6 #> SAAmylase.15 tv_conf 15 #> SAAmylase.24 tv_conf 24 #> MDI.6 tv_conf 6 #> MDI.15 tv_conf 15 #> RHasSO.6 tv_conf 6 #> RHasSO.15 tv_conf 15 #> RHasSO.24 tv_conf 24 #> RHasSO.35 tv_conf 35 #> WndNbrhood.6 tv_conf 6 #> WndNbrhood.24 tv_conf 24 #> WndNbrhood.35 tv_conf 35 #> IBRAttn.6 tv_conf 6 #> IBRAttn.15 tv_conf 15 #> IBRAttn.24 tv_conf 24 #> B18Raw.6 tv_conf 6 #> B18Raw.15 tv_conf 15 #> B18Raw.24 tv_conf 24 #> HOMEETA1.6 tv_conf 6 #> HOMEETA1.15 tv_conf 15 #> HOMEETA1.24 tv_conf 24 #> HOMEETA1.35 tv_conf 35 #> InRatioCor.6 tv_conf 6 #> InRatioCor.15 tv_conf 15 #> InRatioCor.24 tv_conf 24 #> InRatioCor.35 tv_conf 35 #> CORTB.6 tv_conf 6 #> CORTB.15 tv_conf 15 #> CORTB.24 tv_conf 24 #> EARS_TJo.24 tv_conf 24 #> EARS_TJo.35 tv_conf 35 #> LESMnPos.24 tv_conf 24 #> LESMnPos.35 tv_conf 35 #> LESMnNeg.24 tv_conf 24 #> LESMnNeg.35 tv_conf 35 #> StrDif_Tot.35 tv_conf 35 #> fscore.35 tv_conf 35 #> state ti_conf -1 #> BioDadInHH2 ti_conf -1 #> PmAge2 ti_conf -1 #> PmBlac2 ti_conf -1 #> TcBlac2 ti_conf -1 #> PmMrSt2 ti_conf -1 #> PmEd2 ti_conf -1 #> KFASTScr ti_conf -1 #> RMomAgeU ti_conf -1 #> RHealth ti_conf -1 #> HomeOwnd ti_conf -1 #> SWghtLB ti_conf -1 #> SurpPreg ti_conf -1 #> SmokTotl ti_conf -1 #> DrnkFreq ti_conf -1 #> peri_health ti_conf -1 #> caregiv_health ti_conf -1 #> gov_assist ti_conf -1"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p4-5--recommended-inspect-exposure-histories-and-data","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P4.5. Recommended: Inspect Exposure Histories and Data","title":"Workflow: Continuous Exposure","text":"users, highly recommend use helper inspectData() function (complete dataset long wide format imputed data case missingness) summarize exposure, outcome, confounders inspect sample distribution among exposure histories. Based user-specified exposure epochs high low quantile values (continuous exposures), function outputs table showing sample distribution across histories. strongly suggest visually inspecting table revising designation epochs /high low quantile values (continuous exposures) history contains reasonable number participants. gold standard required number per history cell, users guard extrapolation beyond scope data. example, data, using 75th 25th percentile cutoffs, histories represented less two cases thus re-evaluated cutoffs. Users may wish revise epoch designation high low cutoff values, applicable. function conducts summaries history distribution inspection imputed dataset imputed data supplied. required inputs inspectData() : complete data (data frame wide long format, list imputed data frames wide format, mids object), exposure (e.g., “variable”), outcome (e.g., “variable.t”). exposure continuously distributed, user required supply hi_lo_cut values demarcating high low levels. Optional inputs home directory (save.= TRUE), epochs, high/low cutoff values continuous exposures, specification reference comparison histories. helper inspectData() function outputs following files home directory: correlation plot variables dataset, tables exposure outcome descriptive statistics, two summary tables confounders considered time point. , see summaries data types well reasonable cell counts specified histories, imputed dataset.","code":"inspectData(data = data, obj = obj, outcome = outcome, hi_lo_cut = hi_lo_cut, reference = reference, comparison = comparison, verbose = TRUE, save.out = save.out) #> Imputation 1 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.4193 |1st Qu.:-0.4153 |1st Qu.:-0.4665 |1st Qu.:-0.57050 |1st Qu.:-0.51100 | #> | |Median : 0.3030 |Median : 0.2165 |Median : 0.1445 |Median : 0.07300 |Median : 0.05650 | #> | |Mean : 0.2765 |Mean : 0.2115 |Mean : 0.1154 |Mean : 0.08565 |Mean : 0.07673 | #> | |3rd Qu.: 0.9000 |3rd Qu.: 0.8620 |3rd Qu.: 0.7258 |3rd Qu.: 0.74075 |3rd Qu.: 0.71425 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|---------:|--------:|-----:| #> | -0.497| 0.297| 0.48| 0.4897314| 0.689| 1.448| #> Imputation 2 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 218 | #> +---------------+-----+ #> | l-l-l | 115 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.3245 |1st Qu.:-0.4133 |1st Qu.:-0.5020 |1st Qu.:-0.56900 |1st Qu.:-0.53350 | #> | |Median : 0.3440 |Median : 0.2215 |Median : 0.1160 |Median : 0.07400 |Median : 0.08300 | #> | |Mean : 0.3201 |Mean : 0.2022 |Mean : 0.1229 |Mean : 0.08662 |Mean : 0.07949 | #> | |3rd Qu.: 0.9423 |3rd Qu.: 0.8482 |3rd Qu.: 0.7380 |3rd Qu.: 0.74625 |3rd Qu.: 0.70550 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|--------:|--------:|-----:| #> | -0.497| 0.29675| 0.472| 0.489219| 0.69325| 1.448| #> [[1]] #> NULL #> #> [[2]] #> NULL"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"phase-1-confounder-adjustment","dir":"Articles","previous_headings":"","what":"PHASE 1: Confounder Adjustment","title":"Workflow: Continuous Exposure","text":"goal first phase minimize associations confounders exposure using IPTW balancing weights. strongly advise user carefully inspect weights formula ensure weights created evaluated appropriately step. first create comprehensive, full weights formulas relating exposure confounders time point using createFormulas() function (type = “full”). step creates full formulas containing measured confounding variables exposure time point, including time-invariant confounders lagged time-varying confounders. code automatically excludes time-varying confounders contemporaneous time point given decisively differentiated mediators balanced (Thoemmes & Ong, 2016), although can modified user strong reason believe concurrent variable truly confounder (see ). user wishes specify interactions confounders weights formulas, need manually create data listing . Keep mind interactions include factor variables decomposed interactions factor level. required input create full weights formulas using createFormulas() function : MSM object (e.g., “obj”) setting type = “full”. Optional inputs create full weights formulas using createFormulas() function follows. user may specify list custom formulas specifying custom list formulas, one exposure time point (e.g., “exposure.time ~ variable.time + variable +…”) formula format. recommend first running createFormulas() function without custom formulas (custom = NULL) using output model required format custom formulas. createFormulas() function automatically check custom formulas ensure correctly formatted formula exposure time point exposure dependent variable. However, user responsible ensuring custom formulas contain appropriate confounders formula type generating. Please see Customize weights formulas vignette detail customize formulas. chose create custom formulas instead use createFormulas() make automatically example. first create full formulas. function returns list formulas, one exposure time point. inspect . full formula contains time invariant confounders well lagged time-varying confounders time point. inspection important step, verify appropriate confounders present formula. inspect formulas . next step examines initial imbalance, strongly exposure relates confounder time point, measured confounders prior weighting using assessBalance() function. function draws calcBalStats() function (see Assessing Balance Time-Varying Exposure section accompanying manuscript). assessBalance() function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). required inputs using assessBalance() function conduct pre-balance testing : data (data frame, mids object, list imputed datasets dataframes wide format) MSM object (e.g., “obj”). Please see Assessing Balance Time-Varying Exposures vignette detail function calculates balance. optional inputs follows. user may specify balance_thresh, threshold(s) determining confounder balance, one two ways. * First, can provide single number value (0-1) absolute value standardized balance statistic (either correlation continuous exposures standardized group mean difference binary exposures) exposure confounders confounders considered balanced, considered imbalanced (default 0.1; Stuart, 2010). Second, users may make priori assertion confounders important others based theory existing research. case, can provide two numbers represent balance thresholds important less important confounders, respectively. user supplies two balance thresholds, must also supply list important confounders (time-varying: “variable.t”, time invariant: “variable”) imp_conf field. balance threshold specification kept consistent throughout use workflow. , recommended, provide two balancing thresholds identify income parent education important confounders relation economic strain behavior problems. create prebalance statistics . function returns list (one entry per imputed dataset, applicable), contains table exposure time point. able contains confounders time point, associated standardized balance statistics relating confounder exposure time point, user-supplied balance threshold, binary indicator whether confounder balanced. shown , can print, summarize, plot several versions balance statistics option supply save.save viewed output home directory. functions takes optional t field view balance statistics one exposure time points. t takes integer value 1 total number time points. specified, output shown exposure time points. imputed data, functions takes option field can used view balance one imputed data set. specified, output shown averaged across absolute values balance statistics imputed datasets. can useful average across imputed datasets get overall sense balance. non-imputed data, specify . can view prebalance statistics single imputed dataset (e.g., first imputed dataset), using field. Note supply t integers 1 however number time points exposure measured. example, first time point measures ESETA1 6 months corresponds t = 1. , can view prebalance statistics averaged across imputed data sets different time points specifying . can also used view balance statistics data imputed. can also summarize assessBalance() output view average remaining relation confounders exposure well summary table showing total number imbalanced confounders exposure time point. can view one imputed dataset averaged across . Averaging across imputed datasets, see xx confounders imbalanced respect economic strain exposure respective balance threshold. Lastly, can plot balance summary one time points, one imputed dataset averaged across . dotted red lines denote balance thresholds points colored labeled red denote confounders imbalanced relation respective balance thresholds. love plots depict standardized associations confounder exposure exposure time point, vertical red dashed lines indicating balance thresholds. Imbalanced confounders shown red variable name labels. goal second step create shortened, parsimonious weights formulas determining optimal IPTW weighting method successfully reduces imbalance data. First, create shorter, parsimonious weights formulas relating exposure confounders time point using createFormulas() function (type = “short”). exposure time point, formulas contain time invariant confounders well time-varying confounders t-1 lag. logic balancing confounders recent prior time point (t-1 ) may achieve balance levels distal time points, given stability many confounders time. Importantly, empirically assess relax assumption needed subsequent steps (Steps 3a-b). required input create shortened weights formulas using createFormulas() function : MSM object (e.g., ‘obj’) setting type = “short”. addition optional input outlined Step 1a, user also option specify keep_conf, list time-varying confounders (e.g., “variable.t”) always retain lagged confounders shortened formulas. user may use argument retain specific time-varying confounders otherwise excluded step occur lags greater t-1 formula. create short formulas . get list entries containing formula exposure time point. inspect make sure contain time-varying covariates lag one prior exposure time point. formulas considerably shorter full formulas. instance, 58-month exposure time point, formula contains time invariant confounders time-varying confounders 35-month time point. created shorter, simplified weights formulas, now create first round IPTW balancing weights (Thoemmes & Ong, 2016) using createWeights() function, shortened weights formulas, available weighting methods. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016), distributions can saved inspection. required inputs using createWeights() function create initial around IPTW balancing weights : MSM object (e.g, ‘obj’), complete data (data frame, mids object, list imputed datasets dataframes wide format), short formulas (see Step 2a). specify short formulas . optional inputs follows. method, provide one following methods calculating balancing weights using weightitMSM() methods validated longitudinal exposures: “cbps” (Covariate Balancing Propensity Score weighting), “gbm” (generalized boosted model), “glm” (generalized linear model; default), “super” (SuperLearner via SuperLearner package; Polley et al., 2013). information can found WeightIt documentation. begin specifying CBPS weighting method. createWeights() function can also take number additional arguments accapted weightitMSM() function (e.g., ‘criterion’, distribution’, ‘SL.library’). package defaults correspond weightIt defaults. user selects SuperLearner (“super”) method, default super learner libraries (‘SL.library’) “SL.glm” “SL.glm.interaction” alternative library can entered input createWeights function. binary exposures, “cbps” method allows specify estimand either ATE, ATT, ATC. “glm”, “super”, “bart” can specify ATE, ATT, ATC, ATO, ATM, ATOS. “gbm”, can specify ATE, ATT, ATC, ATO, ATM. default estimand binary exposures ATE. advise interested user review WeightIt documentation information additional optional arguments available weighting methods. Users option specify verbose = TRUE view information weights creation. function returns list weights objects form WeightItMSM output (entry imputed dataset appropriate). , create IPTW weights using default CBPS method. take run. Note save weights (supplying save.= TRUE custom file name createWeights() home directory initMWM()), function outputs file path use reading weights future use. can useful given weighting methods can take long time run, especially imputed datasets. previously saved CBPS weights, read instead re-creating . Given separate set weights created imputed dataset, conduct inspections imputed dataset. First, view basic statistics CBPS weights given imputed dataset. , note median weight value 0.77 (SD= 1.18) fairly extensive range 0 - 9. Next, look inside output summarize weighting process (drawing summary method weightIt, given imputed dataset. summary also provides effective sample size, sample size results applying weights original sample size, time point. Weighting can often result effective weighted sample size smaller orignal sample size something keep mind evaluating weighting methods. example, see original 1,292 sample reduced 605 upon weighting CBPS method. view distribution plot weights one imputed dataset. user option supply save.save plots home directory. shown , distribution heavy right tail (typical real-world data). right tail distribution represents individuals experienced statistically unexpected levels exposure given levels confounders. create inspect IPTW balancing weights using available methods order evaluate compare performance subsequent steps. , summarize plot averaging across imputed datasets order get sense overall performance. Example inspections first imputed dataset. shown , GLM method produces higher median 1.27 much greater range weights. GBM method produces similar mean GLM similarly large range (0-216). bart method similar median even larger range (0-945). super method produces similar median range 0-270. Next, evaluate well weights created using different weighting methods reduced imbalance using assessBalance() function. function calls calcBalStats() function using short formulas specifies balance statistics calculated using IPTW weights supplied. required inputs using assessBalance() function assess balance first round IPTW weights : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., ‘obj’), weights just created. optional inputs described Step 1b. assessBalance() function returns data frame (list) balance statistics, balance thresholds, binary balanced tag (1 = balanced, 0 = imbalanced) confounder relevant exposure time point. function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). retain optional important confounders (imp_conf) balance threshold (balance_thresh) specified earlier. first assess balance CBPS weighting method. function returns list balance statistics expsoure time point, one entry per imputed dataset (applicable). assessing balance using imputed data, can average across imputed datasets view overall summary performance method. can also examine imputed dataset individually. summarize CBPS balance statistics across imputed datasets examine balance first imputed dataset. user option supply save.save printed output home directory. Averaging across imputed datasets, find 2 imbalanced confounders remaining (35-month exposure time point) 241, median remaining correlation 0.06 maximum 0.07. can visualize imbalance love plots, averaging across imputed datasets, exposure time point (first time point shown ). can also plot balance given imputed datset. can see income 6 15 months remains imbalanced 4th (35-month) time point. can inspect balance statistics confounder relation exposure time points one individually, either averaging across imputed datasets one individually. user option supply save.save printed output home directory. , show example balance statistics first time point, averaged across imputed datasets. shown , two remaining imbalanced confounders related exposure correlation values 0.065 0.061. , assess balance weighting method comparing . summaries, identify optimal weighting method dataset, one yields best confounder balance. , can consider several criteria. note exist gold-standard, hard fast rules identifying optimal balance (especially using imputed data). However, can draw following guidance: Fewest imbalanced confounders remaining relative user-specified balance threshold(s) (summary output); Lowest median absolute balance statistic, across confounders time points, reflecting best overall attenuation confounding (summary output); Lowest maximum absolute balance statistic, across confounders time points (imputed datasets, applicable), indicating weakest remaining relation exposure confounder least balanced confounder (summary output); Reasonable effective sample size following weighting (imputed datasets, applicable), indicating reasonable power detect effects (weightiIt summary output). first three, examine summaries weighting methods. , find CBPS method fewest imbalanced confounders (2), lowest median balance statistic, lowest max balance statistic. examine fourth criterion, use weightIt summary method examine effective sample sizes (“Weighted”) compared orignal sample size (“Unweighted”) across weighting methods. just first imputed dataset. , also find CBPS method yields highest effective sample size 605. inspections, identify best performing weighting method CBPS. goal next step closely inspect balance reults best-performing weights created shortened weights formulas, add shortened formulas time-varying confounders lags > t-1 successfully balanced, create final round weights. next inspect balance produced weights created previous step best-performing weights method (.e., using SuperLearner method). , revisit assumption balancing proximal time-varying confounders (t-1) confers balance confounders distal prior time points (t- 1+). closely inspect balance CBPS weights, averaged across imputed datasets. real-world data, often difficult fully balance many confounding variables, especially across time. user find confounders remain imbalanced, can skip Step 3d. Given identified remaining imbalanced confounders, proceed Step 3b. Subsequently, update shortened formulas include time-varying confounders (t-1 +) successfully balanced full formulas, shown . , create final round weights formulas using createFormulas() function (setting type = “update” providing balance statistics bal_stats field). createFormulas() function draws user-provided balance statistics automatically identify add formulas exposure time point time-varying confounders lags greater 1 remain imbalanced weighting. function displays weights formula console message user time-varying confounders added. required input update shortened weights formulas using createFormulas() function : MSM object (e.g., “obj”), setting type = “update”, providing bal_stats balance statistics just created Step 3a. optional input detailed Step 1a. function returns list weights formulas labeled type, exposure, outcome, exposure time point. , update short formulas using balance statistics best-performing weights. inspect new formulas make sure imbalanced covariates added appropriate formulas. user option supply save.save printed output home directory. shown , income 6 15 months (“InRatioCor.6” “InRatioCor.15”) added 35-month weights formula. originally weights formula given lags greater t -1. remaining imbalance suggests achieving balance 24-month income successfully balance prior levels income. use weights formulas recreate CBPS weights effort achieve greatest reduction balance. Next, create final set balancing weights using optimal weighting method identified Step 2c updated formulas previous step using createWeights() function (method = “…’), SuperLearner method optimal weighting method identified Step 2c. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016) distributions saved home directory inspection. required inputs using createWeights() function create final round IPTW balancing weights using updated short weights formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), best-performing weights method, updated formulas (see Step 3a). optional input createWeights() function listed Step 2b. function returns list form WeightItMSM output. , use updated formulas CPBS weighting method create final round IPTW balancing weights. inspect final weights imputed dataset. user option supply save.save printed plot output home directory. shown , weights median value 0.77 range 0-9, . next step trim (.e., winsorize) final set weights eliminate heavy right tail distribution using trimWeights() function. function draws Weightit package (Griefer, 2023) plots summarizes trimmed weights. function outputs list trimmed weights either single nested list (labeled “0” data data frame format) nested lists imputed dataset (data imputed). required input trimWeights() function final weights just created. optional input allows user specify quantile value (0-1; default 0.95) weights replaced weight value quantile, reduce heavy right tail. , use default 95th percentile trimming weights. trim final weights . function returns list weights objects, containing trimmed weights, form weightitMSM output ( one entry per imputed dataset, applicable). entry also specifies quantile value weights trimmed. inspect trimmed weights one imputed datasets . user option supply save.save plots home directory. shown , weights still median value 0.77 smaller standard deviation range now goes 0-4. create trimmed weights using two quantile values + /- ~0.3 previously chosen quantile value, order conduct recommended sensitivity analyses subsequent steps. first create weights 92nd quantile value. Trimming 92nd quantile preserves median 0.77 even smaller standard deviation range. 98th quantile value. Trimming instead 98th quantile produces larger standard deviation range. find comparable descriptive statistics sets weights, upper range value varying quantile cutoff. assess consequences differences (e.g., different ranges) subsequent steps. created trimmed final set IPTW balancing weights, next step conduct final evaluation well reduce imbalance. assess performance final trimmed untrimmed weights using assessBalance() function. required inputs using assessBalance() function assess final, trimmed weights achieve balance full formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), weights. optional inputs assessBalance() function detailed Step 1b. , assess balance trimmed weights. Assess balance trimmed weights Summarize inspect. shown , trimmed weights result one imbalanced confounder relation exposure 15 months effective sample size 719. assess balance untrimmed weights Summarize inspect see non-trimmed weights result imbalanced confounders effective sample size 611. scenario, given , trimmed weights, imbalanced confounder (income 6 months) related exposure -0.051 trimmed weights yield higher effective sample size, proceed trimmed weights. summarize final balance statistics, averaging across imputed datasets. user option supply save.save plot output home directory. outcome modeling step (Step 5), users option include remaining imbalanced confounders time invariant covariates final outcome model. case, manually list imbalanced confounders time invariant assign covariates. Subsequently, also assess balance weights trimmed two additional quantile values assess whether final balance assessment sensitive trim value. first assess balance weights trimmed 93rd quantile value. , similarly find income 6 months imbalanced respect exposure 15 months (albeit slighter stronger correlation main analyses). next assess balance weights trimmed 98th quantile value. , find remaining imbalanced confounders (similar untrimmed results).","code":"type <- \"full\" full_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(full_formulas) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 6, the full formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 15, the full formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 24, the full formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + WndNbrhood.6 + IBRAttn.6 + IBRAttn.15 + B18Raw.6 + B18Raw.15 + HOMEETA1.6 + HOMEETA1.15 + InRatioCor.6 + InRatioCor.15 + CORTB.6 + CORTB.15 + ESETA1.6 + ESETA1.15 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 35, the full formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + WndNbrhood.6 + WndNbrhood.24 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.6 + ESETA1.15 + ESETA1.24 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 58, the full formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + RHasSO.35 + WndNbrhood.6 + WndNbrhood.24 + WndNbrhood.35 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + HOMEETA1.35 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + InRatioCor.35 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + EARS_TJo.35 + LESMnPos.24 + LESMnPos.35 + LESMnNeg.24 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.6 + ESETA1.15 + ESETA1.24 + ESETA1.35 balance_thresh <- c(0.05, 0.1) imp_conf <- c(\"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"PmEd2\") prebalance_stats <- assessBalance(obj = obj, data = data, balance_thresh = balance_thresh, imp_conf = imp_conf, save.out = save.out) print(prebalance_stats, i = 1, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.13324 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13865 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.06481 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.17598 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20129 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.14101 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23888 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.18058 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.11428 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.08223 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01624 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07892 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10536 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.0588 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13681 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.0364 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.09405 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15808 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09514 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10405 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.00731 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04693 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.04867 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.0182 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.02272 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02042 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.14314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.31012 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 for imputation (1) print(prebalance_stats, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.12646 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13395 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.0525 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.18314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20776 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.12948 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23456 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.17153 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.10139 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.07479 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01536 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07441 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10334 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.05769 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13942 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.04196 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.10162 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15135 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09639 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10475 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.0135 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04304 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.05533 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.00539 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.01557 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02454 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.15074 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.30943 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 Averaging Across Imputed Datasets summary(prebalance_stats, i = 1, save.out = save.out) #> USER ALERT: For imputation 1: As shown below, 55 out of 241 (22.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 summary(prebalance_stats, save.out = save.out) #> USER ALERT: Averaging across imputated datasets: As shown below, 60 out of 241 (24.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 15 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 12 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaged Across Imputed Datasets plot(prebalance_stats, i = 1, t = 1, save.out = save.out) plot(prebalance_stats, t = 1, save.out = save.out) type <- \"short\" short_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(short_formulas) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 6, the short formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 15, the short formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 24, the short formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 35, the short formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 58, the short formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 formulas <- short_formulas method <- \"cbps\" weights.cbps <- createWeights(obj = obj, data = data, method = method, formulas = formulas, verbose = TRUE, maxit = 1, # just for testing to speed up --will remove save.out = save.out) #> initial value 0.903706 #> final value 0.463025 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> initial value 0.585184 #> final value 0.381680 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). # weights.cbps <- readRDS('file_path_to_saved_weights.rds') print(weights.cbps, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). summary(weights.cbps[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 plot(weights.cbps, i = 1, save.out = save.out) method <- \"glm\" weights.glm <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.glm, i = 1) #> #> For imputation 1 and the `glm` weighting method, the median weight value is 1.27 (SD = 10.03; range = 0-271). summary(weights.glm[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 plot(weights.glm, i = 1, save.out = save.out) # method <- \"gbm\" # # weights.gbm <- createWeights(obj = obj, # data = data, # method = method, # formulas = formulas, # save.out = save.out) # # print(weights.gbm, # i = 1) # # summary(weights.gbm[[1]]) # # plot(weights.gbm, # i = 1, # save.out = save.out) method <- \"bart\" weights.bart <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.bart, i = 1) #> #> For imputation 1 and the `bart` weighting method, the median weight value is 1.24 (SD = 15; range = 0-499). summary(weights.bart[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 plot(weights.bart, i = 1, save.out = save.out) method <- \"super\" weights.super <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) #> Loading required package: nnls #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning: glm.fit: algorithm did not converge #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases print(weights.super, i = 1) #> #> For imputation 1 and the `super` weighting method, the median weight value is 1.27 (SD = 9.99; range = 0-270). summary(weights.super[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 plot(weights.super, i = 1, save.out = save.out) weights <- weights.cbps balance_stats.cbps <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.cbps, i = 1, save.out = save.out) #> USER ALERT: For imputation 1 using `cbps` weighting method: As shown below, 4 out of 241 (1.7%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.10): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 using `cbps` plot(balance_stats.cbps, t = 4, save.out = save.out) plot(balance_stats.cbps, t = 4, i = 1, save.out = save.out) print(balance_stats.cbps, t = 4, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.35 | state_1 | 0.0123 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.00736 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.01172 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.00143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.00951 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.0046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.04146 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.0365 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.01453 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.01442 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.05725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.06506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.0196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.0097 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.01158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.02051 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.03071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.00585 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.01947 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.05972 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.01793 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.03624 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.00796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.00653 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.02427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.00113 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.00166 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.01609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.00345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.01669 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.02717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.06637 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.05935 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.04559 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.05173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.03977 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.0018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.05331 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.0305 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.03406 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.03733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.01687 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.02261 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.01452 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.03428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.02188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.00991 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.01514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.0321 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.08449 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.0035 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 4 Averaging Across Imputed Datasets weights <- weights.glm balance_stats.glm <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) # weights <- weights.gbm # # balance_stats.gbm <- assessBalance(data = data, # obj = obj, # weights = weights, # imp_conf = imp_conf, # balance_thresh = balance_thresh, # save.out = save.out) weights <- weights.bart balance_stats.bart <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) weights <- weights.super balance_stats.super <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.glm, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `glm` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `glm` # summary(balance_stats.gbm, # save.out = save.out) summary(balance_stats.bart, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `bart` weighting method: As shown below, 16 out of 241 (6.6%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.12 (max: 0.18): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 3 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 10 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `bart` summary(balance_stats.super, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `super` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `super` summary(weights.cbps[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 567.0924 summary(weights.glm[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 82.74434 # summary(weights.gbm[[1]])[[1]][6] summary(weights.bart[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 41.33433 summary(weights.super[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 83.0753 print(balance_stats.cbps) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | -0.015841 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | 0.049787 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | 0.021011 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | -0.033318 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | -0.017018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | 0.026148 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | 0.001702 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.016403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | 0.072699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.013994 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.020431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.02928 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.01127 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.012702 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | 0.003785 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | 0.00374 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | -0.005058 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | -0.002294 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.030219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | -0.004567 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.02189 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | -0.027643 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.012046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.026237 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.013558 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | -0.035748 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | -0.003855 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | -0.022816 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | state_1 | 0.036174 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.012204 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | 0.004854 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.042683 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.025346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | 0.004899 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.029365 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.037699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.041403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.035278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | 0.001438 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | -0.011183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.010747 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.049295 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.033142 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.044428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | -0.016749 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.000614 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | 0.020957 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.027651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | -0.050611 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.069412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.026007 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | -0.011565 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | 0.003636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | 0.011326 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.007437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | -0.015918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | -0.038498 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.045319 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | -0.02082 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | 0.004196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.019396 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.033228 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.008945 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.045347 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | 0.010691 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.043475 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | state_1 | 0.006241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | BioDadInHH2_1 | -0.035814 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmAge2 | -0.017532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmBlac2_1 | 0.015892 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | TcBlac2_1 | 0.030768 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmMrSt2_1 | 0.062369 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmEd2 | 0.00653 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | KFASTScr | 0.032766 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RMomAgeU | 0.032742 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_1 | 0.00826 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_2 | 0.025263 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_3 | -0.029311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_4 | -0.020001 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_5 | 0.057299 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_1 | -0.032929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_2 | 0.008234 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_3 | 0.000591 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_4 | 0.022929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SWghtLB | -0.008564 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SurpPreg_1 | -0.037616 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_1 | 0.011311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_2 | -0.000889 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_3 | 0.002071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_1 | -0.011027 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_2 | 0.012054 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | peri_health | -0.040005 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | caregiv_health | 0.002807 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | gov_assist | 0.017188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.6 | 0.015602 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.15 | 0.043926 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.6 | 0.02066 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.15 | 0.002145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.6_1 | -0.027332 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.15_1 | 0.000214 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | WndNbrhood.6 | -0.000298 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.6 | 0.015692 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.15 | 0.004147 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.6 | 0.093979 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.15 | -0.003861 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.6 | 0.006479 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.15 | 0.016107 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.6 | -0.043574 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.15 | -0.002573 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.6 | 0.040583 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.15 | -0.007733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.6 | 0.038786 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.15 | 0.016269 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | state_1 | 0.012297 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.007364 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.011717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.001426 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.009506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.004603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.041457 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.036504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.014532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.014423 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.057253 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.065055 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.019599 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.009704 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.011584 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.020508 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.030714 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.005852 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.019471 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.059723 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.017933 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.036241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.007962 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.006528 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.024272 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.001126 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.001664 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.016089 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002003 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.003452 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.016688 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.027168 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.066367 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.059345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.045594 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023004 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.051726 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.039767 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.001796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.053306 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.030505 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.034064 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.037334 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.016869 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.022606 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.014519 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.034283 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.021881 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.009914 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.015144 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.032104 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.084487 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.003504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | state_1 | 0.046707 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | BioDadInHH2_1 | -0.032556 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmAge2 | -0.011158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmBlac2_1 | 0.045969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | TcBlac2_1 | 0.062286 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmMrSt2_1 | -0.02112 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmEd2 | 0.003704 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | KFASTScr | 0.001911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RMomAgeU | 0.042917 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_1 | 0.001836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_2 | 0.011966 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_3 | -0.000588 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_4 | -0.031635 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_5 | 0.03408 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_1 | -0.020218 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_2 | 0.024941 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_3 | 0.002759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_4 | 0.002021 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SWghtLB | -0.022619 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SurpPreg_1 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_1 | -0.044081 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_2 | 0.003514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_3 | -0.008938 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_1 | 0.010825 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_2 | -0.012394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | peri_health | -0.019048 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | caregiv_health | -0.001676 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | gov_assist | 0.01349 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.6 | 0.028656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.15 | -0.02358 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.24 | -0.017473 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.6 | 0.035384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.15 | -0.069623 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.6_1 | 0.066159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.15_1 | 0.005755 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.24_1 | -0.025656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.35_1 | -0.013387 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.6 | -0.042805 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.24 | -0.006412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.35 | 0.003724 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.6 | -0.04382 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.15 | -0.01477 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.24 | -0.048202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.6 | 0.03759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.15 | 0.078278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.24 | 0.051997 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.6 | -0.030969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.15 | 0.004609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.24 | -0.047911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.35 | -0.07415 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.6 | -0.036626 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.15 | -0.046776 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.24 | -0.044794 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.35 | -0.021949 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.6 | 0.024018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.15 | -0.008257 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.24 | 0.004373 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.24 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.35 | 0.023288 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.24 | -0.019433 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.35 | -0.016828 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.24 | 0.027503 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.35 | 0.054757 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | StrDif_Tot.35 | 0.022732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | fscore.35 | -0.059882 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.6 | 0.039731 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.15 | 0.031636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.24 | 0.014185 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.35 | 0.019732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points Averaging Across Imputed Datasets plot(balance_stats.cbps, t = 4, save.out = save.out) type <- \"update\" bal_stats <- balance_stats.cbps updated_formulas <- createFormulas(obj = obj, type = type, bal_stats = bal_stats, save.out = save.out) print(updated_formulas, save.out = save.out) #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 6, the update formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 15, the update formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 24, the update formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 35, the update formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 58, the update formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 formulas <- updated_formulas method <- \"cbps\" final_weights <- createWeights(data = data, obj = obj, method = method, formulas = formulas, max.it = 1, # testing only save.out = save.out) print(final_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.77 (SD = 1.18; range = 0-9). plot(final_weights, i = 1, save.out = save.out) quantile <- 0.95 weights <- final_weights trim_weights <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 95th quantile, the median weight value is 0.77 (SD = 0.93; range = 0-4). plot(trim_weights, i = 1, save.out = save.out) quantile <- 0.92 trim_weights.s1 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s1, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 92th quantile, the median weight value is 0.77 (SD = 0.82; range = 0-3). plot(trim_weights.s1, i = 1, save.out = save.out) quantile <- 0.98 trim_weights.s2 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s2, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 98th quantile, the median weight value is 0.77 (SD = 1.06; range = 0-5). plot(trim_weights.s2, i = 1, save.out = save.out) weights <- trim_weights final_balance_stats_trim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats_trim, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.018002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.01641 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.009705 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.017384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.017685 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00618 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.036545 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.020649 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.005992 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.001056 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.0065 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.004525 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.006969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.011918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.003678 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.003725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.006049 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.008359 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.000996 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.008394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.010939 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.009158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.005918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.007173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.017437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.000413 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.008989 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.015211 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.010964 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.01114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.018068 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.017711 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.002143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.025159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.024603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.047661 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.005651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.03469 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets summary(trim_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 weights <- final_weights final_balance_stats_untrim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_untrim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.07): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(final_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` plot(final_balance_stats_trim, t = 2, save.out = save.out) # covariates <- c(\"list_imbalanced_ti_conf\") weights <- trim_weights.s1 final_balance_stats.s1 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s1, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 3 out of 241 (1.2%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats.s1, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.02248 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.02024 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.01219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.0244 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.02265 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00906 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.04175 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.02587 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.01202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.00346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.00661 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.00912 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.00351 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.01245 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.00579 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.00296 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.00995 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.00817 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.00333 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.01431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.01323 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.0114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.00775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.0125 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.02183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.00145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.01119 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.01836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.01106 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.016 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.0208 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.02262 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.0034 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.02608 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.02883 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.06024 | 0.05 | 0 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.00713 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.0427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets weights <- trim_weights.s2 final_balance_stats.s2 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s2, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps`"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-1-create-full-weights-formulas-conduct-pre-balance-checking","dir":"Articles","previous_headings":"","what":"STEP 1: Create Full Weights Formulas & Conduct Pre-Balance Checking","title":"Workflow: Continuous Exposure","text":"first create comprehensive, full weights formulas relating exposure confounders time point using createFormulas() function (type = “full”). step creates full formulas containing measured confounding variables exposure time point, including time-invariant confounders lagged time-varying confounders. code automatically excludes time-varying confounders contemporaneous time point given decisively differentiated mediators balanced (Thoemmes & Ong, 2016), although can modified user strong reason believe concurrent variable truly confounder (see ). user wishes specify interactions confounders weights formulas, need manually create data listing . Keep mind interactions include factor variables decomposed interactions factor level. required input create full weights formulas using createFormulas() function : MSM object (e.g., “obj”) setting type = “full”. Optional inputs create full weights formulas using createFormulas() function follows. user may specify list custom formulas specifying custom list formulas, one exposure time point (e.g., “exposure.time ~ variable.time + variable +…”) formula format. recommend first running createFormulas() function without custom formulas (custom = NULL) using output model required format custom formulas. createFormulas() function automatically check custom formulas ensure correctly formatted formula exposure time point exposure dependent variable. However, user responsible ensuring custom formulas contain appropriate confounders formula type generating. Please see Customize weights formulas vignette detail customize formulas. chose create custom formulas instead use createFormulas() make automatically example. first create full formulas. function returns list formulas, one exposure time point. inspect . full formula contains time invariant confounders well lagged time-varying confounders time point. inspection important step, verify appropriate confounders present formula. inspect formulas . next step examines initial imbalance, strongly exposure relates confounder time point, measured confounders prior weighting using assessBalance() function. function draws calcBalStats() function (see Assessing Balance Time-Varying Exposure section accompanying manuscript). assessBalance() function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). required inputs using assessBalance() function conduct pre-balance testing : data (data frame, mids object, list imputed datasets dataframes wide format) MSM object (e.g., “obj”). Please see Assessing Balance Time-Varying Exposures vignette detail function calculates balance. optional inputs follows. user may specify balance_thresh, threshold(s) determining confounder balance, one two ways. * First, can provide single number value (0-1) absolute value standardized balance statistic (either correlation continuous exposures standardized group mean difference binary exposures) exposure confounders confounders considered balanced, considered imbalanced (default 0.1; Stuart, 2010). Second, users may make priori assertion confounders important others based theory existing research. case, can provide two numbers represent balance thresholds important less important confounders, respectively. user supplies two balance thresholds, must also supply list important confounders (time-varying: “variable.t”, time invariant: “variable”) imp_conf field. balance threshold specification kept consistent throughout use workflow. , recommended, provide two balancing thresholds identify income parent education important confounders relation economic strain behavior problems. create prebalance statistics . function returns list (one entry per imputed dataset, applicable), contains table exposure time point. able contains confounders time point, associated standardized balance statistics relating confounder exposure time point, user-supplied balance threshold, binary indicator whether confounder balanced. shown , can print, summarize, plot several versions balance statistics option supply save.save viewed output home directory. functions takes optional t field view balance statistics one exposure time points. t takes integer value 1 total number time points. specified, output shown exposure time points. imputed data, functions takes option field can used view balance one imputed data set. specified, output shown averaged across absolute values balance statistics imputed datasets. can useful average across imputed datasets get overall sense balance. non-imputed data, specify . can view prebalance statistics single imputed dataset (e.g., first imputed dataset), using field. Note supply t integers 1 however number time points exposure measured. example, first time point measures ESETA1 6 months corresponds t = 1. , can view prebalance statistics averaged across imputed data sets different time points specifying . can also used view balance statistics data imputed. can also summarize assessBalance() output view average remaining relation confounders exposure well summary table showing total number imbalanced confounders exposure time point. can view one imputed dataset averaged across . Averaging across imputed datasets, see xx confounders imbalanced respect economic strain exposure respective balance threshold. Lastly, can plot balance summary one time points, one imputed dataset averaged across . dotted red lines denote balance thresholds points colored labeled red denote confounders imbalanced relation respective balance thresholds. love plots depict standardized associations confounder exposure exposure time point, vertical red dashed lines indicating balance thresholds. Imbalanced confounders shown red variable name labels.","code":"type <- \"full\" full_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(full_formulas) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 6, the full formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 15, the full formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 24, the full formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + WndNbrhood.6 + IBRAttn.6 + IBRAttn.15 + B18Raw.6 + B18Raw.15 + HOMEETA1.6 + HOMEETA1.15 + InRatioCor.6 + InRatioCor.15 + CORTB.6 + CORTB.15 + ESETA1.6 + ESETA1.15 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 35, the full formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + WndNbrhood.6 + WndNbrhood.24 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.6 + ESETA1.15 + ESETA1.24 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 58, the full formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + RHasSO.35 + WndNbrhood.6 + WndNbrhood.24 + WndNbrhood.35 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + HOMEETA1.35 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + InRatioCor.35 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + EARS_TJo.35 + LESMnPos.24 + LESMnPos.35 + LESMnNeg.24 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.6 + ESETA1.15 + ESETA1.24 + ESETA1.35 balance_thresh <- c(0.05, 0.1) imp_conf <- c(\"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"PmEd2\") prebalance_stats <- assessBalance(obj = obj, data = data, balance_thresh = balance_thresh, imp_conf = imp_conf, save.out = save.out) print(prebalance_stats, i = 1, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.13324 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13865 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.06481 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.17598 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20129 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.14101 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23888 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.18058 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.11428 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.08223 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01624 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07892 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10536 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.0588 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13681 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.0364 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.09405 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15808 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09514 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10405 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.00731 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04693 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.04867 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.0182 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.02272 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02042 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.14314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.31012 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 for imputation (1) print(prebalance_stats, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.12646 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13395 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.0525 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.18314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20776 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.12948 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23456 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.17153 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.10139 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.07479 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01536 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07441 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10334 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.05769 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13942 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.04196 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.10162 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15135 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09639 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10475 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.0135 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04304 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.05533 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.00539 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.01557 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02454 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.15074 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.30943 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 Averaging Across Imputed Datasets summary(prebalance_stats, i = 1, save.out = save.out) #> USER ALERT: For imputation 1: As shown below, 55 out of 241 (22.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 summary(prebalance_stats, save.out = save.out) #> USER ALERT: Averaging across imputated datasets: As shown below, 60 out of 241 (24.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 15 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 12 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaged Across Imputed Datasets plot(prebalance_stats, i = 1, t = 1, save.out = save.out) plot(prebalance_stats, t = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"a--create-full-weights-formulas-at-each-exposure-time-point","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"1a. Create Full Weights Formulas at each Exposure Time Point","title":"Workflow: Continuous Exposure","text":"first create comprehensive, full weights formulas relating exposure confounders time point using createFormulas() function (type = “full”). step creates full formulas containing measured confounding variables exposure time point, including time-invariant confounders lagged time-varying confounders. code automatically excludes time-varying confounders contemporaneous time point given decisively differentiated mediators balanced (Thoemmes & Ong, 2016), although can modified user strong reason believe concurrent variable truly confounder (see ). user wishes specify interactions confounders weights formulas, need manually create data listing . Keep mind interactions include factor variables decomposed interactions factor level. required input create full weights formulas using createFormulas() function : MSM object (e.g., “obj”) setting type = “full”. Optional inputs create full weights formulas using createFormulas() function follows. user may specify list custom formulas specifying custom list formulas, one exposure time point (e.g., “exposure.time ~ variable.time + variable +…”) formula format. recommend first running createFormulas() function without custom formulas (custom = NULL) using output model required format custom formulas. createFormulas() function automatically check custom formulas ensure correctly formatted formula exposure time point exposure dependent variable. However, user responsible ensuring custom formulas contain appropriate confounders formula type generating. Please see Customize weights formulas vignette detail customize formulas. chose create custom formulas instead use createFormulas() make automatically example. first create full formulas. function returns list formulas, one exposure time point. inspect . full formula contains time invariant confounders well lagged time-varying confounders time point. inspection important step, verify appropriate confounders present formula. inspect formulas .","code":"type <- \"full\" full_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(full_formulas) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 6, the full formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 15, the full formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 24, the full formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + WndNbrhood.6 + IBRAttn.6 + IBRAttn.15 + B18Raw.6 + B18Raw.15 + HOMEETA1.6 + HOMEETA1.15 + InRatioCor.6 + InRatioCor.15 + CORTB.6 + CORTB.15 + ESETA1.6 + ESETA1.15 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 35, the full formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + WndNbrhood.6 + WndNbrhood.24 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.6 + ESETA1.15 + ESETA1.24 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 58, the full formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + RHasSO.35 + WndNbrhood.6 + WndNbrhood.24 + WndNbrhood.35 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + HOMEETA1.35 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + InRatioCor.35 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + EARS_TJo.35 + LESMnPos.24 + LESMnPos.35 + LESMnNeg.24 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.6 + ESETA1.15 + ESETA1.24 + ESETA1.35"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"b--conduct-exploratory-pre-balance-assessment","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"1b. Conduct Exploratory Pre-Balance Assessment","title":"Workflow: Continuous Exposure","text":"next step examines initial imbalance, strongly exposure relates confounder time point, measured confounders prior weighting using assessBalance() function. function draws calcBalStats() function (see Assessing Balance Time-Varying Exposure section accompanying manuscript). assessBalance() function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). required inputs using assessBalance() function conduct pre-balance testing : data (data frame, mids object, list imputed datasets dataframes wide format) MSM object (e.g., “obj”). Please see Assessing Balance Time-Varying Exposures vignette detail function calculates balance. optional inputs follows. user may specify balance_thresh, threshold(s) determining confounder balance, one two ways. * First, can provide single number value (0-1) absolute value standardized balance statistic (either correlation continuous exposures standardized group mean difference binary exposures) exposure confounders confounders considered balanced, considered imbalanced (default 0.1; Stuart, 2010). Second, users may make priori assertion confounders important others based theory existing research. case, can provide two numbers represent balance thresholds important less important confounders, respectively. user supplies two balance thresholds, must also supply list important confounders (time-varying: “variable.t”, time invariant: “variable”) imp_conf field. balance threshold specification kept consistent throughout use workflow. , recommended, provide two balancing thresholds identify income parent education important confounders relation economic strain behavior problems. create prebalance statistics . function returns list (one entry per imputed dataset, applicable), contains table exposure time point. able contains confounders time point, associated standardized balance statistics relating confounder exposure time point, user-supplied balance threshold, binary indicator whether confounder balanced. shown , can print, summarize, plot several versions balance statistics option supply save.save viewed output home directory. functions takes optional t field view balance statistics one exposure time points. t takes integer value 1 total number time points. specified, output shown exposure time points. imputed data, functions takes option field can used view balance one imputed data set. specified, output shown averaged across absolute values balance statistics imputed datasets. can useful average across imputed datasets get overall sense balance. non-imputed data, specify . can view prebalance statistics single imputed dataset (e.g., first imputed dataset), using field. Note supply t integers 1 however number time points exposure measured. example, first time point measures ESETA1 6 months corresponds t = 1. , can view prebalance statistics averaged across imputed data sets different time points specifying . can also used view balance statistics data imputed. can also summarize assessBalance() output view average remaining relation confounders exposure well summary table showing total number imbalanced confounders exposure time point. can view one imputed dataset averaged across . Averaging across imputed datasets, see xx confounders imbalanced respect economic strain exposure respective balance threshold. Lastly, can plot balance summary one time points, one imputed dataset averaged across . dotted red lines denote balance thresholds points colored labeled red denote confounders imbalanced relation respective balance thresholds. love plots depict standardized associations confounder exposure exposure time point, vertical red dashed lines indicating balance thresholds. Imbalanced confounders shown red variable name labels.","code":"balance_thresh <- c(0.05, 0.1) imp_conf <- c(\"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"PmEd2\") prebalance_stats <- assessBalance(obj = obj, data = data, balance_thresh = balance_thresh, imp_conf = imp_conf, save.out = save.out) print(prebalance_stats, i = 1, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.13324 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13865 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.06481 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.17598 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20129 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.14101 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23888 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.18058 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.11428 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.08223 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01624 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07892 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10536 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.0588 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13681 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.0364 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.09405 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15808 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09514 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10405 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.00731 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04693 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.04867 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.0182 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.02272 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02042 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.14314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.31012 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 for imputation (1) print(prebalance_stats, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.12646 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13395 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.0525 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.18314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20776 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.12948 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23456 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.17153 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.10139 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.07479 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01536 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07441 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10334 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.05769 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13942 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.04196 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.10162 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15135 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09639 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10475 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.0135 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04304 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.05533 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.00539 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.01557 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02454 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.15074 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.30943 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 Averaging Across Imputed Datasets summary(prebalance_stats, i = 1, save.out = save.out) #> USER ALERT: For imputation 1: As shown below, 55 out of 241 (22.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 summary(prebalance_stats, save.out = save.out) #> USER ALERT: Averaging across imputated datasets: As shown below, 60 out of 241 (24.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 15 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 12 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaged Across Imputed Datasets plot(prebalance_stats, i = 1, t = 1, save.out = save.out) plot(prebalance_stats, t = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-2-create-simplified-weights-formulas-determine-optimal-weighting-method","dir":"Articles","previous_headings":"","what":"STEP 2: Create Simplified Weights Formulas & Determine Optimal Weighting Method","title":"Workflow: Continuous Exposure","text":"goal second step create shortened, parsimonious weights formulas determining optimal IPTW weighting method successfully reduces imbalance data. First, create shorter, parsimonious weights formulas relating exposure confounders time point using createFormulas() function (type = “short”). exposure time point, formulas contain time invariant confounders well time-varying confounders t-1 lag. logic balancing confounders recent prior time point (t-1 ) may achieve balance levels distal time points, given stability many confounders time. Importantly, empirically assess relax assumption needed subsequent steps (Steps 3a-b). required input create shortened weights formulas using createFormulas() function : MSM object (e.g., ‘obj’) setting type = “short”. addition optional input outlined Step 1a, user also option specify keep_conf, list time-varying confounders (e.g., “variable.t”) always retain lagged confounders shortened formulas. user may use argument retain specific time-varying confounders otherwise excluded step occur lags greater t-1 formula. create short formulas . get list entries containing formula exposure time point. inspect make sure contain time-varying covariates lag one prior exposure time point. formulas considerably shorter full formulas. instance, 58-month exposure time point, formula contains time invariant confounders time-varying confounders 35-month time point. created shorter, simplified weights formulas, now create first round IPTW balancing weights (Thoemmes & Ong, 2016) using createWeights() function, shortened weights formulas, available weighting methods. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016), distributions can saved inspection. required inputs using createWeights() function create initial around IPTW balancing weights : MSM object (e.g, ‘obj’), complete data (data frame, mids object, list imputed datasets dataframes wide format), short formulas (see Step 2a). specify short formulas . optional inputs follows. method, provide one following methods calculating balancing weights using weightitMSM() methods validated longitudinal exposures: “cbps” (Covariate Balancing Propensity Score weighting), “gbm” (generalized boosted model), “glm” (generalized linear model; default), “super” (SuperLearner via SuperLearner package; Polley et al., 2013). information can found WeightIt documentation. begin specifying CBPS weighting method. createWeights() function can also take number additional arguments accapted weightitMSM() function (e.g., ‘criterion’, distribution’, ‘SL.library’). package defaults correspond weightIt defaults. user selects SuperLearner (“super”) method, default super learner libraries (‘SL.library’) “SL.glm” “SL.glm.interaction” alternative library can entered input createWeights function. binary exposures, “cbps” method allows specify estimand either ATE, ATT, ATC. “glm”, “super”, “bart” can specify ATE, ATT, ATC, ATO, ATM, ATOS. “gbm”, can specify ATE, ATT, ATC, ATO, ATM. default estimand binary exposures ATE. advise interested user review WeightIt documentation information additional optional arguments available weighting methods. Users option specify verbose = TRUE view information weights creation. function returns list weights objects form WeightItMSM output (entry imputed dataset appropriate). , create IPTW weights using default CBPS method. take run. Note save weights (supplying save.= TRUE custom file name createWeights() home directory initMWM()), function outputs file path use reading weights future use. can useful given weighting methods can take long time run, especially imputed datasets. previously saved CBPS weights, read instead re-creating . Given separate set weights created imputed dataset, conduct inspections imputed dataset. First, view basic statistics CBPS weights given imputed dataset. , note median weight value 0.77 (SD= 1.18) fairly extensive range 0 - 9. Next, look inside output summarize weighting process (drawing summary method weightIt, given imputed dataset. summary also provides effective sample size, sample size results applying weights original sample size, time point. Weighting can often result effective weighted sample size smaller orignal sample size something keep mind evaluating weighting methods. example, see original 1,292 sample reduced 605 upon weighting CBPS method. view distribution plot weights one imputed dataset. user option supply save.save plots home directory. shown , distribution heavy right tail (typical real-world data). right tail distribution represents individuals experienced statistically unexpected levels exposure given levels confounders. create inspect IPTW balancing weights using available methods order evaluate compare performance subsequent steps. , summarize plot averaging across imputed datasets order get sense overall performance. Example inspections first imputed dataset. shown , GLM method produces higher median 1.27 much greater range weights. GBM method produces similar mean GLM similarly large range (0-216). bart method similar median even larger range (0-945). super method produces similar median range 0-270. Next, evaluate well weights created using different weighting methods reduced imbalance using assessBalance() function. function calls calcBalStats() function using short formulas specifies balance statistics calculated using IPTW weights supplied. required inputs using assessBalance() function assess balance first round IPTW weights : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., ‘obj’), weights just created. optional inputs described Step 1b. assessBalance() function returns data frame (list) balance statistics, balance thresholds, binary balanced tag (1 = balanced, 0 = imbalanced) confounder relevant exposure time point. function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). retain optional important confounders (imp_conf) balance threshold (balance_thresh) specified earlier. first assess balance CBPS weighting method. function returns list balance statistics expsoure time point, one entry per imputed dataset (applicable). assessing balance using imputed data, can average across imputed datasets view overall summary performance method. can also examine imputed dataset individually. summarize CBPS balance statistics across imputed datasets examine balance first imputed dataset. user option supply save.save printed output home directory. Averaging across imputed datasets, find 2 imbalanced confounders remaining (35-month exposure time point) 241, median remaining correlation 0.06 maximum 0.07. can visualize imbalance love plots, averaging across imputed datasets, exposure time point (first time point shown ). can also plot balance given imputed datset. can see income 6 15 months remains imbalanced 4th (35-month) time point. can inspect balance statistics confounder relation exposure time points one individually, either averaging across imputed datasets one individually. user option supply save.save printed output home directory. , show example balance statistics first time point, averaged across imputed datasets. shown , two remaining imbalanced confounders related exposure correlation values 0.065 0.061. , assess balance weighting method comparing . summaries, identify optimal weighting method dataset, one yields best confounder balance. , can consider several criteria. note exist gold-standard, hard fast rules identifying optimal balance (especially using imputed data). However, can draw following guidance: Fewest imbalanced confounders remaining relative user-specified balance threshold(s) (summary output); Lowest median absolute balance statistic, across confounders time points, reflecting best overall attenuation confounding (summary output); Lowest maximum absolute balance statistic, across confounders time points (imputed datasets, applicable), indicating weakest remaining relation exposure confounder least balanced confounder (summary output); Reasonable effective sample size following weighting (imputed datasets, applicable), indicating reasonable power detect effects (weightiIt summary output). first three, examine summaries weighting methods. , find CBPS method fewest imbalanced confounders (2), lowest median balance statistic, lowest max balance statistic. examine fourth criterion, use weightIt summary method examine effective sample sizes (“Weighted”) compared orignal sample size (“Unweighted”) across weighting methods. just first imputed dataset. , also find CBPS method yields highest effective sample size 605. inspections, identify best performing weighting method CBPS.","code":"type <- \"short\" short_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(short_formulas) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 6, the short formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 15, the short formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 24, the short formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 35, the short formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 58, the short formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 formulas <- short_formulas method <- \"cbps\" weights.cbps <- createWeights(obj = obj, data = data, method = method, formulas = formulas, verbose = TRUE, maxit = 1, # just for testing to speed up --will remove save.out = save.out) #> initial value 0.903706 #> final value 0.463025 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> initial value 0.585184 #> final value 0.381680 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). # weights.cbps <- readRDS('file_path_to_saved_weights.rds') print(weights.cbps, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). summary(weights.cbps[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 plot(weights.cbps, i = 1, save.out = save.out) method <- \"glm\" weights.glm <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.glm, i = 1) #> #> For imputation 1 and the `glm` weighting method, the median weight value is 1.27 (SD = 10.03; range = 0-271). summary(weights.glm[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 plot(weights.glm, i = 1, save.out = save.out) # method <- \"gbm\" # # weights.gbm <- createWeights(obj = obj, # data = data, # method = method, # formulas = formulas, # save.out = save.out) # # print(weights.gbm, # i = 1) # # summary(weights.gbm[[1]]) # # plot(weights.gbm, # i = 1, # save.out = save.out) method <- \"bart\" weights.bart <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.bart, i = 1) #> #> For imputation 1 and the `bart` weighting method, the median weight value is 1.24 (SD = 15; range = 0-499). summary(weights.bart[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 plot(weights.bart, i = 1, save.out = save.out) method <- \"super\" weights.super <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) #> Loading required package: nnls #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning: glm.fit: algorithm did not converge #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases print(weights.super, i = 1) #> #> For imputation 1 and the `super` weighting method, the median weight value is 1.27 (SD = 9.99; range = 0-270). summary(weights.super[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 plot(weights.super, i = 1, save.out = save.out) weights <- weights.cbps balance_stats.cbps <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.cbps, i = 1, save.out = save.out) #> USER ALERT: For imputation 1 using `cbps` weighting method: As shown below, 4 out of 241 (1.7%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.10): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 using `cbps` plot(balance_stats.cbps, t = 4, save.out = save.out) plot(balance_stats.cbps, t = 4, i = 1, save.out = save.out) print(balance_stats.cbps, t = 4, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.35 | state_1 | 0.0123 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.00736 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.01172 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.00143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.00951 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.0046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.04146 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.0365 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.01453 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.01442 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.05725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.06506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.0196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.0097 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.01158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.02051 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.03071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.00585 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.01947 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.05972 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.01793 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.03624 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.00796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.00653 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.02427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.00113 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.00166 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.01609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.00345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.01669 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.02717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.06637 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.05935 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.04559 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.05173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.03977 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.0018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.05331 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.0305 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.03406 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.03733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.01687 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.02261 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.01452 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.03428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.02188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.00991 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.01514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.0321 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.08449 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.0035 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 4 Averaging Across Imputed Datasets weights <- weights.glm balance_stats.glm <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) # weights <- weights.gbm # # balance_stats.gbm <- assessBalance(data = data, # obj = obj, # weights = weights, # imp_conf = imp_conf, # balance_thresh = balance_thresh, # save.out = save.out) weights <- weights.bart balance_stats.bart <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) weights <- weights.super balance_stats.super <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.glm, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `glm` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `glm` # summary(balance_stats.gbm, # save.out = save.out) summary(balance_stats.bart, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `bart` weighting method: As shown below, 16 out of 241 (6.6%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.12 (max: 0.18): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 3 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 10 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `bart` summary(balance_stats.super, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `super` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `super` summary(weights.cbps[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 567.0924 summary(weights.glm[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 82.74434 # summary(weights.gbm[[1]])[[1]][6] summary(weights.bart[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 41.33433 summary(weights.super[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 83.0753"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"a--create-simplified-weights-formulas","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"2a. Create Simplified Weights Formulas","title":"Workflow: Continuous Exposure","text":"First, create shorter, parsimonious weights formulas relating exposure confounders time point using createFormulas() function (type = “short”). exposure time point, formulas contain time invariant confounders well time-varying confounders t-1 lag. logic balancing confounders recent prior time point (t-1 ) may achieve balance levels distal time points, given stability many confounders time. Importantly, empirically assess relax assumption needed subsequent steps (Steps 3a-b). required input create shortened weights formulas using createFormulas() function : MSM object (e.g., ‘obj’) setting type = “short”. addition optional input outlined Step 1a, user also option specify keep_conf, list time-varying confounders (e.g., “variable.t”) always retain lagged confounders shortened formulas. user may use argument retain specific time-varying confounders otherwise excluded step occur lags greater t-1 formula. create short formulas . get list entries containing formula exposure time point. inspect make sure contain time-varying covariates lag one prior exposure time point. formulas considerably shorter full formulas. instance, 58-month exposure time point, formula contains time invariant confounders time-varying confounders 35-month time point.","code":"type <- \"short\" short_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(short_formulas) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 6, the short formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 15, the short formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 24, the short formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 35, the short formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 58, the short formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"b--create-iptw-balancing-weights-using-multiple-weighting-methods","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"2b. Create IPTW Balancing Weights Using Multiple Weighting Methods","title":"Workflow: Continuous Exposure","text":"created shorter, simplified weights formulas, now create first round IPTW balancing weights (Thoemmes & Ong, 2016) using createWeights() function, shortened weights formulas, available weighting methods. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016), distributions can saved inspection. required inputs using createWeights() function create initial around IPTW balancing weights : MSM object (e.g, ‘obj’), complete data (data frame, mids object, list imputed datasets dataframes wide format), short formulas (see Step 2a). specify short formulas . optional inputs follows. method, provide one following methods calculating balancing weights using weightitMSM() methods validated longitudinal exposures: “cbps” (Covariate Balancing Propensity Score weighting), “gbm” (generalized boosted model), “glm” (generalized linear model; default), “super” (SuperLearner via SuperLearner package; Polley et al., 2013). information can found WeightIt documentation. begin specifying CBPS weighting method. createWeights() function can also take number additional arguments accapted weightitMSM() function (e.g., ‘criterion’, distribution’, ‘SL.library’). package defaults correspond weightIt defaults. user selects SuperLearner (“super”) method, default super learner libraries (‘SL.library’) “SL.glm” “SL.glm.interaction” alternative library can entered input createWeights function. binary exposures, “cbps” method allows specify estimand either ATE, ATT, ATC. “glm”, “super”, “bart” can specify ATE, ATT, ATC, ATO, ATM, ATOS. “gbm”, can specify ATE, ATT, ATC, ATO, ATM. default estimand binary exposures ATE. advise interested user review WeightIt documentation information additional optional arguments available weighting methods. Users option specify verbose = TRUE view information weights creation. function returns list weights objects form WeightItMSM output (entry imputed dataset appropriate). , create IPTW weights using default CBPS method. take run. Note save weights (supplying save.= TRUE custom file name createWeights() home directory initMWM()), function outputs file path use reading weights future use. can useful given weighting methods can take long time run, especially imputed datasets. previously saved CBPS weights, read instead re-creating . Given separate set weights created imputed dataset, conduct inspections imputed dataset. First, view basic statistics CBPS weights given imputed dataset. , note median weight value 0.77 (SD= 1.18) fairly extensive range 0 - 9. Next, look inside output summarize weighting process (drawing summary method weightIt, given imputed dataset. summary also provides effective sample size, sample size results applying weights original sample size, time point. Weighting can often result effective weighted sample size smaller orignal sample size something keep mind evaluating weighting methods. example, see original 1,292 sample reduced 605 upon weighting CBPS method. view distribution plot weights one imputed dataset. user option supply save.save plots home directory. shown , distribution heavy right tail (typical real-world data). right tail distribution represents individuals experienced statistically unexpected levels exposure given levels confounders. create inspect IPTW balancing weights using available methods order evaluate compare performance subsequent steps. , summarize plot averaging across imputed datasets order get sense overall performance. Example inspections first imputed dataset. shown , GLM method produces higher median 1.27 much greater range weights. GBM method produces similar mean GLM similarly large range (0-216). bart method similar median even larger range (0-945). super method produces similar median range 0-270.","code":"formulas <- short_formulas method <- \"cbps\" weights.cbps <- createWeights(obj = obj, data = data, method = method, formulas = formulas, verbose = TRUE, maxit = 1, # just for testing to speed up --will remove save.out = save.out) #> initial value 0.903706 #> final value 0.463025 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> initial value 0.585184 #> final value 0.381680 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). # weights.cbps <- readRDS('file_path_to_saved_weights.rds') print(weights.cbps, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). summary(weights.cbps[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 plot(weights.cbps, i = 1, save.out = save.out) method <- \"glm\" weights.glm <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.glm, i = 1) #> #> For imputation 1 and the `glm` weighting method, the median weight value is 1.27 (SD = 10.03; range = 0-271). summary(weights.glm[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 plot(weights.glm, i = 1, save.out = save.out) # method <- \"gbm\" # # weights.gbm <- createWeights(obj = obj, # data = data, # method = method, # formulas = formulas, # save.out = save.out) # # print(weights.gbm, # i = 1) # # summary(weights.gbm[[1]]) # # plot(weights.gbm, # i = 1, # save.out = save.out) method <- \"bart\" weights.bart <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.bart, i = 1) #> #> For imputation 1 and the `bart` weighting method, the median weight value is 1.24 (SD = 15; range = 0-499). summary(weights.bart[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 plot(weights.bart, i = 1, save.out = save.out) method <- \"super\" weights.super <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) #> Loading required package: nnls #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning: glm.fit: algorithm did not converge #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases print(weights.super, i = 1) #> #> For imputation 1 and the `super` weighting method, the median weight value is 1.27 (SD = 9.99; range = 0-270). summary(weights.super[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 plot(weights.super, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"cbps","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"CBPS","title":"Workflow: Continuous Exposure","text":", create IPTW weights using default CBPS method. take run. Note save weights (supplying save.= TRUE custom file name createWeights() home directory initMWM()), function outputs file path use reading weights future use. can useful given weighting methods can take long time run, especially imputed datasets. previously saved CBPS weights, read instead re-creating . Given separate set weights created imputed dataset, conduct inspections imputed dataset. First, view basic statistics CBPS weights given imputed dataset. , note median weight value 0.77 (SD= 1.18) fairly extensive range 0 - 9. Next, look inside output summarize weighting process (drawing summary method weightIt, given imputed dataset. summary also provides effective sample size, sample size results applying weights original sample size, time point. Weighting can often result effective weighted sample size smaller orignal sample size something keep mind evaluating weighting methods. example, see original 1,292 sample reduced 605 upon weighting CBPS method. view distribution plot weights one imputed dataset. user option supply save.save plots home directory. shown , distribution heavy right tail (typical real-world data). right tail distribution represents individuals experienced statistically unexpected levels exposure given levels confounders. create inspect IPTW balancing weights using available methods order evaluate compare performance subsequent steps. , summarize plot averaging across imputed datasets order get sense overall performance. Example inspections first imputed dataset.","code":"weights.cbps <- createWeights(obj = obj, data = data, method = method, formulas = formulas, verbose = TRUE, maxit = 1, # just for testing to speed up --will remove save.out = save.out) #> initial value 0.903706 #> final value 0.463025 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> initial value 0.585184 #> final value 0.381680 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). # weights.cbps <- readRDS('file_path_to_saved_weights.rds') print(weights.cbps, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). summary(weights.cbps[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 plot(weights.cbps, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"glm","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"GLM","title":"Workflow: Continuous Exposure","text":"shown , GLM method produces higher median 1.27 much greater range weights.","code":"method <- \"glm\" weights.glm <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.glm, i = 1) #> #> For imputation 1 and the `glm` weighting method, the median weight value is 1.27 (SD = 10.03; range = 0-271). summary(weights.glm[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 plot(weights.glm, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"gbm","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"GBM","title":"Workflow: Continuous Exposure","text":"GBM method produces similar mean GLM similarly large range (0-216).","code":"# method <- \"gbm\" # # weights.gbm <- createWeights(obj = obj, # data = data, # method = method, # formulas = formulas, # save.out = save.out) # # print(weights.gbm, # i = 1) # # summary(weights.gbm[[1]]) # # plot(weights.gbm, # i = 1, # save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"bart","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Bart","title":"Workflow: Continuous Exposure","text":"bart method similar median even larger range (0-945).","code":"method <- \"bart\" weights.bart <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.bart, i = 1) #> #> For imputation 1 and the `bart` weighting method, the median weight value is 1.24 (SD = 15; range = 0-499). summary(weights.bart[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 499.4559 #> #> - Units with the 5 most extreme weights: #> #> 79 591 1235 475 1145 #> all 51.3105 72.3414 90.2131 107.8639 499.4559 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 5.503 0.996 1.377 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 41.33 plot(weights.bart, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"super","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Super","title":"Workflow: Continuous Exposure","text":"super method produces similar median range 0-270.","code":"method <- \"super\" weights.super <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) #> Loading required package: nnls #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning: glm.fit: algorithm did not converge #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases print(weights.super, i = 1) #> #> For imputation 1 and the `super` weighting method, the median weight value is 1.27 (SD = 9.99; range = 0-270). summary(weights.super[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 plot(weights.super, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"c--assess-all-weighting-methods-to-determine-optimal-method","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"2c. Assess All Weighting Methods to Determine Optimal Method","title":"Workflow: Continuous Exposure","text":"Next, evaluate well weights created using different weighting methods reduced imbalance using assessBalance() function. function calls calcBalStats() function using short formulas specifies balance statistics calculated using IPTW weights supplied. required inputs using assessBalance() function assess balance first round IPTW weights : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., ‘obj’), weights just created. optional inputs described Step 1b. assessBalance() function returns data frame (list) balance statistics, balance thresholds, binary balanced tag (1 = balanced, 0 = imbalanced) confounder relevant exposure time point. function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). retain optional important confounders (imp_conf) balance threshold (balance_thresh) specified earlier. first assess balance CBPS weighting method. function returns list balance statistics expsoure time point, one entry per imputed dataset (applicable). assessing balance using imputed data, can average across imputed datasets view overall summary performance method. can also examine imputed dataset individually. summarize CBPS balance statistics across imputed datasets examine balance first imputed dataset. user option supply save.save printed output home directory. Averaging across imputed datasets, find 2 imbalanced confounders remaining (35-month exposure time point) 241, median remaining correlation 0.06 maximum 0.07. can visualize imbalance love plots, averaging across imputed datasets, exposure time point (first time point shown ). can also plot balance given imputed datset. can see income 6 15 months remains imbalanced 4th (35-month) time point. can inspect balance statistics confounder relation exposure time points one individually, either averaging across imputed datasets one individually. user option supply save.save printed output home directory. , show example balance statistics first time point, averaged across imputed datasets. shown , two remaining imbalanced confounders related exposure correlation values 0.065 0.061. , assess balance weighting method comparing . summaries, identify optimal weighting method dataset, one yields best confounder balance. , can consider several criteria. note exist gold-standard, hard fast rules identifying optimal balance (especially using imputed data). However, can draw following guidance: Fewest imbalanced confounders remaining relative user-specified balance threshold(s) (summary output); Lowest median absolute balance statistic, across confounders time points, reflecting best overall attenuation confounding (summary output); Lowest maximum absolute balance statistic, across confounders time points (imputed datasets, applicable), indicating weakest remaining relation exposure confounder least balanced confounder (summary output); Reasonable effective sample size following weighting (imputed datasets, applicable), indicating reasonable power detect effects (weightiIt summary output). first three, examine summaries weighting methods. , find CBPS method fewest imbalanced confounders (2), lowest median balance statistic, lowest max balance statistic. examine fourth criterion, use weightIt summary method examine effective sample sizes (“Weighted”) compared orignal sample size (“Unweighted”) across weighting methods. just first imputed dataset. , also find CBPS method yields highest effective sample size 605. inspections, identify best performing weighting method CBPS.","code":"weights <- weights.cbps balance_stats.cbps <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.cbps, i = 1, save.out = save.out) #> USER ALERT: For imputation 1 using `cbps` weighting method: As shown below, 4 out of 241 (1.7%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.10): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 using `cbps` plot(balance_stats.cbps, t = 4, save.out = save.out) plot(balance_stats.cbps, t = 4, i = 1, save.out = save.out) print(balance_stats.cbps, t = 4, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.35 | state_1 | 0.0123 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.00736 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.01172 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.00143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.00951 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.0046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.04146 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.0365 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.01453 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.01442 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.05725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.06506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.0196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.0097 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.01158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.02051 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.03071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.00585 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.01947 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.05972 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.01793 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.03624 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.00796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.00653 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.02427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.00113 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.00166 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.01609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.00345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.01669 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.02717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.06637 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.05935 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.04559 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.05173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.03977 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.0018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.05331 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.0305 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.03406 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.03733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.01687 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.02261 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.01452 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.03428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.02188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.00991 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.01514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.0321 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.08449 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.0035 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 4 Averaging Across Imputed Datasets weights <- weights.glm balance_stats.glm <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) # weights <- weights.gbm # # balance_stats.gbm <- assessBalance(data = data, # obj = obj, # weights = weights, # imp_conf = imp_conf, # balance_thresh = balance_thresh, # save.out = save.out) weights <- weights.bart balance_stats.bart <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) weights <- weights.super balance_stats.super <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.glm, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `glm` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `glm` # summary(balance_stats.gbm, # save.out = save.out) summary(balance_stats.bart, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `bart` weighting method: As shown below, 16 out of 241 (6.6%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.12 (max: 0.18): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 3 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 10 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `bart` summary(balance_stats.super, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `super` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `super` summary(weights.cbps[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 567.0924 summary(weights.glm[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 82.74434 # summary(weights.gbm[[1]])[[1]][6] summary(weights.bart[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 41.33433 summary(weights.super[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 83.0753"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"cbps-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"CBPS","title":"Workflow: Continuous Exposure","text":"first assess balance CBPS weighting method. function returns list balance statistics expsoure time point, one entry per imputed dataset (applicable). assessing balance using imputed data, can average across imputed datasets view overall summary performance method. can also examine imputed dataset individually. summarize CBPS balance statistics across imputed datasets examine balance first imputed dataset. user option supply save.save printed output home directory. Averaging across imputed datasets, find 2 imbalanced confounders remaining (35-month exposure time point) 241, median remaining correlation 0.06 maximum 0.07. can visualize imbalance love plots, averaging across imputed datasets, exposure time point (first time point shown ). can also plot balance given imputed datset. can see income 6 15 months remains imbalanced 4th (35-month) time point. can inspect balance statistics confounder relation exposure time points one individually, either averaging across imputed datasets one individually. user option supply save.save printed output home directory. , show example balance statistics first time point, averaged across imputed datasets. shown , two remaining imbalanced confounders related exposure correlation values 0.065 0.061. , assess balance weighting method comparing .","code":"weights <- weights.cbps balance_stats.cbps <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.cbps, i = 1, save.out = save.out) #> USER ALERT: For imputation 1 using `cbps` weighting method: As shown below, 4 out of 241 (1.7%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.10): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 using `cbps` plot(balance_stats.cbps, t = 4, save.out = save.out) plot(balance_stats.cbps, t = 4, i = 1, save.out = save.out) print(balance_stats.cbps, t = 4, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.35 | state_1 | 0.0123 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.00736 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.01172 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.00143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.00951 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.0046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.04146 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.0365 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.01453 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.01442 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.05725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.06506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.0196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.0097 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.01158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.02051 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.03071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.00585 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.01947 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.05972 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.01793 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.03624 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.00796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.00653 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.02427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.00113 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.00166 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.01609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.00345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.01669 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.02717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.06637 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.05935 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.04559 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.05173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.03977 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.0018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.05331 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.0305 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.03406 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.03733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.01687 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.02261 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.01452 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.03428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.02188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.00991 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.01514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.0321 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.08449 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.0035 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 4 Averaging Across Imputed Datasets"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"glm-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"GLM","title":"Workflow: Continuous Exposure","text":"","code":"weights <- weights.glm balance_stats.glm <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"gbm-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"GBM","title":"Workflow: Continuous Exposure","text":"","code":"# weights <- weights.gbm # # balance_stats.gbm <- assessBalance(data = data, # obj = obj, # weights = weights, # imp_conf = imp_conf, # balance_thresh = balance_thresh, # save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"bart-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Bart","title":"Workflow: Continuous Exposure","text":"","code":"weights <- weights.bart balance_stats.bart <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"super-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Super","title":"Workflow: Continuous Exposure","text":"summaries, identify optimal weighting method dataset, one yields best confounder balance. , can consider several criteria. note exist gold-standard, hard fast rules identifying optimal balance (especially using imputed data). However, can draw following guidance: Fewest imbalanced confounders remaining relative user-specified balance threshold(s) (summary output); Lowest median absolute balance statistic, across confounders time points, reflecting best overall attenuation confounding (summary output); Lowest maximum absolute balance statistic, across confounders time points (imputed datasets, applicable), indicating weakest remaining relation exposure confounder least balanced confounder (summary output); Reasonable effective sample size following weighting (imputed datasets, applicable), indicating reasonable power detect effects (weightiIt summary output). first three, examine summaries weighting methods. , find CBPS method fewest imbalanced confounders (2), lowest median balance statistic, lowest max balance statistic. examine fourth criterion, use weightIt summary method examine effective sample sizes (“Weighted”) compared orignal sample size (“Unweighted”) across weighting methods. just first imputed dataset. , also find CBPS method yields highest effective sample size 605. inspections, identify best performing weighting method CBPS.","code":"weights <- weights.super balance_stats.super <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.glm, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `glm` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `glm` # summary(balance_stats.gbm, # save.out = save.out) summary(balance_stats.bart, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `bart` weighting method: As shown below, 16 out of 241 (6.6%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.12 (max: 0.18): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 3 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 10 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `bart` summary(balance_stats.super, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `super` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `super` summary(weights.cbps[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 567.0924 summary(weights.glm[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 82.74434 # summary(weights.gbm[[1]])[[1]][6] summary(weights.bart[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 41.33433 summary(weights.super[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 83.0753"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-3-create-updated-formulas-re-specify-weights-using-optimal-weighting-method","dir":"Articles","previous_headings":"","what":"STEP 3: Create Updated Formulas & Re-Specify Weights Using Optimal Weighting Method","title":"Workflow: Continuous Exposure","text":"goal next step closely inspect balance reults best-performing weights created shortened weights formulas, add shortened formulas time-varying confounders lags > t-1 successfully balanced, create final round weights. next inspect balance produced weights created previous step best-performing weights method (.e., using SuperLearner method). , revisit assumption balancing proximal time-varying confounders (t-1) confers balance confounders distal prior time points (t- 1+). closely inspect balance CBPS weights, averaged across imputed datasets. real-world data, often difficult fully balance many confounding variables, especially across time. user find confounders remain imbalanced, can skip Step 3d. Given identified remaining imbalanced confounders, proceed Step 3b. Subsequently, update shortened formulas include time-varying confounders (t-1 +) successfully balanced full formulas, shown . , create final round weights formulas using createFormulas() function (setting type = “update” providing balance statistics bal_stats field). createFormulas() function draws user-provided balance statistics automatically identify add formulas exposure time point time-varying confounders lags greater 1 remain imbalanced weighting. function displays weights formula console message user time-varying confounders added. required input update shortened weights formulas using createFormulas() function : MSM object (e.g., “obj”), setting type = “update”, providing bal_stats balance statistics just created Step 3a. optional input detailed Step 1a. function returns list weights formulas labeled type, exposure, outcome, exposure time point. , update short formulas using balance statistics best-performing weights. inspect new formulas make sure imbalanced covariates added appropriate formulas. user option supply save.save printed output home directory. shown , income 6 15 months (“InRatioCor.6” “InRatioCor.15”) added 35-month weights formula. originally weights formula given lags greater t -1. remaining imbalance suggests achieving balance 24-month income successfully balance prior levels income. use weights formulas recreate CBPS weights effort achieve greatest reduction balance. Next, create final set balancing weights using optimal weighting method identified Step 2c updated formulas previous step using createWeights() function (method = “…’), SuperLearner method optimal weighting method identified Step 2c. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016) distributions saved home directory inspection. required inputs using createWeights() function create final round IPTW balancing weights using updated short weights formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), best-performing weights method, updated formulas (see Step 3a). optional input createWeights() function listed Step 2b. function returns list form WeightItMSM output. , use updated formulas CPBS weighting method create final round IPTW balancing weights. inspect final weights imputed dataset. user option supply save.save printed plot output home directory. shown , weights median value 0.77 range 0-9, . next step trim (.e., winsorize) final set weights eliminate heavy right tail distribution using trimWeights() function. function draws Weightit package (Griefer, 2023) plots summarizes trimmed weights. function outputs list trimmed weights either single nested list (labeled “0” data data frame format) nested lists imputed dataset (data imputed). required input trimWeights() function final weights just created. optional input allows user specify quantile value (0-1; default 0.95) weights replaced weight value quantile, reduce heavy right tail. , use default 95th percentile trimming weights. trim final weights . function returns list weights objects, containing trimmed weights, form weightitMSM output ( one entry per imputed dataset, applicable). entry also specifies quantile value weights trimmed. inspect trimmed weights one imputed datasets . user option supply save.save plots home directory. shown , weights still median value 0.77 smaller standard deviation range now goes 0-4. create trimmed weights using two quantile values + /- ~0.3 previously chosen quantile value, order conduct recommended sensitivity analyses subsequent steps. first create weights 92nd quantile value. Trimming 92nd quantile preserves median 0.77 even smaller standard deviation range. 98th quantile value. Trimming instead 98th quantile produces larger standard deviation range. find comparable descriptive statistics sets weights, upper range value varying quantile cutoff. assess consequences differences (e.g., different ranges) subsequent steps.","code":"print(balance_stats.cbps) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | -0.015841 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | 0.049787 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | 0.021011 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | -0.033318 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | -0.017018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | 0.026148 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | 0.001702 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.016403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | 0.072699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.013994 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.020431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.02928 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.01127 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.012702 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | 0.003785 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | 0.00374 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | -0.005058 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | -0.002294 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.030219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | -0.004567 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.02189 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | -0.027643 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.012046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.026237 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.013558 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | -0.035748 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | -0.003855 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | -0.022816 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | state_1 | 0.036174 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.012204 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | 0.004854 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.042683 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.025346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | 0.004899 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.029365 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.037699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.041403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.035278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | 0.001438 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | -0.011183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.010747 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.049295 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.033142 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.044428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | -0.016749 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.000614 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | 0.020957 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.027651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | -0.050611 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.069412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.026007 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | -0.011565 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | 0.003636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | 0.011326 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.007437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | -0.015918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | -0.038498 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.045319 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | -0.02082 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | 0.004196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.019396 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.033228 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.008945 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.045347 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | 0.010691 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.043475 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | state_1 | 0.006241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | BioDadInHH2_1 | -0.035814 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmAge2 | -0.017532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmBlac2_1 | 0.015892 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | TcBlac2_1 | 0.030768 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmMrSt2_1 | 0.062369 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmEd2 | 0.00653 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | KFASTScr | 0.032766 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RMomAgeU | 0.032742 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_1 | 0.00826 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_2 | 0.025263 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_3 | -0.029311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_4 | -0.020001 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_5 | 0.057299 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_1 | -0.032929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_2 | 0.008234 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_3 | 0.000591 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_4 | 0.022929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SWghtLB | -0.008564 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SurpPreg_1 | -0.037616 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_1 | 0.011311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_2 | -0.000889 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_3 | 0.002071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_1 | -0.011027 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_2 | 0.012054 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | peri_health | -0.040005 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | caregiv_health | 0.002807 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | gov_assist | 0.017188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.6 | 0.015602 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.15 | 0.043926 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.6 | 0.02066 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.15 | 0.002145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.6_1 | -0.027332 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.15_1 | 0.000214 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | WndNbrhood.6 | -0.000298 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.6 | 0.015692 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.15 | 0.004147 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.6 | 0.093979 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.15 | -0.003861 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.6 | 0.006479 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.15 | 0.016107 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.6 | -0.043574 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.15 | -0.002573 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.6 | 0.040583 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.15 | -0.007733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.6 | 0.038786 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.15 | 0.016269 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | state_1 | 0.012297 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.007364 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.011717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.001426 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.009506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.004603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.041457 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.036504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.014532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.014423 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.057253 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.065055 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.019599 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.009704 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.011584 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.020508 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.030714 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.005852 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.019471 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.059723 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.017933 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.036241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.007962 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.006528 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.024272 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.001126 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.001664 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.016089 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002003 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.003452 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.016688 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.027168 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.066367 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.059345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.045594 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023004 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.051726 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.039767 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.001796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.053306 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.030505 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.034064 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.037334 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.016869 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.022606 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.014519 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.034283 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.021881 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.009914 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.015144 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.032104 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.084487 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.003504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | state_1 | 0.046707 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | BioDadInHH2_1 | -0.032556 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmAge2 | -0.011158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmBlac2_1 | 0.045969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | TcBlac2_1 | 0.062286 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmMrSt2_1 | -0.02112 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmEd2 | 0.003704 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | KFASTScr | 0.001911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RMomAgeU | 0.042917 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_1 | 0.001836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_2 | 0.011966 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_3 | -0.000588 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_4 | -0.031635 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_5 | 0.03408 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_1 | -0.020218 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_2 | 0.024941 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_3 | 0.002759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_4 | 0.002021 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SWghtLB | -0.022619 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SurpPreg_1 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_1 | -0.044081 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_2 | 0.003514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_3 | -0.008938 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_1 | 0.010825 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_2 | -0.012394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | peri_health | -0.019048 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | caregiv_health | -0.001676 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | gov_assist | 0.01349 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.6 | 0.028656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.15 | -0.02358 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.24 | -0.017473 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.6 | 0.035384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.15 | -0.069623 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.6_1 | 0.066159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.15_1 | 0.005755 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.24_1 | -0.025656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.35_1 | -0.013387 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.6 | -0.042805 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.24 | -0.006412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.35 | 0.003724 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.6 | -0.04382 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.15 | -0.01477 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.24 | -0.048202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.6 | 0.03759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.15 | 0.078278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.24 | 0.051997 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.6 | -0.030969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.15 | 0.004609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.24 | -0.047911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.35 | -0.07415 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.6 | -0.036626 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.15 | -0.046776 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.24 | -0.044794 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.35 | -0.021949 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.6 | 0.024018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.15 | -0.008257 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.24 | 0.004373 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.24 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.35 | 0.023288 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.24 | -0.019433 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.35 | -0.016828 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.24 | 0.027503 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.35 | 0.054757 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | StrDif_Tot.35 | 0.022732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | fscore.35 | -0.059882 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.6 | 0.039731 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.15 | 0.031636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.24 | 0.014185 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.35 | 0.019732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points Averaging Across Imputed Datasets plot(balance_stats.cbps, t = 4, save.out = save.out) type <- \"update\" bal_stats <- balance_stats.cbps updated_formulas <- createFormulas(obj = obj, type = type, bal_stats = bal_stats, save.out = save.out) print(updated_formulas, save.out = save.out) #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 6, the update formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 15, the update formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 24, the update formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 35, the update formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 58, the update formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 formulas <- updated_formulas method <- \"cbps\" final_weights <- createWeights(data = data, obj = obj, method = method, formulas = formulas, max.it = 1, # testing only save.out = save.out) print(final_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.77 (SD = 1.18; range = 0-9). plot(final_weights, i = 1, save.out = save.out) quantile <- 0.95 weights <- final_weights trim_weights <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 95th quantile, the median weight value is 0.77 (SD = 0.93; range = 0-4). plot(trim_weights, i = 1, save.out = save.out) quantile <- 0.92 trim_weights.s1 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s1, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 92th quantile, the median weight value is 0.77 (SD = 0.82; range = 0-3). plot(trim_weights.s1, i = 1, save.out = save.out) quantile <- 0.98 trim_weights.s2 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s2, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 98th quantile, the median weight value is 0.77 (SD = 1.06; range = 0-5). plot(trim_weights.s2, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"a--examine-balance-of-optimal-weighting-method","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"3a. Examine Balance of Optimal Weighting Method","title":"Workflow: Continuous Exposure","text":"next inspect balance produced weights created previous step best-performing weights method (.e., using SuperLearner method). , revisit assumption balancing proximal time-varying confounders (t-1) confers balance confounders distal prior time points (t- 1+). closely inspect balance CBPS weights, averaged across imputed datasets. real-world data, often difficult fully balance many confounding variables, especially across time. user find confounders remain imbalanced, can skip Step 3d. Given identified remaining imbalanced confounders, proceed Step 3b.","code":"print(balance_stats.cbps) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | -0.015841 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | 0.049787 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | 0.021011 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | -0.033318 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | -0.017018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | 0.026148 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | 0.001702 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.016403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | 0.072699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.013994 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.020431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.02928 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.01127 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.012702 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | 0.003785 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | 0.00374 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | -0.005058 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | -0.002294 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.030219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | -0.004567 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.02189 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | -0.027643 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.012046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.026237 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.013558 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | -0.035748 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | -0.003855 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | -0.022816 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | state_1 | 0.036174 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.012204 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | 0.004854 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.042683 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.025346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | 0.004899 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.029365 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.037699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.041403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.035278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | 0.001438 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | -0.011183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.010747 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.049295 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.033142 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.044428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | -0.016749 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.000614 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | 0.020957 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.027651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | -0.050611 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.069412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.026007 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | -0.011565 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | 0.003636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | 0.011326 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.007437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | -0.015918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | -0.038498 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.045319 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | -0.02082 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | 0.004196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.019396 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.033228 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.008945 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.045347 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | 0.010691 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.043475 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | state_1 | 0.006241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | BioDadInHH2_1 | -0.035814 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmAge2 | -0.017532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmBlac2_1 | 0.015892 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | TcBlac2_1 | 0.030768 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmMrSt2_1 | 0.062369 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmEd2 | 0.00653 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | KFASTScr | 0.032766 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RMomAgeU | 0.032742 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_1 | 0.00826 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_2 | 0.025263 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_3 | -0.029311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_4 | -0.020001 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_5 | 0.057299 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_1 | -0.032929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_2 | 0.008234 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_3 | 0.000591 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_4 | 0.022929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SWghtLB | -0.008564 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SurpPreg_1 | -0.037616 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_1 | 0.011311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_2 | -0.000889 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_3 | 0.002071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_1 | -0.011027 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_2 | 0.012054 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | peri_health | -0.040005 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | caregiv_health | 0.002807 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | gov_assist | 0.017188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.6 | 0.015602 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.15 | 0.043926 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.6 | 0.02066 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.15 | 0.002145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.6_1 | -0.027332 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.15_1 | 0.000214 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | WndNbrhood.6 | -0.000298 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.6 | 0.015692 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.15 | 0.004147 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.6 | 0.093979 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.15 | -0.003861 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.6 | 0.006479 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.15 | 0.016107 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.6 | -0.043574 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.15 | -0.002573 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.6 | 0.040583 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.15 | -0.007733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.6 | 0.038786 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.15 | 0.016269 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | state_1 | 0.012297 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.007364 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.011717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.001426 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.009506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.004603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.041457 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.036504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.014532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.014423 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.057253 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.065055 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.019599 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.009704 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.011584 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.020508 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.030714 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.005852 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.019471 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.059723 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.017933 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.036241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.007962 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.006528 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.024272 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.001126 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.001664 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.016089 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002003 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.003452 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.016688 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.027168 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.066367 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.059345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.045594 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023004 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.051726 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.039767 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.001796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.053306 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.030505 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.034064 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.037334 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.016869 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.022606 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.014519 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.034283 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.021881 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.009914 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.015144 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.032104 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.084487 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.003504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | state_1 | 0.046707 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | BioDadInHH2_1 | -0.032556 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmAge2 | -0.011158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmBlac2_1 | 0.045969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | TcBlac2_1 | 0.062286 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmMrSt2_1 | -0.02112 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmEd2 | 0.003704 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | KFASTScr | 0.001911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RMomAgeU | 0.042917 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_1 | 0.001836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_2 | 0.011966 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_3 | -0.000588 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_4 | -0.031635 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_5 | 0.03408 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_1 | -0.020218 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_2 | 0.024941 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_3 | 0.002759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_4 | 0.002021 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SWghtLB | -0.022619 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SurpPreg_1 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_1 | -0.044081 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_2 | 0.003514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_3 | -0.008938 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_1 | 0.010825 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_2 | -0.012394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | peri_health | -0.019048 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | caregiv_health | -0.001676 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | gov_assist | 0.01349 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.6 | 0.028656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.15 | -0.02358 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.24 | -0.017473 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.6 | 0.035384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.15 | -0.069623 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.6_1 | 0.066159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.15_1 | 0.005755 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.24_1 | -0.025656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.35_1 | -0.013387 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.6 | -0.042805 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.24 | -0.006412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.35 | 0.003724 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.6 | -0.04382 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.15 | -0.01477 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.24 | -0.048202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.6 | 0.03759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.15 | 0.078278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.24 | 0.051997 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.6 | -0.030969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.15 | 0.004609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.24 | -0.047911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.35 | -0.07415 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.6 | -0.036626 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.15 | -0.046776 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.24 | -0.044794 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.35 | -0.021949 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.6 | 0.024018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.15 | -0.008257 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.24 | 0.004373 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.24 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.35 | 0.023288 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.24 | -0.019433 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.35 | -0.016828 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.24 | 0.027503 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.35 | 0.054757 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | StrDif_Tot.35 | 0.022732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | fscore.35 | -0.059882 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.6 | 0.039731 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.15 | 0.031636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.24 | 0.014185 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.35 | 0.019732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points Averaging Across Imputed Datasets plot(balance_stats.cbps, t = 4, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-3b--update-simplified-formulas","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Step 3b. Update Simplified Formulas","title":"Workflow: Continuous Exposure","text":"Subsequently, update shortened formulas include time-varying confounders (t-1 +) successfully balanced full formulas, shown . , create final round weights formulas using createFormulas() function (setting type = “update” providing balance statistics bal_stats field). createFormulas() function draws user-provided balance statistics automatically identify add formulas exposure time point time-varying confounders lags greater 1 remain imbalanced weighting. function displays weights formula console message user time-varying confounders added. required input update shortened weights formulas using createFormulas() function : MSM object (e.g., “obj”), setting type = “update”, providing bal_stats balance statistics just created Step 3a. optional input detailed Step 1a. function returns list weights formulas labeled type, exposure, outcome, exposure time point. , update short formulas using balance statistics best-performing weights. inspect new formulas make sure imbalanced covariates added appropriate formulas. user option supply save.save printed output home directory. shown , income 6 15 months (“InRatioCor.6” “InRatioCor.15”) added 35-month weights formula. originally weights formula given lags greater t -1. remaining imbalance suggests achieving balance 24-month income successfully balance prior levels income. use weights formulas recreate CBPS weights effort achieve greatest reduction balance.","code":"type <- \"update\" bal_stats <- balance_stats.cbps updated_formulas <- createFormulas(obj = obj, type = type, bal_stats = bal_stats, save.out = save.out) print(updated_formulas, save.out = save.out) #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 6, the update formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 15, the update formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 24, the update formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 35, the update formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 58, the update formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-3c--create-final-balancing-weights","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Step 3c. Create Final Balancing Weights","title":"Workflow: Continuous Exposure","text":"Next, create final set balancing weights using optimal weighting method identified Step 2c updated formulas previous step using createWeights() function (method = “…’), SuperLearner method optimal weighting method identified Step 2c. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016) distributions saved home directory inspection. required inputs using createWeights() function create final round IPTW balancing weights using updated short weights formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), best-performing weights method, updated formulas (see Step 3a). optional input createWeights() function listed Step 2b. function returns list form WeightItMSM output. , use updated formulas CPBS weighting method create final round IPTW balancing weights. inspect final weights imputed dataset. user option supply save.save printed plot output home directory. shown , weights median value 0.77 range 0-9, .","code":"formulas <- updated_formulas method <- \"cbps\" final_weights <- createWeights(data = data, obj = obj, method = method, formulas = formulas, max.it = 1, # testing only save.out = save.out) print(final_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.77 (SD = 1.18; range = 0-9). plot(final_weights, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"d--trim-final-balancing-weights","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"3d. Trim Final Balancing Weights","title":"Workflow: Continuous Exposure","text":"next step trim (.e., winsorize) final set weights eliminate heavy right tail distribution using trimWeights() function. function draws Weightit package (Griefer, 2023) plots summarizes trimmed weights. function outputs list trimmed weights either single nested list (labeled “0” data data frame format) nested lists imputed dataset (data imputed). required input trimWeights() function final weights just created. optional input allows user specify quantile value (0-1; default 0.95) weights replaced weight value quantile, reduce heavy right tail. , use default 95th percentile trimming weights. trim final weights . function returns list weights objects, containing trimmed weights, form weightitMSM output ( one entry per imputed dataset, applicable). entry also specifies quantile value weights trimmed. inspect trimmed weights one imputed datasets . user option supply save.save plots home directory. shown , weights still median value 0.77 smaller standard deviation range now goes 0-4. create trimmed weights using two quantile values + /- ~0.3 previously chosen quantile value, order conduct recommended sensitivity analyses subsequent steps. first create weights 92nd quantile value. Trimming 92nd quantile preserves median 0.77 even smaller standard deviation range. 98th quantile value. Trimming instead 98th quantile produces larger standard deviation range. find comparable descriptive statistics sets weights, upper range value varying quantile cutoff. assess consequences differences (e.g., different ranges) subsequent steps.","code":"quantile <- 0.95 weights <- final_weights trim_weights <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 95th quantile, the median weight value is 0.77 (SD = 0.93; range = 0-4). plot(trim_weights, i = 1, save.out = save.out) quantile <- 0.92 trim_weights.s1 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s1, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 92th quantile, the median weight value is 0.77 (SD = 0.82; range = 0-3). plot(trim_weights.s1, i = 1, save.out = save.out) quantile <- 0.98 trim_weights.s2 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s2, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 98th quantile, the median weight value is 0.77 (SD = 1.06; range = 0-5). plot(trim_weights.s2, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"sensitvity-analyses","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Sensitvity Analyses","title":"Workflow: Continuous Exposure","text":"create trimmed weights using two quantile values + /- ~0.3 previously chosen quantile value, order conduct recommended sensitivity analyses subsequent steps. first create weights 92nd quantile value. Trimming 92nd quantile preserves median 0.77 even smaller standard deviation range. 98th quantile value. Trimming instead 98th quantile produces larger standard deviation range. find comparable descriptive statistics sets weights, upper range value varying quantile cutoff. assess consequences differences (e.g., different ranges) subsequent steps.","code":"quantile <- 0.92 trim_weights.s1 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s1, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 92th quantile, the median weight value is 0.77 (SD = 0.82; range = 0-3). plot(trim_weights.s1, i = 1, save.out = save.out) quantile <- 0.98 trim_weights.s2 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s2, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 98th quantile, the median weight value is 0.77 (SD = 1.06; range = 0-5). plot(trim_weights.s2, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-4-conduct-final-balance-assessment","dir":"Articles","previous_headings":"","what":"Step 4: Conduct Final Balance Assessment","title":"Workflow: Continuous Exposure","text":"created trimmed final set IPTW balancing weights, next step conduct final evaluation well reduce imbalance. assess performance final trimmed untrimmed weights using assessBalance() function. required inputs using assessBalance() function assess final, trimmed weights achieve balance full formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), weights. optional inputs assessBalance() function detailed Step 1b. , assess balance trimmed weights. Assess balance trimmed weights Summarize inspect. shown , trimmed weights result one imbalanced confounder relation exposure 15 months effective sample size 719. assess balance untrimmed weights Summarize inspect see non-trimmed weights result imbalanced confounders effective sample size 611. scenario, given , trimmed weights, imbalanced confounder (income 6 months) related exposure -0.051 trimmed weights yield higher effective sample size, proceed trimmed weights. summarize final balance statistics, averaging across imputed datasets. user option supply save.save plot output home directory. outcome modeling step (Step 5), users option include remaining imbalanced confounders time invariant covariates final outcome model. case, manually list imbalanced confounders time invariant assign covariates. Subsequently, also assess balance weights trimmed two additional quantile values assess whether final balance assessment sensitive trim value. first assess balance weights trimmed 93rd quantile value. , similarly find income 6 months imbalanced respect exposure 15 months (albeit slighter stronger correlation main analyses). next assess balance weights trimmed 98th quantile value. , find remaining imbalanced confounders (similar untrimmed results).","code":"weights <- trim_weights final_balance_stats_trim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats_trim, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.018002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.01641 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.009705 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.017384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.017685 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00618 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.036545 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.020649 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.005992 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.001056 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.0065 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.004525 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.006969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.011918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.003678 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.003725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.006049 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.008359 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.000996 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.008394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.010939 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.009158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.005918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.007173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.017437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.000413 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.008989 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.015211 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.010964 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.01114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.018068 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.017711 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.002143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.025159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.024603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.047661 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.005651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.03469 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets summary(trim_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 weights <- final_weights final_balance_stats_untrim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_untrim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.07): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(final_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` plot(final_balance_stats_trim, t = 2, save.out = save.out) # covariates <- c(\"list_imbalanced_ti_conf\") weights <- trim_weights.s1 final_balance_stats.s1 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s1, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 3 out of 241 (1.2%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats.s1, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.02248 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.02024 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.01219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.0244 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.02265 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00906 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.04175 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.02587 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.01202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.00346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.00661 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.00912 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.00351 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.01245 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.00579 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.00296 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.00995 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.00817 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.00333 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.01431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.01323 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.0114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.00775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.0125 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.02183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.00145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.01119 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.01836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.01106 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.016 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.0208 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.02262 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.0034 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.02608 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.02883 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.06024 | 0.05 | 0 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.00713 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.0427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets weights <- trim_weights.s2 final_balance_stats.s2 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s2, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps`"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"trimmed","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Trimmed","title":"Workflow: Continuous Exposure","text":"Assess balance trimmed weights Summarize inspect. shown , trimmed weights result one imbalanced confounder relation exposure 15 months effective sample size 719.","code":"weights <- trim_weights final_balance_stats_trim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats_trim, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.018002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.01641 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.009705 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.017384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.017685 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00618 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.036545 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.020649 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.005992 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.001056 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.0065 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.004525 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.006969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.011918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.003678 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.003725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.006049 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.008359 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.000996 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.008394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.010939 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.009158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.005918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.007173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.017437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.000413 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.008989 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.015211 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.010964 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.01114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.018068 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.017711 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.002143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.025159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.024603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.047661 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.005651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.03469 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets summary(trim_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"untrimmed","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Untrimmed","title":"Workflow: Continuous Exposure","text":"assess balance untrimmed weights Summarize inspect see non-trimmed weights result imbalanced confounders effective sample size 611. scenario, given , trimmed weights, imbalanced confounder (income 6 months) related exposure -0.051 trimmed weights yield higher effective sample size, proceed trimmed weights. summarize final balance statistics, averaging across imputed datasets. user option supply save.save plot output home directory. outcome modeling step (Step 5), users option include remaining imbalanced confounders time invariant covariates final outcome model. case, manually list imbalanced confounders time invariant assign covariates.","code":"weights <- final_weights final_balance_stats_untrim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_untrim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.07): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(final_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` plot(final_balance_stats_trim, t = 2, save.out = save.out) # covariates <- c(\"list_imbalanced_ti_conf\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"sensitvity-analyses-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Sensitvity Analyses","title":"Workflow: Continuous Exposure","text":"Subsequently, also assess balance weights trimmed two additional quantile values assess whether final balance assessment sensitive trim value. first assess balance weights trimmed 93rd quantile value. , similarly find income 6 months imbalanced respect exposure 15 months (albeit slighter stronger correlation main analyses). next assess balance weights trimmed 98th quantile value. , find remaining imbalanced confounders (similar untrimmed results).","code":"weights <- trim_weights.s1 final_balance_stats.s1 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s1, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 3 out of 241 (1.2%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats.s1, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.02248 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.02024 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.01219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.0244 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.02265 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00906 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.04175 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.02587 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.01202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.00346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.00661 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.00912 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.00351 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.01245 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.00579 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.00296 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.00995 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.00817 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.00333 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.01431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.01323 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.0114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.00775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.0125 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.02183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.00145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.01119 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.01836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.01106 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.016 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.0208 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.02262 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.0034 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.02608 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.02883 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.06024 | 0.05 | 0 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.00713 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.0427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets weights <- trim_weights.s2 final_balance_stats.s2 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s2, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps`"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"phase-2-assess-substantive-associations-between-exposure-and-outcome","dir":"Articles","previous_headings":"","what":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","title":"Workflow: Continuous Exposure","text":"created IPTW balancing weights minimize associations confounders exposure time point, can move substantive modeling phase. goal final step fit weighted model relating exposure meaningful epochs developmental time outcome, summarizing visualizing results. step, user models compares various counterfactuals, effects different developmental histories exposure outcome, test substantive hypotheses dose timing. First, use fitModel() function fit weighted generalized linear model relating exposure outcome. function draws glm_weightit() function WeightIt package (Greifer, 2023). exposure main effects models reflect exposure levels exposure time point unless exposure epochs specified. One benefits creating balancing weights can used variety different marginal outcome models encompassed function subset possible models. Note models can get complex advise interpreting individual terms. required inputs using fitModel() function : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), outcome, list trimmed weights, model list (“m0”, “m1”, “m2”, “m3”). first inspect following list models. M0: Baseline model regressing outcome main effects exposure (e.g., infancy, toddlerhood, childhood). M1: Covariate model regressing outcome main effects exposure well user-specified covariates (e.g., confounders measured baseline first time point remained imbalanced weighting Step 4). M2: Interaction model regressing outcome main effects exposure well interactions exposure main effects (e.g., infancy:toddlerhood) user-specified interaction order M3: Full model regressing outcome main effects exposure, user-specified covariates, well exposure main effect interactions interactions expoure covariates, user-specified interaction order , specify M0 model. user selects covariate model (“m1” “m3”), required supply list covariates corresponds covariates wide data (see Step 4). optional inputs fitModel() function follows. user selects interaction model (“m2” “m3”), required provide interaction order integer int_order field reflects maximum interaction (e.g., 3) (automatically include lower order interactions (e.g., 2-way)). interaction order exceed total number exposure main effects (3 case, specified 3 exposure epochs). specify interaction model (“m2” “m3”), also need specify interaction order ( included lower-level interactoins) exposure main effects fitModel() function . user can also specify family (function, quotations; e.g., gaussian) link (quotations, e.g., “identity”) functions generalized linear model (defaults gaussian “link”, respectively). possible families : binomial, gaussian, Gama, inverse.gaussian, poisson, quasi, quasibinomial, quasipoisson. binomial Poisson families, set family quasibinomial quasipoisson, respectively, avoid warning non-integer numbers successes. `quasi’ versions family objects give point estimates standard errors give warning. gaussian family accepts links: “identity”, “log” “inverse”; binomial family links “logit”, “probit”, “cauchit”, (corresponding logistic, normal Cauchy CDFs respectively) “log” “cloglog” (complementary log-log); Gamma family links “inverse”, “identity”, “log”; poisson family links “log”, “identity”, “sqrt”; inverse.gaussian family links 1/mu^2, inverse, identity log. quasi family accepts links “logit”, “probit”, “cloglog”, “identity”, “inverse”, “log”, “1/mu^2”, “sqrt”, function power can used create power link function. , retain default family link functions. function returns list fitted model objects, glm output. fit outcome model using trimmed weights . function returns list models (one per imputed dataset, applicable). inspect model output. user option supply save.save printed output home directory. inspect model averaged across imputed datasets. Importantly, first examine results Wald test top output. case imputed data, likelihood ratio test done pooling parameters via Rubin’s Rules. test compares user-specified model nested version model omits exposure variables test whether exposure predicts variation outcome. Models pooled prior conducting likelihood ratio test imputed data.) conduct sensitivity analyses, fitting model weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recomend user supply new name (e.g., save.= “model_m1_s1.rds”). first fit model weights trimmed 92nd quantile. similarly find significant likelihoood ratio test. fit model weights trimmed 98th quantile. comparable result. final step, use fitted model results test substantive hypotheses dose timing. estimate compare average marginal estimates outcome user-specified exposure history (.e., permutation high (“h) low (“l”) levels exposure exposure epoch) using compareHistories() function. draws primarily avg_predictions() hypotheses() functions marginaleffects package (Arel-Bundock, 2023). First, compareHistories() function creates average predictions outcome exposure history. n combinations user-specified exposure histories, set value predictors full dataset values combination, leaving variables . gives us n datasets, size original dataset used fit model. n datasets, compute predicted values given model taking average predicted value n datasets. n averaged predicted values expected potential outcomes combination. (imputed data, function outputs pooled predicted values using Rubin’s Rules.) Next, using predicted values, function conducts comparisons different histories (pooling across imputed datasets imputed data using Rubin’s Rules). Lastly, function implements correction multiple comparisons (treating run function family) plotting results. Box plots display outcome x-axis exposure history y-axis whiskers display standard errors. required inputs using compareHistories() function : MSM object (e.g., “obj”) fitted model output (previous steps). optional inputs follows. create histories high low values continuous exposures, hi_lo_cut user can specify list two quantile values (0-1; default median split +/- 0.001) demarcating high low levels exposure, respectively. (Imputed data stacked calculate cutoff values.) suggest drawing existing hypotheses examining variability exposure variable determine high low cutoffs. recommend users begin specifying meaningful high low percentile cutoffs examining many individuals sample fall user-specified exposure histories created percentile cutoffs (see Specify Core Inputs vignette). gold standard recommendations sufficient cell numbers per history, users ensure reasonable coverage histories avoid extrapolation maximize precision. , draw high low cutoffs previously specified, 60th 30th percentile values denote high low levels economic strain, respectively. user also option estimate compare custom subset user-specified exposure histories (.e., sequences high low levels exposure epoch time point) using reference comparison fields. conduct recommended customized comparisons, users must provide least one unique valid history (e.g., “l-l-l”) reference , quotations, provide string (list strings) lowercase l’s h’s (separated -), corresponding exposure epoch (time point), signify sequence exposure levels (“low” “high”, respectively). user supplies reference history, required provide least one unique valid history comparison , quotations, providing comparison string (list strings) l’s h’s (separated “-”), corresponding exposure epoch, signify sequence exposure levels (“low” “high”, respectively) constitutes comparison exposure history/histories compared reference. user supplies one comparisons, least one reference must specified. reference exposure history compared comparison history comparisons subject multiple comparison correction. reference comparison specified, histories compared . 4 exposure main effects (either epochs exposure time points), user required select subset history comparisons (Step 5b), given base code (see hypotheses() function marginaleffects package; Arel-Bundock, 2023) accommodate pairwise history comparisons 5 time points. user can also specify multiple comparison method mc_method quotations, providing shorthand method (“holm”, “hochberg”,“hommel”, “bonferroni”, “BH” (default), “”, “fdr”, “n” (see stats::p.adjust documentation; R Core Team) multiple comparison correction applied final (pooled across imputed datasets applicable) contrasts comparing effects different exposure histories outcome (default Benjamini-Hochburg). code run considered family. user iterates function specifying different comparisons time, strongly recommend interpreting outcome inclusive set comparisons avoid false discovery. , retain default Benjamini-Hochburg method multiple comparison. Based substantive interests, user also option choose level dosage (“h” “l”) tallied labels dose counts tables figures (dose_level; default “h”). example, exposure variable coded way lower levels conceptualized exposure (e.g., lower income), user may wish choose dosage level “l”. , given interest histories high economic strain, specify wish tally high doses exposure. Lastly, user can provide alternate plotting labels exposure outcome exp_lab out_lab fields (defaults variable names), well list (equal number exposure main effects +1) colors Brewer color palette (colors; default “Dark2”). See RColorBrewer::display.brewer.() https://r-graph-gallery.com/38-rcolorbrewers-palettes.html). , specify plotting labels 4 colors. function returns data frame user-specified history comparisons containing contrast estimates, standard errors, statistics, p-values, low high confidence intervals, corrected p-values, labeled history dose. function outputs list two entries. first contains predicted values history second contains comparisons. inspect compared histories output (now averaged across imputed datsets). user option supply save.save printed output home directory. first confirm distribution sample across exposure histories reasonable. summarize results. inspect history comparison conclude evidence children experienced different histories exposure economic strain infancy, toddlerhood, early childhood differ behavioral problems early childhood. Lastly, plot results. user option supply save.save plot output home directory. conduct sensitivity analyses assessing comparing histories drawing models used weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recommend user supply new name (e.g., save.= “history_comparisons_s1.rds”). first compare histories using model fit weights trimmed 92nd quantile value. shown , results indicate marginal non-significant contrast “l-l-l” “h-h-h” histories economic strain exposure relation behavior problems early childhood. compare histories using model fit weights trimmed 98th quantile value. Similarly, find evidence differences behavioral problems function history exposure economic strain.","code":"m <- \"m0\" #int_order <- 2 family <- gaussian link <- \"identity\" weights <- trim_weights models <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.181783 3 0.4300163 NA 1 2.021014 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.483 | [0.452, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.112, 0.169] | 0.442 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.003 | [-0.042, 0.048] | 0.891 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.012 | [-0.054, 0.079] | 0.650 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s1 models.s1 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s1, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -0.42805 3 0.6223825 NA 1 1.252613 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.481 | [0.450, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.085, 0.141] | 0.400 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.006 | [-0.040, 0.051] | 0.784 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.015 | [-0.061, 0.091] | 0.601 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s2 models.s2 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s2, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.653469 3 0.3504546 NA 1 2.86164 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+--------+-----------------+--------+ #> | | (1) | #> +--------------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+========+=================+========+ #> | (Intercept) | 0.485 | [0.454, 0.515] | <0.001 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Childhood | 0.029 | [-0.150, 0.209] | 0.487 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Infancy | -0.002 | [-0.055, 0.052] | 0.934 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.009 | [-0.061, 0.080] | 0.748 | #> +--------------------+--------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+--------+-----------------+--------+ hi_lo_cut <- c(0.6, 0.3) mc_comp_method <- \"BH\" dose_level <- \"h\" exp_lab <- \"Economic Strain\" out_lab <- \"Behavior Problems\" colors <- c(\"blue4\", \"darkgreen\", \"darkgoldenrod\", \"red2\") model <- models results <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) print(results) #> Summary of Exposure Main Effects: #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> #> Below are the pooled average predictions by user-specified history: #> +-------+----------+-----------+----------+-----------+ #> | term | estimate | std.error | conf.low | conf.high | #> +=======+==========+===========+==========+===========+ #> | l-l-l | 0.47 | 0.014 | 0.44 | 0.49 | #> +-------+----------+-----------+----------+-----------+ #> | h-h-h | 0.5 | 0.019 | 0.43 | 0.57 | #> +-------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+============+============+===========+=============+============+==============+ #> | (h-h-h) - (l-l-l) | 0.02991272 | 0.01979075 | 0.2172254 | -0.02903923 | 0.08886468 | 0.2172254 | #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ summary(results, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02991272 0.01979075 1.511449 3.40476 0.2172254 #> conf.low conf.high dose p.value_corr #> 1 -0.02903923 0.08886468 3 - 0 0.2172254 plot(results, save.out = save.out) model <- models.s1 results.s1 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s1, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.03275407 0.01735569 1.887224 5.210738 0.1154298 #> conf.low conf.high dose p.value_corr #> 1 -0.01132286 0.07683101 3 - 0 0.1154298 model <- models.s2 results.s2 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s2, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02588619 0.0234072 1.105907 2.462813 0.3649947 #> conf.low conf.high dose p.value_corr #> 1 -0.05869734 0.1104697 3 - 0 0.3649947"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-5-fit-weighted-outcome-model-summarize-visualize-results","dir":"Articles","previous_headings":"","what":"Step 5: Fit Weighted Outcome Model & Summarize & Visualize Results","title":"Workflow: Continuous Exposure","text":"goal final step fit weighted model relating exposure meaningful epochs developmental time outcome, summarizing visualizing results. step, user models compares various counterfactuals, effects different developmental histories exposure outcome, test substantive hypotheses dose timing. First, use fitModel() function fit weighted generalized linear model relating exposure outcome. function draws glm_weightit() function WeightIt package (Greifer, 2023). exposure main effects models reflect exposure levels exposure time point unless exposure epochs specified. One benefits creating balancing weights can used variety different marginal outcome models encompassed function subset possible models. Note models can get complex advise interpreting individual terms. required inputs using fitModel() function : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), outcome, list trimmed weights, model list (“m0”, “m1”, “m2”, “m3”). first inspect following list models. M0: Baseline model regressing outcome main effects exposure (e.g., infancy, toddlerhood, childhood). M1: Covariate model regressing outcome main effects exposure well user-specified covariates (e.g., confounders measured baseline first time point remained imbalanced weighting Step 4). M2: Interaction model regressing outcome main effects exposure well interactions exposure main effects (e.g., infancy:toddlerhood) user-specified interaction order M3: Full model regressing outcome main effects exposure, user-specified covariates, well exposure main effect interactions interactions expoure covariates, user-specified interaction order , specify M0 model. user selects covariate model (“m1” “m3”), required supply list covariates corresponds covariates wide data (see Step 4). optional inputs fitModel() function follows. user selects interaction model (“m2” “m3”), required provide interaction order integer int_order field reflects maximum interaction (e.g., 3) (automatically include lower order interactions (e.g., 2-way)). interaction order exceed total number exposure main effects (3 case, specified 3 exposure epochs). specify interaction model (“m2” “m3”), also need specify interaction order ( included lower-level interactoins) exposure main effects fitModel() function . user can also specify family (function, quotations; e.g., gaussian) link (quotations, e.g., “identity”) functions generalized linear model (defaults gaussian “link”, respectively). possible families : binomial, gaussian, Gama, inverse.gaussian, poisson, quasi, quasibinomial, quasipoisson. binomial Poisson families, set family quasibinomial quasipoisson, respectively, avoid warning non-integer numbers successes. `quasi’ versions family objects give point estimates standard errors give warning. gaussian family accepts links: “identity”, “log” “inverse”; binomial family links “logit”, “probit”, “cauchit”, (corresponding logistic, normal Cauchy CDFs respectively) “log” “cloglog” (complementary log-log); Gamma family links “inverse”, “identity”, “log”; poisson family links “log”, “identity”, “sqrt”; inverse.gaussian family links 1/mu^2, inverse, identity log. quasi family accepts links “logit”, “probit”, “cloglog”, “identity”, “inverse”, “log”, “1/mu^2”, “sqrt”, function power can used create power link function. , retain default family link functions. function returns list fitted model objects, glm output. fit outcome model using trimmed weights . function returns list models (one per imputed dataset, applicable). inspect model output. user option supply save.save printed output home directory. inspect model averaged across imputed datasets. Importantly, first examine results Wald test top output. case imputed data, likelihood ratio test done pooling parameters via Rubin’s Rules. test compares user-specified model nested version model omits exposure variables test whether exposure predicts variation outcome. Models pooled prior conducting likelihood ratio test imputed data.) conduct sensitivity analyses, fitting model weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recomend user supply new name (e.g., save.= “model_m1_s1.rds”). first fit model weights trimmed 92nd quantile. similarly find significant likelihoood ratio test. fit model weights trimmed 98th quantile. comparable result. final step, use fitted model results test substantive hypotheses dose timing. estimate compare average marginal estimates outcome user-specified exposure history (.e., permutation high (“h) low (“l”) levels exposure exposure epoch) using compareHistories() function. draws primarily avg_predictions() hypotheses() functions marginaleffects package (Arel-Bundock, 2023). First, compareHistories() function creates average predictions outcome exposure history. n combinations user-specified exposure histories, set value predictors full dataset values combination, leaving variables . gives us n datasets, size original dataset used fit model. n datasets, compute predicted values given model taking average predicted value n datasets. n averaged predicted values expected potential outcomes combination. (imputed data, function outputs pooled predicted values using Rubin’s Rules.) Next, using predicted values, function conducts comparisons different histories (pooling across imputed datasets imputed data using Rubin’s Rules). Lastly, function implements correction multiple comparisons (treating run function family) plotting results. Box plots display outcome x-axis exposure history y-axis whiskers display standard errors. required inputs using compareHistories() function : MSM object (e.g., “obj”) fitted model output (previous steps). optional inputs follows. create histories high low values continuous exposures, hi_lo_cut user can specify list two quantile values (0-1; default median split +/- 0.001) demarcating high low levels exposure, respectively. (Imputed data stacked calculate cutoff values.) suggest drawing existing hypotheses examining variability exposure variable determine high low cutoffs. recommend users begin specifying meaningful high low percentile cutoffs examining many individuals sample fall user-specified exposure histories created percentile cutoffs (see Specify Core Inputs vignette). gold standard recommendations sufficient cell numbers per history, users ensure reasonable coverage histories avoid extrapolation maximize precision. , draw high low cutoffs previously specified, 60th 30th percentile values denote high low levels economic strain, respectively. user also option estimate compare custom subset user-specified exposure histories (.e., sequences high low levels exposure epoch time point) using reference comparison fields. conduct recommended customized comparisons, users must provide least one unique valid history (e.g., “l-l-l”) reference , quotations, provide string (list strings) lowercase l’s h’s (separated -), corresponding exposure epoch (time point), signify sequence exposure levels (“low” “high”, respectively). user supplies reference history, required provide least one unique valid history comparison , quotations, providing comparison string (list strings) l’s h’s (separated “-”), corresponding exposure epoch, signify sequence exposure levels (“low” “high”, respectively) constitutes comparison exposure history/histories compared reference. user supplies one comparisons, least one reference must specified. reference exposure history compared comparison history comparisons subject multiple comparison correction. reference comparison specified, histories compared . 4 exposure main effects (either epochs exposure time points), user required select subset history comparisons (Step 5b), given base code (see hypotheses() function marginaleffects package; Arel-Bundock, 2023) accommodate pairwise history comparisons 5 time points. user can also specify multiple comparison method mc_method quotations, providing shorthand method (“holm”, “hochberg”,“hommel”, “bonferroni”, “BH” (default), “”, “fdr”, “n” (see stats::p.adjust documentation; R Core Team) multiple comparison correction applied final (pooled across imputed datasets applicable) contrasts comparing effects different exposure histories outcome (default Benjamini-Hochburg). code run considered family. user iterates function specifying different comparisons time, strongly recommend interpreting outcome inclusive set comparisons avoid false discovery. , retain default Benjamini-Hochburg method multiple comparison. Based substantive interests, user also option choose level dosage (“h” “l”) tallied labels dose counts tables figures (dose_level; default “h”). example, exposure variable coded way lower levels conceptualized exposure (e.g., lower income), user may wish choose dosage level “l”. , given interest histories high economic strain, specify wish tally high doses exposure. Lastly, user can provide alternate plotting labels exposure outcome exp_lab out_lab fields (defaults variable names), well list (equal number exposure main effects +1) colors Brewer color palette (colors; default “Dark2”). See RColorBrewer::display.brewer.() https://r-graph-gallery.com/38-rcolorbrewers-palettes.html). , specify plotting labels 4 colors. function returns data frame user-specified history comparisons containing contrast estimates, standard errors, statistics, p-values, low high confidence intervals, corrected p-values, labeled history dose. function outputs list two entries. first contains predicted values history second contains comparisons. inspect compared histories output (now averaged across imputed datsets). user option supply save.save printed output home directory. first confirm distribution sample across exposure histories reasonable. summarize results. inspect history comparison conclude evidence children experienced different histories exposure economic strain infancy, toddlerhood, early childhood differ behavioral problems early childhood. Lastly, plot results. user option supply save.save plot output home directory. conduct sensitivity analyses assessing comparing histories drawing models used weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recommend user supply new name (e.g., save.= “history_comparisons_s1.rds”). first compare histories using model fit weights trimmed 92nd quantile value. shown , results indicate marginal non-significant contrast “l-l-l” “h-h-h” histories economic strain exposure relation behavior problems early childhood. compare histories using model fit weights trimmed 98th quantile value. Similarly, find evidence differences behavioral problems function history exposure economic strain.","code":"m <- \"m0\" #int_order <- 2 family <- gaussian link <- \"identity\" weights <- trim_weights models <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.181783 3 0.4300163 NA 1 2.021014 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.483 | [0.452, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.112, 0.169] | 0.442 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.003 | [-0.042, 0.048] | 0.891 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.012 | [-0.054, 0.079] | 0.650 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s1 models.s1 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s1, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -0.42805 3 0.6223825 NA 1 1.252613 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.481 | [0.450, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.085, 0.141] | 0.400 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.006 | [-0.040, 0.051] | 0.784 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.015 | [-0.061, 0.091] | 0.601 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s2 models.s2 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s2, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.653469 3 0.3504546 NA 1 2.86164 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+--------+-----------------+--------+ #> | | (1) | #> +--------------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+========+=================+========+ #> | (Intercept) | 0.485 | [0.454, 0.515] | <0.001 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Childhood | 0.029 | [-0.150, 0.209] | 0.487 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Infancy | -0.002 | [-0.055, 0.052] | 0.934 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.009 | [-0.061, 0.080] | 0.748 | #> +--------------------+--------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+--------+-----------------+--------+ hi_lo_cut <- c(0.6, 0.3) mc_comp_method <- \"BH\" dose_level <- \"h\" exp_lab <- \"Economic Strain\" out_lab <- \"Behavior Problems\" colors <- c(\"blue4\", \"darkgreen\", \"darkgoldenrod\", \"red2\") model <- models results <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) print(results) #> Summary of Exposure Main Effects: #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> #> Below are the pooled average predictions by user-specified history: #> +-------+----------+-----------+----------+-----------+ #> | term | estimate | std.error | conf.low | conf.high | #> +=======+==========+===========+==========+===========+ #> | l-l-l | 0.47 | 0.014 | 0.44 | 0.49 | #> +-------+----------+-----------+----------+-----------+ #> | h-h-h | 0.5 | 0.019 | 0.43 | 0.57 | #> +-------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+============+============+===========+=============+============+==============+ #> | (h-h-h) - (l-l-l) | 0.02991272 | 0.01979075 | 0.2172254 | -0.02903923 | 0.08886468 | 0.2172254 | #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ summary(results, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02991272 0.01979075 1.511449 3.40476 0.2172254 #> conf.low conf.high dose p.value_corr #> 1 -0.02903923 0.08886468 3 - 0 0.2172254 plot(results, save.out = save.out) model <- models.s1 results.s1 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s1, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.03275407 0.01735569 1.887224 5.210738 0.1154298 #> conf.low conf.high dose p.value_corr #> 1 -0.01132286 0.07683101 3 - 0 0.1154298 model <- models.s2 results.s2 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s2, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02588619 0.0234072 1.105907 2.462813 0.3649947 #> conf.low conf.high dose p.value_corr #> 1 -0.05869734 0.1104697 3 - 0 0.3649947"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-5a--select-fit-a-weighted-outcome-model","dir":"Articles","previous_headings":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","what":"Step 5a. Select & Fit a Weighted Outcome Model","title":"Workflow: Continuous Exposure","text":"First, use fitModel() function fit weighted generalized linear model relating exposure outcome. function draws glm_weightit() function WeightIt package (Greifer, 2023). exposure main effects models reflect exposure levels exposure time point unless exposure epochs specified. One benefits creating balancing weights can used variety different marginal outcome models encompassed function subset possible models. Note models can get complex advise interpreting individual terms. required inputs using fitModel() function : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), outcome, list trimmed weights, model list (“m0”, “m1”, “m2”, “m3”). first inspect following list models. M0: Baseline model regressing outcome main effects exposure (e.g., infancy, toddlerhood, childhood). M1: Covariate model regressing outcome main effects exposure well user-specified covariates (e.g., confounders measured baseline first time point remained imbalanced weighting Step 4). M2: Interaction model regressing outcome main effects exposure well interactions exposure main effects (e.g., infancy:toddlerhood) user-specified interaction order M3: Full model regressing outcome main effects exposure, user-specified covariates, well exposure main effect interactions interactions expoure covariates, user-specified interaction order , specify M0 model. user selects covariate model (“m1” “m3”), required supply list covariates corresponds covariates wide data (see Step 4). optional inputs fitModel() function follows. user selects interaction model (“m2” “m3”), required provide interaction order integer int_order field reflects maximum interaction (e.g., 3) (automatically include lower order interactions (e.g., 2-way)). interaction order exceed total number exposure main effects (3 case, specified 3 exposure epochs). specify interaction model (“m2” “m3”), also need specify interaction order ( included lower-level interactoins) exposure main effects fitModel() function . user can also specify family (function, quotations; e.g., gaussian) link (quotations, e.g., “identity”) functions generalized linear model (defaults gaussian “link”, respectively). possible families : binomial, gaussian, Gama, inverse.gaussian, poisson, quasi, quasibinomial, quasipoisson. binomial Poisson families, set family quasibinomial quasipoisson, respectively, avoid warning non-integer numbers successes. `quasi’ versions family objects give point estimates standard errors give warning. gaussian family accepts links: “identity”, “log” “inverse”; binomial family links “logit”, “probit”, “cauchit”, (corresponding logistic, normal Cauchy CDFs respectively) “log” “cloglog” (complementary log-log); Gamma family links “inverse”, “identity”, “log”; poisson family links “log”, “identity”, “sqrt”; inverse.gaussian family links 1/mu^2, inverse, identity log. quasi family accepts links “logit”, “probit”, “cloglog”, “identity”, “inverse”, “log”, “1/mu^2”, “sqrt”, function power can used create power link function. , retain default family link functions. function returns list fitted model objects, glm output. fit outcome model using trimmed weights . function returns list models (one per imputed dataset, applicable). inspect model output. user option supply save.save printed output home directory. inspect model averaged across imputed datasets. Importantly, first examine results Wald test top output. case imputed data, likelihood ratio test done pooling parameters via Rubin’s Rules. test compares user-specified model nested version model omits exposure variables test whether exposure predicts variation outcome. Models pooled prior conducting likelihood ratio test imputed data.) conduct sensitivity analyses, fitting model weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recomend user supply new name (e.g., save.= “model_m1_s1.rds”). first fit model weights trimmed 92nd quantile. similarly find significant likelihoood ratio test. fit model weights trimmed 98th quantile. comparable result.","code":"m <- \"m0\" #int_order <- 2 family <- gaussian link <- \"identity\" weights <- trim_weights models <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.181783 3 0.4300163 NA 1 2.021014 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.483 | [0.452, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.112, 0.169] | 0.442 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.003 | [-0.042, 0.048] | 0.891 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.012 | [-0.054, 0.079] | 0.650 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s1 models.s1 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s1, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -0.42805 3 0.6223825 NA 1 1.252613 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.481 | [0.450, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.085, 0.141] | 0.400 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.006 | [-0.040, 0.051] | 0.784 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.015 | [-0.061, 0.091] | 0.601 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s2 models.s2 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s2, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.653469 3 0.3504546 NA 1 2.86164 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+--------+-----------------+--------+ #> | | (1) | #> +--------------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+========+=================+========+ #> | (Intercept) | 0.485 | [0.454, 0.515] | <0.001 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Childhood | 0.029 | [-0.150, 0.209] | 0.487 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Infancy | -0.002 | [-0.055, 0.052] | 0.934 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.009 | [-0.061, 0.080] | 0.748 | #> +--------------------+--------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+--------+-----------------+--------+"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"sensitvity-analyses-2","dir":"Articles","previous_headings":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","what":"Sensitvity Analyses","title":"Workflow: Continuous Exposure","text":"conduct sensitivity analyses, fitting model weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recomend user supply new name (e.g., save.= “model_m1_s1.rds”). first fit model weights trimmed 92nd quantile. similarly find significant likelihoood ratio test. fit model weights trimmed 98th quantile. comparable result.","code":"weights <- trim_weights.s1 models.s1 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s1, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -0.42805 3 0.6223825 NA 1 1.252613 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.481 | [0.450, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.085, 0.141] | 0.400 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.006 | [-0.040, 0.051] | 0.784 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.015 | [-0.061, 0.091] | 0.601 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s2 models.s2 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s2, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.653469 3 0.3504546 NA 1 2.86164 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+--------+-----------------+--------+ #> | | (1) | #> +--------------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+========+=================+========+ #> | (Intercept) | 0.485 | [0.454, 0.515] | <0.001 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Childhood | 0.029 | [-0.150, 0.209] | 0.487 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Infancy | -0.002 | [-0.055, 0.052] | 0.934 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.009 | [-0.061, 0.080] | 0.748 | #> +--------------------+--------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+--------+-----------------+--------+"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-5b--estimate-compare-and-visualize-model-predicted-outcome-as-a-function-of-exposure-history","dir":"Articles","previous_headings":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","what":"Step 5b. Estimate, Compare, and Visualize Model-Predicted Outcome as a Function of Exposure History","title":"Workflow: Continuous Exposure","text":"final step, use fitted model results test substantive hypotheses dose timing. estimate compare average marginal estimates outcome user-specified exposure history (.e., permutation high (“h) low (“l”) levels exposure exposure epoch) using compareHistories() function. draws primarily avg_predictions() hypotheses() functions marginaleffects package (Arel-Bundock, 2023). First, compareHistories() function creates average predictions outcome exposure history. n combinations user-specified exposure histories, set value predictors full dataset values combination, leaving variables . gives us n datasets, size original dataset used fit model. n datasets, compute predicted values given model taking average predicted value n datasets. n averaged predicted values expected potential outcomes combination. (imputed data, function outputs pooled predicted values using Rubin’s Rules.) Next, using predicted values, function conducts comparisons different histories (pooling across imputed datasets imputed data using Rubin’s Rules). Lastly, function implements correction multiple comparisons (treating run function family) plotting results. Box plots display outcome x-axis exposure history y-axis whiskers display standard errors. required inputs using compareHistories() function : MSM object (e.g., “obj”) fitted model output (previous steps). optional inputs follows. create histories high low values continuous exposures, hi_lo_cut user can specify list two quantile values (0-1; default median split +/- 0.001) demarcating high low levels exposure, respectively. (Imputed data stacked calculate cutoff values.) suggest drawing existing hypotheses examining variability exposure variable determine high low cutoffs. recommend users begin specifying meaningful high low percentile cutoffs examining many individuals sample fall user-specified exposure histories created percentile cutoffs (see Specify Core Inputs vignette). gold standard recommendations sufficient cell numbers per history, users ensure reasonable coverage histories avoid extrapolation maximize precision. , draw high low cutoffs previously specified, 60th 30th percentile values denote high low levels economic strain, respectively. user also option estimate compare custom subset user-specified exposure histories (.e., sequences high low levels exposure epoch time point) using reference comparison fields. conduct recommended customized comparisons, users must provide least one unique valid history (e.g., “l-l-l”) reference , quotations, provide string (list strings) lowercase l’s h’s (separated -), corresponding exposure epoch (time point), signify sequence exposure levels (“low” “high”, respectively). user supplies reference history, required provide least one unique valid history comparison , quotations, providing comparison string (list strings) l’s h’s (separated “-”), corresponding exposure epoch, signify sequence exposure levels (“low” “high”, respectively) constitutes comparison exposure history/histories compared reference. user supplies one comparisons, least one reference must specified. reference exposure history compared comparison history comparisons subject multiple comparison correction. reference comparison specified, histories compared . 4 exposure main effects (either epochs exposure time points), user required select subset history comparisons (Step 5b), given base code (see hypotheses() function marginaleffects package; Arel-Bundock, 2023) accommodate pairwise history comparisons 5 time points. user can also specify multiple comparison method mc_method quotations, providing shorthand method (“holm”, “hochberg”,“hommel”, “bonferroni”, “BH” (default), “”, “fdr”, “n” (see stats::p.adjust documentation; R Core Team) multiple comparison correction applied final (pooled across imputed datasets applicable) contrasts comparing effects different exposure histories outcome (default Benjamini-Hochburg). code run considered family. user iterates function specifying different comparisons time, strongly recommend interpreting outcome inclusive set comparisons avoid false discovery. , retain default Benjamini-Hochburg method multiple comparison. Based substantive interests, user also option choose level dosage (“h” “l”) tallied labels dose counts tables figures (dose_level; default “h”). example, exposure variable coded way lower levels conceptualized exposure (e.g., lower income), user may wish choose dosage level “l”. , given interest histories high economic strain, specify wish tally high doses exposure. Lastly, user can provide alternate plotting labels exposure outcome exp_lab out_lab fields (defaults variable names), well list (equal number exposure main effects +1) colors Brewer color palette (colors; default “Dark2”). See RColorBrewer::display.brewer.() https://r-graph-gallery.com/38-rcolorbrewers-palettes.html). , specify plotting labels 4 colors. function returns data frame user-specified history comparisons containing contrast estimates, standard errors, statistics, p-values, low high confidence intervals, corrected p-values, labeled history dose. function outputs list two entries. first contains predicted values history second contains comparisons. inspect compared histories output (now averaged across imputed datsets). user option supply save.save printed output home directory. first confirm distribution sample across exposure histories reasonable. summarize results. inspect history comparison conclude evidence children experienced different histories exposure economic strain infancy, toddlerhood, early childhood differ behavioral problems early childhood. Lastly, plot results. user option supply save.save plot output home directory. conduct sensitivity analyses assessing comparing histories drawing models used weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recommend user supply new name (e.g., save.= “history_comparisons_s1.rds”). first compare histories using model fit weights trimmed 92nd quantile value. shown , results indicate marginal non-significant contrast “l-l-l” “h-h-h” histories economic strain exposure relation behavior problems early childhood. compare histories using model fit weights trimmed 98th quantile value. Similarly, find evidence differences behavioral problems function history exposure economic strain.","code":"hi_lo_cut <- c(0.6, 0.3) mc_comp_method <- \"BH\" dose_level <- \"h\" exp_lab <- \"Economic Strain\" out_lab <- \"Behavior Problems\" colors <- c(\"blue4\", \"darkgreen\", \"darkgoldenrod\", \"red2\") model <- models results <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) print(results) #> Summary of Exposure Main Effects: #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> #> Below are the pooled average predictions by user-specified history: #> +-------+----------+-----------+----------+-----------+ #> | term | estimate | std.error | conf.low | conf.high | #> +=======+==========+===========+==========+===========+ #> | l-l-l | 0.47 | 0.014 | 0.44 | 0.49 | #> +-------+----------+-----------+----------+-----------+ #> | h-h-h | 0.5 | 0.019 | 0.43 | 0.57 | #> +-------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+============+============+===========+=============+============+==============+ #> | (h-h-h) - (l-l-l) | 0.02991272 | 0.01979075 | 0.2172254 | -0.02903923 | 0.08886468 | 0.2172254 | #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ summary(results, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02991272 0.01979075 1.511449 3.40476 0.2172254 #> conf.low conf.high dose p.value_corr #> 1 -0.02903923 0.08886468 3 - 0 0.2172254 plot(results, save.out = save.out) model <- models.s1 results.s1 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s1, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.03275407 0.01735569 1.887224 5.210738 0.1154298 #> conf.low conf.high dose p.value_corr #> 1 -0.01132286 0.07683101 3 - 0 0.1154298 model <- models.s2 results.s2 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s2, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02588619 0.0234072 1.105907 2.462813 0.3649947 #> conf.low conf.high dose p.value_corr #> 1 -0.05869734 0.1104697 3 - 0 0.3649947"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"sensitvity-analyses-3","dir":"Articles","previous_headings":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","what":"Sensitvity Analyses","title":"Workflow: Continuous Exposure","text":"conduct sensitivity analyses assessing comparing histories drawing models used weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recommend user supply new name (e.g., save.= “history_comparisons_s1.rds”). first compare histories using model fit weights trimmed 92nd quantile value. shown , results indicate marginal non-significant contrast “l-l-l” “h-h-h” histories economic strain exposure relation behavior problems early childhood. compare histories using model fit weights trimmed 98th quantile value. Similarly, find evidence differences behavioral problems function history exposure economic strain.","code":"model <- models.s1 results.s1 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s1, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.03275407 0.01735569 1.887224 5.210738 0.1154298 #> conf.low conf.high dose p.value_corr #> 1 -0.01132286 0.07683101 3 - 0 0.1154298 model <- models.s2 results.s2 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s2, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02588619 0.0234072 1.105907 2.462813 0.3649947 #> conf.low conf.high dose p.value_corr #> 1 -0.05869734 0.1104697 3 - 0 0.3649947"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Workflow: Continuous Exposure","text":"Arel-Bundock, V. 2023. marginaleffects: Predictions, Comparisons, Slopes, Marginal Means,Hypothesis Tests. https://CRAN.R-project.org/package=marginaleffects. Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Cole, S. R., & Hernán, M. . (2008). Constructing Inverse Probability Weights Marginal Structural Models. American Journal Epidemiology, 168(6), 656–664. https://doi.org/10.1093/aje/kwn164. Greifer, Noah. 2023.WeightIt: Weighting Covariate Balance Observational Studies. https://CRAN.R-project.org/package=WeightIt. Lumley, Thomas. 2023. “survey: Analysis Complex Survey Samples.” Polley, Eric, Erin LeDell, Chris Kennedy, Mark van der Laan. 2023. SuperLearner: SuperLearner Prediction. https://CRAN.R-project.org/package=SuperLearner. R Core Team (2013). R: language environment statistical computing. R Foundation Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URLhttp://www.R-project.org/. Stuart, E. . (2010). Matching methods causal inference: review look forward. Statistical Science: Review Journal Institute Mathematical Statistics, 25(1), 1–21. https://doi.org/10.1214/09-STS313. Thoemmes, F., & Ong, . D. (2016). Primer Inverse Probability Treatment Weighting Marginal Structural Models. https://doi.org/10.1177/2167696815621645. Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150.","code":""},{"path":"https://istallworthy.github.io/devMSMs/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Isabella Stallworthy. Author, maintainer. Noah Greifer. Author, contributor. Kyle Butts. Contributor. Meriah DeJoseph. Author. Emily Padrutt. Author. Daniel Berry. Author.","code":""},{"path":"https://istallworthy.github.io/devMSMs/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Stallworthy , Greifer N, DeJoseph M, Padrutt E, Berry D (2024). devMSMs: Implementing Marginal Structural Models Longitudinal Data. R package version 0.0.0.9001, https://github.com/istallworthy/devMSMs, https://istallworthy.github.io/devMSMs/.","code":"@Manual{, title = {devMSMs: Implementing Marginal Structural Models with Longitudinal Data}, author = {Isabella Stallworthy and Noah Greifer and Meriah DeJoseph and Emily Padrutt and Daniel Berry}, year = {2024}, note = {R package version 0.0.0.9001, https://github.com/istallworthy/devMSMs}, url = {https://istallworthy.github.io/devMSMs/}, }"},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"devmsms-implementing-marginal-structural-models-msms--with-longitudinal-data","dir":"","previous_headings":"","what":"Implementing Marginal Structural Models with Longitudinal Data","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"study work humans fundamentally interested questions causation. specifically, scientists, clinicians, educators, policymakers alike often interested causal processes involving questions (timing) levels (dose) different factors influence human functioning development, order inform scientific understanding improve people’s lives. However, many, conceptual, methodological, practical barriers prevented use methods causal inference developed fields. goal devMSMs package accompanying tutorial paper, Investigating Causal Questions Human Development Using Marginal Structural Models: Tutorial Introduction devMSMs Package R (insert preprint link ), provide set tools implementing marginal structural models (MSMs; Robins et al., 2000). MSMs orginated epidemiology public health represent one -utilized tool improving causal inference longitudinal observational data, given certain assumptions. brief, MSMs leverage inverse-probability--treatment-weights (IPTW) potential outcomes framework. MSMs first focus problem confounding, using IPTW attenuate associations measured confounders exposure (e.g., experience, characteristic, event –biology broader environment) time. weighted model can fitted relating time-varying exposure future outcome. Finally, model-predicted effects different exposure histories vary dose timing can evaluated compared counterfactuals, reveal putative causal effects. employ term exposure (sometimes referred “treatment” literatures) encompass variety environmental factors, individual characteristics, experiences constitute putative causal events within causal model. Exposures may distal proximal, reflecting developing child’s experience within different environments many levels (Bronfenbrenner & Ceci, 1994), ranging family (e.g., parenting), home (e.g., economic strain), school (e.g., teacher quality), neighborhood (e.g., diversity), greater politico-cultural-economic context (e.g., inequality). Exposures also reflect factors internal child, including neurodevelopmental (e.g., risk markers), physiological (e.g., stress), behavioral (e.g., anxiety) patterns child’s development exposed.","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"core-features","dir":"","previous_headings":"","what":"Core Features","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"Core features devMSMs include: flexible functions built-user guidance, drawing established expertise best practices implementing longitudinal IPTW weighting outcome modeling, answer substantive causal questions dose timing functions accept complete imputed data accommodate missingness often found human studies novel recommended workflow, based expertise several disciplines, using devMSMs functions longitudinal data (see Workflows vignettes) accompanying simulated longitudinal dataset, based real-world, Family Life Project (FLP) study human development, getting know package functions accompanying suite helper functions assist users preparing inspecting data prior implementation devMSMs executable, step--step user guidance implementing devMSMs workflow preliminary steps form vignettes geared toward users levels R programming experience, along R markdown template file brief conceptual introduction, example empirical application, additional resources accompanying tutorial paper","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"package contains 7 core functions implementing two phases MSM process: longitudinal confounder adjustment outcome modeling longitudinal data time-varying exposures. summary terms used devMSMs vignettes functions. details examples can found accompanying manuscript.","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"devMSMs can installed R Studio Github using devtools package: helper functions can installed accompanying devMSMsHelpers repo:","code":"require(devtools, quietly = TRUE) devtools::install_github(\"istallworthy/devMSMs\") library(devMSMs) devtools::install_github(\"istallworthy/devMSMsHelpers\") library(devMSMsHelpers)"},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"recommended-workflow","dir":"","previous_headings":"","what":"Recommended Workflow","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"propose recommended workflow using devMSMs answer causal questions longituinal data. suggest using vignettes order appear Articles tab. reading accompanying manuscript, recommend first reviewing Terminology Data Requirements vignettes begin preparing data. recommend downloading R markdown template file contains code described Specify Core Inputs Workflows vignettes (binary (TBA) continuous exposures) implementing steps .","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"citation--bug-reports","dir":"","previous_headings":"","what":"Citation & Bug Reports","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"Please cite use devMSMs using following citation: Stallworthy , Greifer N, DeJoseph M, Padrutt E, Butts K, Berry D (2024). devMSMs: Implementing Marginal Structural Models Longitudinal Data. R package version 0.0.0.9000, https://istallworthy.github.io/devMSMs/. Please report bugs following link: https://github.com/istallworthy/devMSMs/issues","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"additional-resources","dir":"","previous_headings":"","what":"Additional Resources","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"Arel-Bundock, Diniz, M. ., Greifer, N., & Bacher, E. (2024). marginaleffects: Predictions, Comparisons, Slopes, Marginal Means, Hypothesis Tests (0.12.0) [Computer software]. https://cran.r-project.org/web/packages/marginaleffects/index.html. Austin, P. C. (2011). Introduction Propensity Score Methods Reducing Effects Confounding Observational Studies. Multivariate Behavioral Research, 46(3), 399–424. https://doi.org/10.1080/00273171.2011.568786 Blackwell, M. (2013). Framework Dynamic Causal Inference Political Science. American Journal Political Science, 57(2), 504–520. https://doi.org/10.1111/j.1540-5907.2012.00626.x Cole, S. R., & Hernán, M. . (2008). Constructing Inverse Probability Weights Marginal Structural Models. American Journal Epidemiology, 168(6), 656–664. https://doi.org/10.1093/aje/kwn164 Eronen, M. . (2020). Causal discovery problem psychological interventions. New Ideas Psychology, 59, 100785. https://doi.org/10.1016/j.newideapsych.2020.100785 Fong, C., Hazlett, C., & Imai, K. (2018).Covariate balancing propensity score continuous treatment: Application efficacy political advertisements. Annals Applied Statistics, 12(1), 156–177. https://doi.org/10.1214/17-AOAS1101 Foster, E. M. (2010). Causal inference developmental psychology. Developmental Psychology, 46(6), 1454–1480. https://doi.org/10.1037/a0020204 Greifer N (2024).cobalt: Covariate Balance Tables Plots. R package version 4.5.2, https://github.com/ngreifer/cobalt, https://ngreifer.github.io/cobalt/ Greifer N (2024). WeightIt: Weighting Covariate Balance Observational Studies. https://ngreifer.github.io/WeightIt/, https://github.com/ngreifer/WeightIt Jackson, John W.(2016). Diagnostics Confounding Time-varying Joint Exposures. Epidemiology, 2016 Nov, 27(6), 859-69. https://doi.org/10.1097/EDE.0000000000000547. Haber, N. ., Wood, M. E., Wieten, S., & Breskin, .(2022). DAG Omitted Objects Displayed (DAGWOOD): framework revealing causal assumptions DAGs. Annals Epidemiology, 68, 64–71. https://doi.org/10.1016/j.annepidem.2022.01.001 Hernán, M., & Robins, J. (2024). Causal Inference: . CRC Press. Hirano, K., & Imbens, G. W. (2004).Propensity Score Continuous Treatments. Applied Bayesian Modeling Causal Inference Incomplete-Data Perspectives (pp. 73–84). John Wiley & Sons, Ltd. https://doi.org/10.1002/0470090456.ch7 Kainz, K., Greifer, N., Givens, ., Swietek, K., Lombardi, B. M., Zietz, S., & Kohn, J. L. (2017). Improving Causal Inference: Recommendations Covariate Selection Balance Propensity Score Methods. Journal Society Social Work Research, 8(2), 279–303. https://doi.org/10.1086/691464 Loh, W. W., Ren, D., & West, S. G. (2024). Parametric g-formula Testing Time-Varying Causal Effects: , Matters, Implement Lavaan. Multivariate Behavioral Research, 59(5), 995–1018. https://doi.org/10.1080/00273171.2024.2354228 Pishgar, F., Greifer, N., Leyrat, C., & Stuart, E. (2021). MatchThem: Matching andWeighting Multiple Imputation. R Journal, 13(2), 292–305. https://doi.org/10.32614/RJ-2021-073 Robins, J. M., Hernán, M.Á., & Brumback, B. (2000). Marginal Structural Models Causal Inference Epidemiology. Epidemiology, 11(5), 550–560. Rubin, D. B. (2005). Causal Inference Using Potential Outcomes: Design, Modeling, Decisions. Journal American Statistical Association, 100(469), 322–331. https://doi.org/10.1198/016214504000001880 Rubin, D. B. (1974). Estimating causal effects treatments randomized nonrandomized studies. Journal Educational Psychology, 66(5), 688–701. https://doi.org/10.1037/h0037350 Stuart, E. . (2010). Matching methods causal inference: review look forward. Statistical Science : Review Journal Institute Mathematical Statistics, 25(1), 1–21. https://doi.org/10.1214/09-STS313 Stuart, E. . (2008). Developing practical recommendations use propensity scores: Discussion ‘critical appraisal propensity score matching medical literature 1996 2003’ Peter Austin, Statistics Medicine. Statistics Medicine, 27(12), 2062–2065. https://doi.org/10.1002/sim.3207 Textor, J. (2015). Drawing Analyzing Causal DAGs DAGitty. Thoemmes, F., & Ong, . D. (2016). Primer Inverse Probability Treatment Weighting Marginal Structural Models. https://doi.org/10.1177/2167696815621645 Woodward, J. (2005). Making Things Happen: Theory Causal Explanation. Oxford University Press, USA.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":null,"dir":"Reference","previous_headings":"","what":"Assesses confounder balancing — assessBalance","title":"Assesses confounder balancing — assessBalance","text":"Draws functions cobalt package quantify relations exposure confounders exposure time point according guidelines Jackson, 2016 assess balance time-varying exposures.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assesses confounder balancing — assessBalance","text":"","code":"assessBalance( data, obj, weights = NULL, balance_thresh = NULL, imp_conf = NULL, verbose = FALSE, save.out = FALSE ) # S3 method for class 'devMSM_bal_stats' print(x, i = NA, t = TRUE, save.out = FALSE, ...) # S3 method for class 'devMSM_bal_stats' summary(object, i = NA, save.out = FALSE, ...) # S3 method for class 'devMSM_bal_stats' plot(x, i = NA, t = TRUE, save.out = FALSE, ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assesses confounder balancing — assessBalance","text":"data data wide format : data frame, list imputed data frames, mids object mice package obj initialized MSM object initMSM() weights (optional) list IPTW weights output createWeights() balance_thresh (optional) one two numbers 0 1 indicating single balancing threshold thresholds less important confounders, respectively (default = 0.1) imp_conf (optional) list variable names reflecting important confounders, required two balance thresholds supplied verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. x devMSM_bal_stats object assessBalance multiply imputed datasets, selects imputation print results . Default = 1. = TRUE, imputed datasets looped . = NULL, average imputed datasets summarize . Ignored non-imputed data. t exposure variable use. Can either index 1 number exposures string containing exposure variable name (e.g. \".3\"). t = TRUE, exposure variables looped . ... ignored object devMSM_bal_stats object assessBalance()","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assesses confounder balancing — assessBalance","text":"list containing balance statistics dataframe. length number datasets (1 data.frame number imputed datasets)","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assesses confounder balancing — assessBalance","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) # Prebalance b <- assessBalance(data = data, obj = obj) print(b) #> #> +----------+-----------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+===========+===============+============+==========+ #> | A.1 | C | 0.0928 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | C | 0.2457 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | B.1 | -0.0223 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | A.1 | 0.3289 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | C | 0.0321 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | B.1 | -0.0852 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | B.2 | 0.2001 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | A.1 | 0.0468 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | A.2 | -0.106 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points # returns ggplot of balance stats for all exposure variables plots <- plot(b, t = TRUE) # can plot only specific exposure time periods plot(b, t = \"A.3\") plot(b, t = 3) # Weighted f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) bw <- assessBalance(data = data, weights = w) print(bw) #> #> +----------+-----------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+===========+===============+============+==========+ #> | A.1 | C | -0.1136 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | C | -0.0279 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | B.1 | -0.0216 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | A.1 | 0.1254 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | C | -0.0584 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | B.1 | -0.0606 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | B.2 | -0.0311 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | A.1 | -0.0195 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | A.2 | -0.1877 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points plot(bw)"},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate, compare, and visualize exposure histories — compareHistories","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"Takes fitted model output created predicted values user-specified histories (pooling imputed data), conducting contrast comparisons (pooling imputed data), correcting multiple comparisons, plotting results.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"","code":"compareHistories( fit, hi_lo_cut, dose_level = \"h\", reference = NULL, comparison = NULL, mc_comp_method = \"BH\", verbose = FALSE, save.out = FALSE ) # S3 method for class 'devMSM_comparisons' print(x, save.out = FALSE, ...) # S3 method for class 'devMSM_comparisons' plot( x, colors = \"Dark2\", exp_lab = NULL, out_lab = NULL, save.out = FALSE, ... ) # S3 method for class 'devMSM_comparisons' summary(object, type = \"comps\", ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"fit list model outputs fitModel() hi_lo_cut list two numbers indicating quantile values reflect high low values, respectively, continuous exposure dose_level (optional) \"l\" \"h\" indicating whether low high doses tallied tables plots (default high \"h\") reference lists one strings \"-\"-separated \"l\" \"h\" values indicative reference exposure history compare comparison, required comparison supplied comparison (optional) list one strings \"-\"-separated \"l\" \"h\" values indicative comparison history/histories compare reference, required reference supplied mc_comp_method (optional) character abbreviation multiple comparison correction method stats::p.adjust, default Benjamini-Hochburg (\"BH\") verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. x devMSM_histories object compareHistories() ... ignored colors (optional) character specifying Brewer palette list colors (n(epochs)+1) plotting (default \"Dark2\" palette) exp_lab (optional) character label exposure variable plots (default variable name) out_lab (optional) character label outcome variable plots (default variable name) object devMSM_histories object compareHistories() type Either \"preds\" \"comps\" corresponding results marginaleffects::avg_predictions() low high dosages marginaleffects::avg_comparisons() respectively","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"list containing two dataframes: preds predictions marginaleffects::avg_predictions() containing average expected outcome different exposure histories comps contrasts marginaleffects::comparisons() comparing different exposure history","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"","code":"library(devMSMs) set.seed(123) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) fit <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m0\" ) comp <- compareHistories( fit = fit, hi_lo_cut = c(0.3, 0.6) ) print(comp) #> Summary of Exposure Main Effects: #> USER ALERT: Out of the total of 50 individuals in the sample, below is the distribution of the 50 (100%) individuals that fall into 24 user-selected exposure histories (out of the 24 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch A.1, A.2, A.3. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+---+ #> | epoch_history | n | #> +===============+===+ #> | NA-NA-h | 2 | #> +---------------+---+ #> | NA-NA-l | 1 | #> +---------------+---+ #> | NA-h-NA | 2 | #> +---------------+---+ #> | NA-h-h | 3 | #> +---------------+---+ #> | NA-h-l | 2 | #> +---------------+---+ #> | NA-l-NA | 1 | #> +---------------+---+ #> | NA-l-h | 2 | #> +---------------+---+ #> | NA-l-l | 2 | #> +---------------+---+ #> | h-NA-NA | 2 | #> +---------------+---+ #> | h-NA-h | 4 | #> +---------------+---+ #> | h-NA-l | 1 | #> +---------------+---+ #> | h-h-NA | 2 | #> +---------------+---+ #> | h-h-h | 3 | #> +---------------+---+ #> | h-h-l | 3 | #> +---------------+---+ #> | h-l-NA | 1 | #> +---------------+---+ #> | h-l-h | 2 | #> +---------------+---+ #> | h-l-l | 2 | #> +---------------+---+ #> | l-NA-NA | 3 | #> +---------------+---+ #> | l-NA-l | 2 | #> +---------------+---+ #> | l-h-NA | 2 | #> +---------------+---+ #> | l-h-h | 1 | #> +---------------+---+ #> | l-h-l | 2 | #> +---------------+---+ #> | l-l-NA | 2 | #> +---------------+---+ #> | l-l-h | 3 | #> +---------------+---+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects A.1, A.2, A.3: #> #> Below are the pooled average predictions by user-specified history: #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | term | A.1 | A.2 | A.3 | estimate | std.error | conf.low | conf.high | #> +=======+=======+=======+========+==========+===========+==========+===========+ #> | l-l-l | -0.47 | -0.3 | -0.804 | -0.15 | 0.2 | -0.54 | 0.239 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | l-l-h | -0.47 | -0.3 | -0.051 | -0.064 | 0.2 | -0.47 | 0.338 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | l-h-l | -0.47 | 0.31 | -0.804 | -0.093 | 0.18 | -0.44 | 0.25 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | l-h-h | -0.47 | 0.31 | -0.051 | -0.007 | 0.19 | -0.37 | 0.357 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-l-l | 0.24 | -0.3 | -0.804 | -0.235 | 0.15 | -0.53 | 0.059 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-l-h | 0.24 | -0.3 | -0.051 | -0.149 | 0.15 | -0.45 | 0.154 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-h-l | 0.24 | 0.31 | -0.804 | -0.179 | 0.13 | -0.43 | 0.07 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-h-h | 0.24 | 0.31 | -0.051 | -0.093 | 0.14 | -0.36 | 0.176 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+===============+============+===========+=============+============+==============+ #> | (l-l-l) - (l-l-h) | -0.0860245895 | 0.09323351 | 0.3561746 | -0.26875891 | 0.09670973 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (l-h-l) | -0.0567671468 | 0.06804542 | 0.4041380 | -0.19013372 | 0.07659943 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (l-h-h) | -0.1427917364 | 0.12113186 | 0.2384729 | -0.38020583 | 0.09462235 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (h-l-l) | 0.0855518211 | 0.09515347 | 0.3686031 | -0.10094556 | 0.27204920 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (h-l-h) | -0.0004727684 | 0.12853504 | 0.9970653 | -0.25239681 | 0.25145127 | 0.9970653 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (h-h-l) | 0.0287846743 | 0.12605827 | 0.8193787 | -0.21828499 | 0.27585434 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (h-h-h) | -0.0572399153 | 0.15718786 | 0.7157462 | -0.36532245 | 0.25084262 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (l-h-l) | 0.0292574427 | 0.10941845 | 0.7891686 | -0.18519878 | 0.24371366 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (l-h-h) | -0.0567671468 | 0.06804540 | 0.4041379 | -0.19013369 | 0.07659939 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (h-l-l) | 0.1715764106 | 0.13773921 | 0.2128887 | -0.09838748 | 0.44154030 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (h-l-h) | 0.0855518211 | 0.09515351 | 0.3686033 | -0.10094562 | 0.27204927 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (h-h-l) | 0.1148092638 | 0.15639156 | 0.4628791 | -0.19171256 | 0.42133108 | 0.6480308 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (h-h-h) | 0.0287846743 | 0.12605825 | 0.8193786 | -0.21828496 | 0.27585431 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (l-h-h) | -0.0860245895 | 0.09323348 | 0.3561744 | -0.26875886 | 0.09670968 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (h-l-l) | 0.1423189679 | 0.10713569 | 0.1840462 | -0.06766312 | 0.35230106 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (h-l-h) | 0.0562943784 | 0.13264560 | 0.6712764 | -0.20368622 | 0.31627498 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (h-h-l) | 0.0855518211 | 0.09515354 | 0.3686034 | -0.10094568 | 0.27204932 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (h-h-h) | -0.0004727684 | 0.12853506 | 0.9970653 | -0.25239686 | 0.25145133 | 0.9970653 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-h) - (h-l-l) | 0.2283435575 | 0.15081852 | 0.1300186 | -0.06725530 | 0.52394242 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-h) - (h-l-h) | 0.1423189679 | 0.10713569 | 0.1840463 | -0.06766313 | 0.35230107 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-h) - (h-h-l) | 0.1715764106 | 0.13773922 | 0.2128888 | -0.09838750 | 0.44154032 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-h) - (h-h-h) | 0.0855518211 | 0.09515352 | 0.3686034 | -0.10094565 | 0.27204929 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-l) - (h-l-h) | -0.0860245895 | 0.09323350 | 0.3561745 | -0.26875889 | 0.09670971 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-l) - (h-h-l) | -0.0567671468 | 0.06804546 | 0.4041383 | -0.19013380 | 0.07659951 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-l) - (h-h-h) | -0.1427917364 | 0.12113192 | 0.2384731 | -0.38020594 | 0.09462247 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-h) - (h-h-l) | 0.0292574427 | 0.10941843 | 0.7891686 | -0.18519874 | 0.24371362 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-h) - (h-h-h) | -0.0567671468 | 0.06804543 | 0.4041381 | -0.19013374 | 0.07659945 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-h-l) - (h-h-h) | -0.0860245895 | 0.09323350 | 0.3561745 | -0.26875888 | 0.09670970 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ plot(comp) summary(comp, \"preds\") #> term A.1 A.2 A.3 estimate std.error statistic #> 1 l-l-l -0.4684962 -0.2971206 -0.80434443 -0.149799589 0.1983536 -0.75521501 #> 2 l-l-h -0.4684962 -0.2971206 -0.05134827 -0.063774999 0.2048054 -0.31139320 #> 3 l-h-l -0.4684962 0.3148300 -0.80434443 -0.093032442 0.1750306 -0.53152099 #> 4 l-h-h -0.4684962 0.3148300 -0.05134827 -0.007007852 0.1859760 -0.03768148 #> 5 h-l-l 0.2359494 -0.2971206 -0.80434443 -0.235351410 0.1502513 -1.56638563 #> 6 h-l-h 0.2359494 -0.2971206 -0.05134827 -0.149326820 0.1547615 -0.96488363 #> 7 h-h-l 0.2359494 0.3148300 -0.80434443 -0.178584263 0.1267806 -1.40860879 #> 8 h-h-h 0.2359494 0.3148300 -0.05134827 -0.092559673 0.1371105 -0.67507375 #> p.value s.value conf.low conf.high dose #> 1 0.4501200 1.15161848 -0.5385654 0.23896625 0 #> 2 0.7555017 0.40449305 -0.4651861 0.33763614 1 #> 3 0.5950578 0.74889829 -0.4360861 0.25002124 1 #> 4 0.9699416 0.04403015 -0.3715142 0.35749845 2 #> 5 0.1172584 3.09223725 -0.5298385 0.05913564 1 #> 6 0.3346031 1.57947727 -0.4526538 0.15400011 2 #> 7 0.1589509 2.65334711 -0.4270697 0.06990114 2 #> 8 0.4996289 1.00107114 -0.3612912 0.17617189 3 summary(comp, \"comps\") #> term estimate std.error statistic p.value #> 1 (l-l-l) - (l-l-h) -0.0860245895 0.09323351 -0.922678895 0.3561746 #> 2 (l-l-l) - (l-h-l) -0.0567671468 0.06804542 -0.834253748 0.4041380 #> 3 (l-l-l) - (l-h-h) -0.1427917364 0.12113186 -1.178812343 0.2384729 #> 4 (l-l-l) - (h-l-l) 0.0855518211 0.09515347 0.899092985 0.3686031 #> 5 (l-l-l) - (h-l-h) -0.0004727684 0.12853504 -0.003678129 0.9970653 #> 6 (l-l-l) - (h-h-l) 0.0287846743 0.12605827 0.228344197 0.8193787 #> 7 (l-l-l) - (h-h-h) -0.0572399153 0.15718786 -0.364149728 0.7157462 #> 8 (l-l-h) - (l-h-l) 0.0292574427 0.10941845 0.267390396 0.7891686 #> 9 (l-l-h) - (l-h-h) -0.0567671468 0.06804540 -0.834253950 0.4041379 #> 10 (l-l-h) - (h-l-l) 0.1715764106 0.13773921 1.245661352 0.2128887 #> 11 (l-l-h) - (h-l-h) 0.0855518211 0.09515351 0.899092683 0.3686033 #> 12 (l-l-h) - (h-h-l) 0.1148092638 0.15639156 0.734114205 0.4628791 #> 13 (l-l-h) - (h-h-h) 0.0287846743 0.12605825 0.228344230 0.8193786 #> 14 (l-h-l) - (l-h-h) -0.0860245895 0.09323348 -0.922679121 0.3561744 #> 15 (l-h-l) - (h-l-l) 0.1423189679 0.10713569 1.328399262 0.1840462 #> 16 (l-h-l) - (h-l-h) 0.0562943784 0.13264560 0.424396874 0.6712764 #> 17 (l-h-l) - (h-h-l) 0.0855518211 0.09515354 0.899092410 0.3686034 #> 18 (l-h-l) - (h-h-h) -0.0004727684 0.12853506 -0.003678128 0.9970653 #> 19 (l-h-h) - (h-l-l) 0.2283435575 0.15081852 1.514028672 0.1300186 #> 20 (l-h-h) - (h-l-h) 0.1423189679 0.10713569 1.328399184 0.1840463 #> 21 (l-h-h) - (h-h-l) 0.1715764106 0.13773922 1.245661276 0.2128888 #> 22 (l-h-h) - (h-h-h) 0.0855518211 0.09515352 0.899092564 0.3686034 #> 23 (h-l-l) - (h-l-h) -0.0860245895 0.09323350 -0.922678981 0.3561745 #> 24 (h-l-l) - (h-h-l) -0.0567671468 0.06804546 -0.834253253 0.4041383 #> 25 (h-l-l) - (h-h-h) -0.1427917364 0.12113192 -1.178811770 0.2384731 #> 26 (h-l-h) - (h-h-l) 0.0292574427 0.10941843 0.267390449 0.7891686 #> 27 (h-l-h) - (h-h-h) -0.0567671468 0.06804543 -0.834253622 0.4041381 #> 28 (h-h-l) - (h-h-h) -0.0860245895 0.09323350 -0.922679011 0.3561745 #> s.value conf.low conf.high dose p.value_corr #> 1 1.489343589 -0.26875891 0.09670973 0 - 1 0.5955722 #> 2 1.307080051 -0.19013372 0.07659943 0 - 1 0.5955722 #> 3 2.068102717 -0.38020583 0.09462235 0 - 2 0.5955722 #> 4 1.439859757 -0.10094556 0.27204920 0 - 1 0.5955722 #> 5 0.004240125 -0.25239681 0.25145127 0 - 2 0.9970653 #> 6 0.287397761 -0.21828499 0.27585434 0 - 2 0.8824078 #> 7 0.482479980 -0.36532245 0.25084262 0 - 3 0.8824078 #> 8 0.341594553 -0.18519878 0.24371366 1 - 1 0.8824078 #> 9 1.307080457 -0.19013369 0.07659939 1 - 2 0.5955722 #> 10 2.231828396 -0.09838748 0.44154030 1 - 1 0.5955722 #> 11 1.439859126 -0.10094562 0.27204927 1 - 2 0.5955722 #> 12 1.111292558 -0.19171256 0.42133108 1 - 2 0.6480308 #> 13 0.287397807 -0.21828496 0.27585431 1 - 3 0.8824078 #> 14 1.489344066 -0.26875886 0.09670968 1 - 2 0.5955722 #> 15 2.441859794 -0.06766312 0.35230106 1 - 1 0.5955722 #> 16 0.575021172 -0.20368622 0.31627498 1 - 2 0.8824078 #> 17 1.439858557 -0.10094568 0.27204932 1 - 2 0.5955722 #> 18 0.004240124 -0.25239686 0.25145133 1 - 3 0.9970653 #> 19 2.943210429 -0.06725530 0.52394242 2 - 1 0.5955722 #> 20 2.441859592 -0.06766313 0.35230107 2 - 2 0.5955722 #> 21 2.231828206 -0.09838750 0.44154032 2 - 2 0.5955722 #> 22 1.439858879 -0.10094565 0.27204929 2 - 3 0.5955722 #> 23 1.489343772 -0.26875889 0.09670971 1 - 2 0.5955722 #> 24 1.307079055 -0.19013380 0.07659951 1 - 2 0.5955722 #> 25 2.068101336 -0.38020594 0.09462247 1 - 3 0.5955722 #> 26 0.341594628 -0.18519874 0.24371362 2 - 2 0.8824078 #> 27 1.307079797 -0.19013374 0.07659945 2 - 3 0.5955722 #> 28 1.489343836 -0.26875888 0.09670970 2 - 3 0.5955722 comp2 <- compareHistories( fit = fit, hi_lo_cut = c(0.3, 0.6), reference = \"l-l-l\", comparison = c(\"h-h-h\", \"h-h-l\") ) print(comp2) #> Summary of Exposure Main Effects: #> Warning: There are no participants in your sample in the following histories: l-l-l. #> Please revise your reference/comparison histories and/or the high/low cutoffs, if applicable. #> USER ALERT: Out of the total of 50 individuals in the sample, below is the distribution of the 6 (12%) individuals that fall into 2 user-selected exposure histories (out of the 24 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch A.1, A.2, A.3. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+---+ #> | epoch_history | n | #> +===============+===+ #> | h-h-h | 3 | #> +---------------+---+ #> | h-h-l | 3 | #> +---------------+---+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects A.1, A.2, A.3: #> #> Below are the pooled average predictions by user-specified history: #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | term | A.1 | A.2 | A.3 | estimate | std.error | conf.low | conf.high | #> +=======+=======+=======+========+==========+===========+==========+===========+ #> | l-l-l | -0.47 | -0.3 | -0.804 | -0.15 | 0.2 | -0.54 | 0.24 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-h-l | 0.24 | 0.31 | -0.804 | -0.179 | 0.13 | -0.43 | 0.07 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-h-h | 0.24 | 0.31 | -0.051 | -0.093 | 0.14 | -0.36 | 0.18 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+-------------+-----------+-----------+------------+-----------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+=============+===========+===========+============+===========+==============+ #> | (h-h-h) - (l-l-l) | 0.05723992 | 0.1571879 | 0.7157462 | -0.2508426 | 0.3653225 | 0.8193787 | #> +-------------------+-------------+-----------+-----------+------------+-----------+--------------+ #> | (h-h-l) - (l-l-l) | -0.02878467 | 0.1260583 | 0.8193787 | -0.2758543 | 0.2182850 | 0.8193787 | #> +-------------------+-------------+-----------+-----------+------------+-----------+--------------+ plot(comp2) summary(comp2, \"preds\") #> term A.1 A.2 A.3 estimate std.error statistic #> 1 l-l-l -0.4684962 -0.2971206 -0.80434443 -0.14979959 0.1983536 -0.7552150 #> 7 h-h-l 0.2359494 0.3148300 -0.80434443 -0.17858426 0.1267806 -1.4086088 #> 8 h-h-h 0.2359494 0.3148300 -0.05134827 -0.09255967 0.1371105 -0.6750738 #> p.value s.value conf.low conf.high dose #> 1 0.4501200 1.151618 -0.5385654 0.23896625 0 #> 7 0.1589509 2.653347 -0.4270697 0.06990114 2 #> 8 0.4996289 1.001071 -0.3612912 0.17617189 3 summary(comp2, \"comps\") #> term estimate std.error statistic p.value s.value #> 1 (h-h-h) - (l-l-l) 0.05723992 0.1571879 0.3641497 0.7157462 0.4824800 #> 2 (h-h-l) - (l-l-l) -0.02878467 0.1260583 -0.2283442 0.8193787 0.2873978 #> conf.low conf.high dose p.value_corr #> 1 -0.2508426 0.3653225 3 - 0 0.8193787 #> 2 -0.2758543 0.2182850 2 - 0 0.8193787"},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":null,"dir":"Reference","previous_headings":"","what":"Create balancing formulas — createFormulas","title":"Create balancing formulas — createFormulas","text":"Creates balancing formulas relating exposure relevant time-varying time invariant confounders exposure time point used create IPTW weights.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create balancing formulas — createFormulas","text":"","code":"createFormulas( obj, type = c(\"full\", \"short\", \"update\"), custom = NULL, keep_conf = NULL, bal_stats = NULL, verbose = FALSE, save.out = FALSE ) # S3 method for class 'devMSM_formulas' print(x, ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create balancing formulas — createFormulas","text":"obj initialized MSM object initMSM() type type formula create 'full' (includes lagged time-varying confounders), 'short' (includes time-varying confounders t-1 lag ), 'update' (adds 'short' formulas imbalanced time-varying confounders lags great t-1) custom (optional) custom list formulas exposure time point (default create automatically according type) keep_conf (optional) 'short' formulas , list variable names reflecting confounders included always. bal_stats list balance statistics assessBalance() verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. x devMSM_formulas object createFormulas() ... ignored","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create balancing formulas — createFormulas","text":"list containing balancing formulas. length number exposure variables.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create balancing formulas — createFormulas","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) # Full Formulas f <- createFormulas(obj, type = \"full\") print(f) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 1, the full formula for A.1 is: #> A.1 ~ C #> #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 2, the full formula for A.2 is: #> A.2 ~ C + B.1 + A.1 #> #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 3, the full formula for A.3 is: #> A.3 ~ C + B.1 + B.2 + A.1 + A.2 # Short Formulas f <- createFormulas(obj, type = \"short\") print(f) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 1, the short formula for A.1 is: #> A.1 ~ C #> #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 2, the short formula for A.2 is: #> A.2 ~ C + B.1 + A.1 #> #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 3, the short formula for A.3 is: #> A.3 ~ C + B.2 + A.2 # Update Formulas w <- createWeights(data = data, formulas = f) b <- assessBalance(data = data, weights = w) f <- createFormulas(obj, type = \"update\", bal_stats = b) print(f) #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 1, the update formula for A.1 is: #> A.1 ~ C #> #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 2, the update formula for A.2 is: #> A.2 ~ C + B.1 + A.1 #> #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 3, the update formula for A.3 is: #> A.3 ~ C + B.2 + A.2 + A.1"},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":null,"dir":"Reference","previous_headings":"","what":"Creates IPTW balancing weights — createWeights","title":"Creates IPTW balancing weights — createWeights","text":"Creates IPTW balancing weights user-specified exposure time point using balancing formulas relate exposure time point relevant confounders.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Creates IPTW balancing weights — createWeights","text":"","code":"createWeights( data, formulas, method = \"glm\", verbose = FALSE, save.out = FALSE, ... ) # S3 method for class 'devMSM_weights' print(x, i = 1, ...) # S3 method for class 'devMSM_weights' plot(x, i = 1, save.out = FALSE, ...) # S3 method for class 'devMSM_weights' summary(object, i = 1, ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Creates IPTW balancing weights — createWeights","text":"data data wide format : data frame, list imputed data frames, mids object mice package formulas list balancing formulas time point output createFormulas() method character string weightitMSM() balancing method abbreviation (default generalized linear models propensity score weighting \"glm\") verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. ... arguments passed WeightIt::weightitMSM() summary.weightitMSM() x, object devMSM_weights object createWeights() multiply imputed datasets, selects imputation print results . Default = 1. = TRUE, imputed datasets looped . = NULL, average imputed datasets summarize . Ignored non-imputed data.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Creates IPTW balancing weights — createWeights","text":"list containing WeightIt::weightitMSM() output. length number datasets (1 data.frame number imputed datasets).","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Creates IPTW balancing weights — createWeights","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) print(w) #> #> For the `glm` weighting method, the median weight value is 1.04 (SD = 0.41; range = 0.3-3). plot(w) # Methods from `WeightIt::weightitMSM` w <- createWeights(data = data, formulas = f, method = \"glm\") w <- createWeights(data = data, formulas = f, method = \"cbps\") w <- createWeights(data = data, formulas = f, method = \"gbm\") w <- createWeights(data = data, formulas = f, method = \"bart\") w <- createWeights(data = data, formulas = f, method = \"super\") #> Loading required package: nnls #> Warning: All algorithms have zero weight #> Warning: All metalearner coefficients are zero, predictions will all be equal to 0"},{"path":"https://istallworthy.github.io/devMSMs/reference/devMSMs-package.html","id":null,"dir":"Reference","previous_headings":"","what":"devMSMs: Implementing Marginal Structural Models with Longitudinal Data — devMSMs-package","title":"devMSMs: Implementing Marginal Structural Models with Longitudinal Data — devMSMs-package","text":"Functions implementing MSMS longitudinal data.","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/devMSMs-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"devMSMs: Implementing Marginal Structural Models with Longitudinal Data — devMSMs-package","text":"Maintainer: Isabella Stallworthy istall@seas.upenn.edu Authors: Noah Greifer noah.greifer@gmail.com (ORCID) [contributor] Meriah DeJoseph meriahd@stanford.edu Emily Padrutt padru004@umn.edu Daniel Berry dberry@umn.edu contributors: Kyle Butts buttskyle96@gmail.com [contributor]","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit outcome model — fitModel","title":"Fit outcome model — fitModel","text":"Fits weighted marginal outcome model generalized linear model user's choosing, relating exposure main effects outcome using IPTW weights.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit outcome model — fitModel","text":"","code":"fitModel( data, obj, weights = NULL, outcome, model = \"m0\", int_order = NA, covariates = NULL, family = gaussian(), link = \"identity\", verbose = FALSE, save.out = FALSE ) # S3 method for class 'devMSM_models' print(x, i = NA, save.out = FALSE, ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit outcome model — fitModel","text":"data data wide format : data frame, list imputed data frames, mids object mice package obj initialized MSM object initMSM() weights list IPTW weights output createWeights() outcome name outcome variable \".timepoint\" suffix. See initMSM() details suffix model character indicating one following outcome models: \"m0\" (exposure main effects) \"m1\" (exposure main effects & covariates) \"m2\" (exposure main effects & interactions) \"m3\" (exposure main effects, interactions, & covariates) int_order integer specification highest order exposure main effects interaction, required interaction models (\"m2\", \"m3\") covariates list characters reflecting variable names covariates, required covariate models (\"m1\", \"m3\") family (optional) family function specification WeightIt::glm_weightit() model. link (optional) link function specification WeightIt::glm_weightit() model. verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. x devMSM_models object fitModel multiply imputed datasets, selects imputation print results . Default = 1. = TRUE, imputed datasets looped . = NULL, average imputed datasets summarize . Ignored non-imputed data. ... ignored","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit outcome model — fitModel","text":"list containing WeightIt::glm_weightit() model output. length number datasets (1 data.frame number imputed datasets)","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fit outcome model — fitModel","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) fit_m0 <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m0\" ) print(fit_m0) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> #> Wald test #> Variance: HC0 robust (adjusted for estimation of weights) #> #> Model 1: D.3 ~ A.1 + A.2 + A.3 #> Model 2: D.3 ~ 1 #> #> Res.Df Df Chisq Pr(>Chisq) #> 1 46 #> 2 49 3 17.511 0.0005548 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> #> The marginal model, m0, is summarized below: #> +-------------+--------+-----------------+-------+ #> | | (1) | #> +-------------+--------+-----------------+-------+ #> | | Est. | CI | p | #> +=============+========+=================+=======+ #> | (Intercept) | 0.224 | [-0.011, 0.460] | 0.062 | #> +-------------+--------+-----------------+-------+ #> | A.1 | 0.350 | [0.141, 0.560] | 0.001 | #> +-------------+--------+-----------------+-------+ #> | A.2 | -0.186 | [-0.432, 0.060] | 0.139 | #> +-------------+--------+-----------------+-------+ #> | A.3 | -0.284 | [-0.682, 0.114] | 0.163 | #> +-------------+--------+-----------------+-------+ #> | Num.Obs. | 50 | | | #> +-------------+--------+-----------------+-------+ fit_m1 <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m1\", covariates = c(\"C\") ) print(fit_m1) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> #> Wald test #> Variance: HC0 robust (adjusted for estimation of weights) #> #> Model 1: D.3 ~ A.1 + A.2 + A.3 + C #> Model 2: D.3 ~ C #> #> Res.Df Df Chisq Pr(>Chisq) #> 1 45 #> 2 48 3 17.633 0.0005236 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> #> The marginal model, m1, is summarized below: #> +-------------+--------+-----------------+--------+ #> | | (1) | #> +-------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +=============+========+=================+========+ #> | (Intercept) | 0.222 | [-0.013, 0.458] | 0.064 | #> +-------------+--------+-----------------+--------+ #> | A.1 | 0.352 | [0.143, 0.561] | <0.001 | #> +-------------+--------+-----------------+--------+ #> | A.2 | -0.185 | [-0.432, 0.062] | 0.142 | #> +-------------+--------+-----------------+--------+ #> | A.3 | -0.287 | [-0.689, 0.116] | 0.163 | #> +-------------+--------+-----------------+--------+ #> | C | -0.044 | [-0.277, 0.188] | 0.708 | #> +-------------+--------+-----------------+--------+ #> | Num.Obs. | 50 | | | #> +-------------+--------+-----------------+--------+ fit_m2 <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m2\", int_order = 2 ) print(fit_m2) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> #> Wald test #> Variance: HC0 robust (adjusted for estimation of weights) #> #> Model 1: D.3 ~ A.1 + A.2 + A.3 + A.1 + A.2 + A.3 + A.1:A.2 + A.1:A.3 + A.2:A.3 #> Model 2: D.3 ~ 1 #> #> Res.Df Df Chisq Pr(>Chisq) #> 1 43 #> 2 49 6 19.785 0.003024 ** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> #> The marginal model, m2, is summarized below: #> +-------------+--------+-----------------+-------+ #> | | (1) | #> +-------------+--------+-----------------+-------+ #> | | Est. | CI | p | #> +=============+========+=================+=======+ #> | (Intercept) | 0.207 | [-0.031, 0.446] | 0.089 | #> +-------------+--------+-----------------+-------+ #> | A.1 | 0.404 | [0.161, 0.647] | 0.001 | #> +-------------+--------+-----------------+-------+ #> | A.2 | -0.145 | [-0.420, 0.131] | 0.303 | #> +-------------+--------+-----------------+-------+ #> | A.3 | -0.318 | [-0.650, 0.013] | 0.060 | #> +-------------+--------+-----------------+-------+ #> | A.1 × A.2 | 0.234 | [-0.036, 0.505] | 0.089 | #> +-------------+--------+-----------------+-------+ #> | A.1 × A.3 | -0.018 | [-0.364, 0.328] | 0.918 | #> +-------------+--------+-----------------+-------+ #> | A.2 × A.3 | 0.247 | [-0.090, 0.584] | 0.152 | #> +-------------+--------+-----------------+-------+ #> | Num.Obs. | 50 | | | #> +-------------+--------+-----------------+-------+ fit_m3 <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m3\", int_order = 2, covariates = c(\"C\") ) print(fit_m3) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> #> Wald test #> Variance: HC0 robust (adjusted for estimation of weights) #> #> Model 1: D.3 ~ A.1 + A.2 + A.3 + A.1 + A.2 + A.3 + C + A.1:A.2 + A.1:A.3 + A.1:C + A.2:A.3 + A.2:C + A.3:C #> Model 2: D.3 ~ C #> #> Res.Df Df Chisq Pr(>Chisq) #> 1 39 #> 2 48 9 23.536 0.005098 ** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> #> The marginal model, m3, is summarized below: #> +-------------+--------+------------------+--------+ #> | | (1) | #> +-------------+--------+------------------+--------+ #> | | Est. | CI | p | #> +=============+========+==================+========+ #> | (Intercept) | 0.187 | [-0.058, 0.432] | 0.134 | #> +-------------+--------+------------------+--------+ #> | A.1 | 0.422 | [0.182, 0.662] | <0.001 | #> +-------------+--------+------------------+--------+ #> | A.2 | -0.126 | [-0.411, 0.159] | 0.387 | #> +-------------+--------+------------------+--------+ #> | A.3 | -0.353 | [-0.654, -0.053] | 0.021 | #> +-------------+--------+------------------+--------+ #> | C | -0.137 | [-0.360, 0.087] | 0.231 | #> +-------------+--------+------------------+--------+ #> | A.1 × A.2 | 0.238 | [-0.067, 0.542] | 0.126 | #> +-------------+--------+------------------+--------+ #> | A.1 × A.3 | 0.013 | [-0.352, 0.377] | 0.946 | #> +-------------+--------+------------------+--------+ #> | A.1 × C | 0.156 | [-0.102, 0.414] | 0.236 | #> +-------------+--------+------------------+--------+ #> | A.2 × A.3 | 0.281 | [-0.051, 0.614] | 0.097 | #> +-------------+--------+------------------+--------+ #> | A.2 × C | 0.199 | [-0.055, 0.454] | 0.124 | #> +-------------+--------+------------------+--------+ #> | A.3 × C | -0.080 | [-0.432, 0.271] | 0.655 | #> +-------------+--------+------------------+--------+ #> | Num.Obs. | 50 | | | #> +-------------+--------+------------------+--------+"},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":null,"dir":"Reference","previous_headings":"","what":"Initial step in devMSMs workflow — initMSM","title":"Initial step in devMSMs workflow — initMSM","text":"Initial step devMSMs workflow","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initial step in devMSMs workflow — initMSM","text":"","code":"initMSM( data, exposure, epoch = NULL, tv_conf, ti_conf = NULL, concur_conf = NULL, home_dir = NULL, sep = \"[\\\\._]\" )"},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initial step in devMSMs workflow — initMSM","text":"data data wide format : data frame, list imputed data frames, mids object mice package exposure names exposure variables \".timepoint\" suffix epoch (optional) group set exposure variables categories. Provide character vector corresponding category exposure tv_conf list time-varying confounders \".timepoint\" suffix, include exposure outcome variables (least time-varying exposure variables required ) ti_conf list time invariant confounders. Can left NULL none. concur_conf (optional) list variable names reflecting time-varying confounders retain formulas contemporaneously (default none) home_dir (optional) directory saving output. Either absolute path relative path respect getwd() sep (optional) seperator variable time period. variable names split last occurance sep second string containing time. uses regex notation, . must \\\\.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Initial step in devMSMs workflow — initMSM","text":"object class devMSM contains initialized information.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Initial step in devMSMs workflow — initMSM","text":".timepoint suffix, mean time-varying exposure variable names must end either .# _#. allows us extract time-period variable measured allow us properly create formulae (omitting future mediators)","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initial step in devMSMs workflow — initMSM","text":"","code":"data <- data.frame( A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), D.3 = rnorm(n = 50), L.1 = sample(c(0, 1), size = 50, replace = TRUE), C = rnorm(n = 50) ) obj <- initMSM( data = data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\"), ti_conf = \"C\" ) obj #> Exposure (continuous): A.1, A.2, A.3 #> Variable and their encodings: #> var type time #> A.1 exposure 1 #> A.2 exposure 2 #> A.3 exposure 3 #> B.1 tv_conf 1 #> B.2 tv_conf 2 #> B.3 tv_conf 3 #> D.3 tv_conf 3 #> C ti_conf -1"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_imp_list.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","title":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package imputing mice package reading imputed dataset. data contain economic strain (ESEATA1) continuously distributed variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_imp_list.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","text":"","code":"sim_data_imp_list"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_imp_list.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_imp_list.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","title":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package. data contain economic strain (ESEATA1) continuously distributed variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","text":"","code":"sim_data_long_miss"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","text":"long data frame 6, 458 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"WAVE\" age (months) data collected \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss_bin.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Long data with missingness (binary exposure) — sim_data_long_miss_bin.rda","title":"Long data with missingness (binary exposure) — sim_data_long_miss_bin.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package. data contain economic strain (ESEATA1) binary variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss_bin.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Long data with missingness (binary exposure) — sim_data_long_miss_bin.rda","text":"","code":"sim_data_long_miss_bin"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss_bin.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Long data with missingness (binary exposure) — sim_data_long_miss_bin.rda","text":"long data frame 6,458 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"WAVE\" age (months) data collected \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety #' @references DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_mice.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","title":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package prior imputation using mice via random forest. data contain economic strain (ESEATA1) continuously distributed variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_mice.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","text":"","code":"sim_data_mice"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_mice.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_mice.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","title":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","text":"Wide complete data (continuous exposure) data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). data contain economic strain (ESEATA1) continuously distributed variable missing data.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","text":"","code":"sim_data_wide"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_bin.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","title":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","text":"Wide complete data (binary exposure) data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). data contain economic strain (ESEATA1) binary variable, missing data.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_bin.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","text":"","code":"sim_data_wide_bin"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_bin.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_bin.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","title":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package. data contain economic strain (ESEATA1) continuously distributed variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","text":"","code":"sim_data_wide_miss"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss_bin.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","title":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package. data contain economic strain (ESEATA1) binary variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss_bin.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","text":"","code":"sim_data_wide_miss_bin"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss_bin.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss_bin.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":null,"dir":"Reference","previous_headings":"","what":"Trim IPTW balancing weights, if needed — trimWeights","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"Trims IPTW balancing weights heavy right tails populating weight values given quantile weight value quantile.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"","code":"trimWeights(weights, at = 0, lower = FALSE, verbose = FALSE, save.out = FALSE)"},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"weights list IPTW weights output createWeights() numeric; either quantile weights weights trimmed. single number .5 1, number weights trimmed (e.g., = 3 top 3 weights set 4th largest weight). lower logical; whether also trim lower quantile (e.g., = .9, trimming .1 .9, = 3, trimming top bottom 3 weights). Default FALSE trim higher weights. verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"list containing WeightIt::weightitMSM() output. length number datasets (1 data.frame number imputed datasets).","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) tw <- trimWeights(w, at = 0.975) print(tw) #> #> For the `glm` weighting method, after trimming at 97.5th quantile, the median weight value is 0.97 (SD = 0.32; range = 0.43-2). plot(tw) trimWeights(w, at = 0.975, lower = TRUE) #> #> For the `glm` weighting method, after trimming between 2.5th and 97.5th quantiles, the median weight value is 0.97 (SD = 0.32; range = 0.43-2)."}] +[{"path":"https://istallworthy.github.io/devMSMs/articles/Assessing_Balance_Tv.html","id":"calculating-raw-balance-statistics","dir":"Articles","previous_headings":"","what":"Calculating Raw Balance Statistics","title":"Assessing Balance for Time-Varying Exposures","text":"calcBalStats() assesses balance using correlations confounder exposure continuous exposures standardized mean differences confounder exposure groups binary exposures. balancing statistics created based diagnostics confounding time-varying exposures outlined Jackson (2016). specifically, user-specified exposure time point, raw balance statistics calculated quantify association exposure time point confounder, exposure history time point. accomplished using col_w_cov() function calculate covariance continuous exposures col_w_smd() function calculate mean difference binary exposures cobalt package (Greifer, 2023). Factor covariates split separate dummy variables using splitfactor() function cobalt. covariate interactions present formulas created data multiplying constituent variables, interactions including factor covariates implemented constituent dummy variables.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Assessing_Balance_Tv.html","id":"weighting-balance-statistics-by-exposure-history","dir":"Articles","previous_headings":"","what":"Weighting Balance Statistics By Exposure History","title":"Assessing Balance for Time-Varying Exposures","text":"calcBalStats() function, exposure histories comprise combinations presence absence exposure (delineated using median split continuous exposures) prior time points (note may different user-specified, substantive exposure histories used compare dose timing final model; Step 5). Subsequently, weighted mean balance statistics, weighted proportion individuals exposure history, provides raw estimate balance exposure time point confounder. occasion balancing statistics one person people given exposure history, user alerted balance statistic dropped inclusion. raw (unstandardized) balance statistics calculated without IPTW weights pre-balance checking using IPTW balancing weights (multiplied across time points) weighted analyses.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Assessing_Balance_Tv.html","id":"standardizing-balance-statistics","dir":"Articles","previous_headings":"","what":"Standardizing Balance Statistics","title":"Assessing Balance for Time-Varying Exposures","text":"purpose comparison common balance threshold, balancing statistics similarly standardized following manner. continuous exposures, raw balance statistic (covariance) divided product standard deviation unweighted confounder standard deviation exposure time point calculate correlation. Given , possible correlation may greater 1. binary exposures, raw balance statistic (mean difference) divided pooled standard deviation estimate, square root average standard deviations unweighted confounder levels exposed unexposed groups first exposure time point. standard deviations computed using unadjusted sample (recommended Stuart, 2008; 2010; Greifer, 2022) given possibility balancing changes variation confounder leads misleading standardized values. first exposure time point (histories), standardized balance statistics computed directly using cobalt functions mentioned .","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Assessing_Balance_Tv.html","id":"imputed-data","dir":"Articles","previous_headings":"","what":"Imputed Data","title":"Assessing Balance for Time-Varying Exposures","text":"imputed data supplied, process conducted imputed dataset separately. function takes average absolute values balance statistics across imputed datasets account sampling error (Pishgar et al., 2021 preprint). averaged average balance statistics compared balance threshold(s) summarize covariates balanced. Recommended specification separate balance thresholds relatively less important confounders can found Workflows vignettes. specification balance threshold(s) kept consistent throughout use devMSMs package.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Assessing_Balance_Tv.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Assessing Balance for Time-Varying Exposures","text":"Greifer, N. (2024). cobalt: Covariate Balance Tables Plots (4.4.1) [Computer software]. https://CRAN.R-project.org/package=cobalt Jackson, J. W. (2016). Diagnostics Confounding Time-varying Joint Exposures. Epidemiology, 27(6), 859. https://doi.org/10.1097/EDE.0000000000000547 Pishgar, F., Greifer, N., Leyrat, C., & Stuart, E. (2021). MatchThem: Matching andWeighting Multiple Imputation. R Journal, 13(2), 292–305. https://doi.org/10.32614/RJ-2021-073 Stuart, E. . (2008). Developing practical recommendations use propensity scores: Discussion ‘critical appraisal propensity score matching medical literature 1996 2003’ Peter Austin, Statistics Medicine. Statistics Medicine, 27(12), 2062–2065. https://doi.org/10.1002/sim.3207 Stuart, E. . (2010). Matching methods causal inference: review look forward. Statistical Science : Review Journal Institute Mathematical Statistics, 25(1), 1–21. https://doi.org/10.1214/09-STS313","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Customize_Balancing_Formulas.html","id":"core-inputs","dir":"Articles","previous_headings":"","what":"Core Inputs","title":"Customize Weights Formulas","text":"specify core inputs devMSMs functions. createFormulas() function 3 different modes: “full” (Steps 1 & 4), “short” (Step 2), “update” (Step 3), corresponding different steps Workflows vignettes, can customized mode. suggest staying consistent customization throughout use package workflow. recommend sure include measured confounders (mediators colliders) exposure time point weights formulas. Please refer accompanying manuscript details. , illustrate customization options three modes createFormuls() function using information package dataset example. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (ESETA1) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (StrDif_Tot) measured 58 months.","code":"exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\") tv_conf <- c( \"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\" ) ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\" ) data(sim_data_wide, package = \"devMSMs\") obj <- devMSMs::initMSM( data = sim_data_wide, exposure = exposure, tv_conf = tv_conf, ti_conf = ti_conf )"},{"path":"https://istallworthy.github.io/devMSMs/articles/Customize_Balancing_Formulas.html","id":"customize-full-weights-formulas-steps-1-4","dir":"Articles","previous_headings":"","what":"Customize Full Weights Formulas (Steps 1 & 4)","title":"Customize Weights Formulas","text":"default use createFormulas() type = “full” creates weights formulas exposure time point. formula contains time invariant confounders well time-varying confounders measured time points prior exposure time point. example, 24-month weights formula, time-varying confounders 6 15 months. However, users wish also include time-varying confounders measured contemporaneously exposure time point (e.g., also include 24-month time-varying confounders 24-month weights formula), can specify time-varying confounders optional argument initMSM(), concur_conf. example, include 24-month maternal depression 24-month weights formula, following: first specify confounders retain contemporaneously creating MSM object. Now B18Raw.24 included 24-month weights formula addition 35-58-month formulas.","code":"obj <- devMSMs::initMSM( data = sim_data_wide, exposure = exposure, tv_conf = tv_conf, ti_conf = ti_conf, concur_conf = \"B18Raw.24\" ) full_formulas <- createFormulas(obj = obj, type = \"full\") print(full_formulas) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 6, the full formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 15, the full formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 24, the full formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + WndNbrhood.6 + IBRAttn.6 + IBRAttn.15 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + InRatioCor.6 + InRatioCor.15 + CORTB.6 + CORTB.15 + ESETA1.6 + ESETA1.15 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 35, the full formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + WndNbrhood.6 + WndNbrhood.24 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.6 + ESETA1.15 + ESETA1.24 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 58, the full formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + RHasSO.35 + WndNbrhood.6 + WndNbrhood.24 + WndNbrhood.35 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + HOMEETA1.35 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + InRatioCor.35 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + EARS_TJo.35 + LESMnPos.24 + LESMnPos.35 + LESMnNeg.24 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.6 + ESETA1.15 + ESETA1.24 + ESETA1.35"},{"path":"https://istallworthy.github.io/devMSMs/articles/Customize_Balancing_Formulas.html","id":"time-varying-confounders-measured-contemporaneously-with-exposure-time-point","dir":"Articles","previous_headings":"","what":"Time-Varying Confounders Measured Contemporaneously With Exposure Time Point","title":"Customize Weights Formulas","text":"However, users wish also include time-varying confounders measured contemporaneously exposure time point (e.g., also include 24-month time-varying confounders 24-month weights formula), can specify time-varying confounders optional argument initMSM(), concur_conf. example, include 24-month maternal depression 24-month weights formula, following: first specify confounders retain contemporaneously creating MSM object. Now B18Raw.24 included 24-month weights formula addition 35-58-month formulas.","code":"obj <- devMSMs::initMSM( data = sim_data_wide, exposure = exposure, tv_conf = tv_conf, ti_conf = ti_conf, concur_conf = \"B18Raw.24\" ) full_formulas <- createFormulas(obj = obj, type = \"full\") print(full_formulas) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 6, the full formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 15, the full formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 24, the full formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + WndNbrhood.6 + IBRAttn.6 + IBRAttn.15 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + InRatioCor.6 + InRatioCor.15 + CORTB.6 + CORTB.15 + ESETA1.6 + ESETA1.15 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 35, the full formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + WndNbrhood.6 + WndNbrhood.24 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.6 + ESETA1.15 + ESETA1.24 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 58, the full formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + RHasSO.35 + WndNbrhood.6 + WndNbrhood.24 + WndNbrhood.35 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + HOMEETA1.35 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + InRatioCor.35 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + EARS_TJo.35 + LESMnPos.24 + LESMnPos.35 + LESMnNeg.24 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.6 + ESETA1.15 + ESETA1.24 + ESETA1.35"},{"path":"https://istallworthy.github.io/devMSMs/articles/Customize_Balancing_Formulas.html","id":"fully-custom-formulas","dir":"Articles","previous_headings":"","what":"Fully Custom Formulas","title":"Customize Weights Formulas","text":"Alternatively, user completely customize full formulas manually creating formulas exposure time point using optional custom argument. create custom formulas, user creates list entry exposure time point, contains weights formula exposure time point. createFormulas() conduct checks ensure formula time point provides cautionary warnings unusual variables (e.g., measured exposure time point). However, user responsible ensuring validity formulas. note, user creates custom “full” formula, also create custom formulas using createFormulas() make “short” “updated” formulas. , illustrate abridged example specifying custom arguments exposure, ESETA1, 6-, 15-, 24-, 35-, 58-month time points. customFormulas() checks retains formulas use package.","code":"custom <- list( ESETA1.6 ~ BioDadInHH2 + DrnkFreq + gov_assist, ESETA1.15 ~ BioDadInHH2 + DrnkFreq + gov_assist, ESETA1.24 ~ BioDadInHH2 + DrnkFreq + gov_assist, ESETA1.35 ~ BioDadInHH2 + DrnkFreq + gov_assist, ESETA1.58 ~ BioDadInHH2 + DrnkFreq + gov_assist ) full_formulas <- createFormulas(obj = obj, custom = custom) print(full_formulas) #> USER ALERT: Please manually inspect the slightly cleaned custom formula below: #> At time point 6, the custom formula for ESETA1.6 is: #> ESETA1.6 ~ BioDadInHH2 + DrnkFreq + gov_assist #> USER ALERT: Please manually inspect the slightly cleaned custom formula below: #> At time point 15, the custom formula for ESETA1.15 is: #> ESETA1.15 ~ BioDadInHH2 + DrnkFreq + gov_assist #> USER ALERT: Please manually inspect the slightly cleaned custom formula below: #> At time point 24, the custom formula for ESETA1.24 is: #> ESETA1.24 ~ BioDadInHH2 + DrnkFreq + gov_assist #> USER ALERT: Please manually inspect the slightly cleaned custom formula below: #> At time point 35, the custom formula for ESETA1.35 is: #> ESETA1.35 ~ BioDadInHH2 + DrnkFreq + gov_assist #> USER ALERT: Please manually inspect the slightly cleaned custom formula below: #> At time point 58, the custom formula for ESETA1.58 is: #> ESETA1.58 ~ BioDadInHH2 + DrnkFreq + gov_assist"},{"path":"https://istallworthy.github.io/devMSMs/articles/Customize_Balancing_Formulas.html","id":"customize-short-weights-formulas-step-2","dir":"Articles","previous_headings":"","what":"Customize Short Weights Formulas (Step 2)","title":"Customize Weights Formulas","text":"default use createFormulas() type = “short” creates shortened weights formulas exposure time point. formula contains time invariant confounders well time-varying confounders measured time point directly prior (t-1 lag) exposure time point. example, 24-month weights formula, include time-varying confounders 15 months. Please see Workflows vignettes accompanying manuscript detail. creating short formulas, user can specify optional concur_conf custom arguments detailed . note, createFormulas() check formulas custom field meet criteria shortened formula, thus user responsible ensuring validity formulas. creating short formulas, user can also specify optional keep_conf argument. Users specify second argument time-varying confounders always retain formulas, lagged form, overriding t-1 lag default. Users may wish use argument time-varying confounders highly consistent time strong reasons include initial phase selecting optimal weighting method (see Workflows vignettes details). Note unless variables also specified concuf_conf, retained lagged form. example, always retain income formulas lagged form, overriding t-1 lag default via keep_conf. shown , createFormulas function now retains income 6 months 15-, 24-, 35-, 58-month formulas, overriding t-1 lag rule variable. Without specification, income 6 months omitted formulas exposure 24, 35, 58 months.","code":"short_formulas <- createFormulas(obj = obj, type = \"short\", keep_conf = c(\"InRatioCor.6\")) print(short_formulas) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 6, the short formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 15, the short formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 24, the short formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + B18Raw.24 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 + InRatioCor.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 35, the short formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 + InRatioCor.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 58, the short formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 + InRatioCor.6"},{"path":"https://istallworthy.github.io/devMSMs/articles/Customize_Balancing_Formulas.html","id":"customize-updated-weights-formulas-step-3","dir":"Articles","previous_headings":"","what":"Customize Updated Weights Formulas (Step 3)","title":"Customize Weights Formulas","text":"default use createFormulas() type = “update” creates updated weights formulas exposure time point. formula contains time invariant confounders; time-varying confounders measured time point directly prior (t-1 lag) exposure time point; well time-varying confounders greater lags successfully balanced using short weights formulas. creating updated formulas, user can specify optional concur_conf, keep_conf, custom arguments detailed . note, createFormulas() check formulas custom field meet criteria updated formula identify imbalanced confounders, user responsible ensuring validity formulas.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"data-requirements","dir":"Articles","previous_headings":"","what":"Data Requirements","title":"Data Requirements & Preparation","text":"recommend considering several data requirements prior using devMSMs vignettes. MSMs useful strengthening causal inference using longitudinal data include exposure confounders vary time prior outcome. minimum, devMSMs requires two time point data exposure measured least outcome measured second time point, least one confounder. exposure can binary (integer class) continuous (numeric class), assumptions distributions outcome confounders. highly recommend using continuous variables appropriate possible avoid information loss inherent binarizing continuous variable. Although gold standard recommendation, suggest users select exposures within-person variation reasonable delineate different histories “high” “low” levels avoid extrapolation. outcome time point must last time point exposure measured time point last exposure measurement time point. cases outcome variable constitutes growth process final time point, advise choosing reasonable measure balancing purposes (e.g., baseline average levels) subsequently using generated weights separately conduct weighted growth model outcome. advise user specify include dataset time invariant time-varying variables possibly confound relation exposure outcome. also suggest using multiple measured variables within construct help reduce effects measurement bias (Kainz et al., 2017). Time varying confounders ideal maximizing power MSMs. Time-varying confounders include developmental indicators tend track exposure time also cause outcome, including past levels exposure. note, time points confounders collected must equal , subset , time points exposure outcome collected data. perfect world, exposures potential confounders measured time points prior outcome. However, real-world data due planned unplanned missingness, often case. Users consider discussing implications limitations conferred variables confounders collected time points. basis specifying confounders, users turn literature delineate causal model lays hypothesized relations confounders, exposures, outcome. advise users implement appropriate preliminary steps, goal assigning ‘data’ one following wide data formats (see Figure 1) use package: single data frame data wide format missing data mids object (output mice::mice()) data imputed wide format list data imputed wide format data frames. shown Figure 1, use devMSMs package, data 3 formats, must wide contain “ID” column subject identifier exposure, outcome, confounders separate columns (shown Figure 1). Column names can include underscore special characters time-varying variables suffix consists period followed time point (e.g., “variable.6”). variables classed integer, numeric, factor (character). Auxiliary nuisance covariates confounders (e.g, assessment version) can included dataset use specification final modeling step (Workflow vignettes Step 5). Abridged example structure wide dataset formatted required devMSMs. Column denotes ID variable, column B (green) denotes time -variant confounder (e.g., race, birth information), columns C - F denote two time-varying confounders (lighter yellow) two different time points (e.g., age.1, age.2 income.1, income.2, .1 represents wave 1 .2 represents wave 2). Columns G - denote exposure outcome interest (darker yellow), G H time-varying values exposure, column outcome value final wave/timepoint. Missing data denoted NA need imputed (Step P2).","code":"#> id ti_X tv_Y1.1 tv_Y1.2 tv_Y2.1 tv_Y2.2 exposure.1 exposure.2 outcome.2 #> 1 1 0.5 50 65 NA 0.04 3 4 80 #> 2 2 NA 33 57 0.08 0.03 5 3 68 #> 3 3 0.3 68 NA 0.01 0.02 6 8 59"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"loading-packages","dir":"Articles","previous_headings":"","what":"Loading packages","title":"Data Requirements & Preparation","text":"","code":"options(repos = c(CRAN = \"https://cloud.r-project.org/\")) install.packages(\"devtools\") require(devtools, quietly = TRUE) require(tinytable, quietly = TRUE) devtools::install_github(\"istallworthy/devMSMs\", quiet = TRUE) devtools::install_github(\"istallworthy/devMSMsHelpers\", quiet = TRUE) library(devMSMsHelpers)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"exploring-devmsms-package-data","dir":"Articles","previous_headings":"","what":"Exploring devMSMs Package Data","title":"Data Requirements & Preparation","text":"following longitudinal data accompany devMSMs simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (ESETA1) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (StrDif_Tot) measured 58 months. devMSMs (see Workflows vignettes) requires complete data wide format (.e., one row per individual, “ID” column identifiers), one three ways: single data frame missing data; imputed data form mids object (output mice::mice()); imputed data list imputed data frames. helper functions (summarized Table 1) following recommended preliminary steps can found Github. note, devMSMs must also installed loaded use helper functions (see Installation). first install devMSMs devMSMsHelpers packages. Preliminary steps P1 (formulate hypotheses) P2 (create DAG) detailed accompanying manuscript. following recommended preliminary steps designed assist user preparing inspecting data ensure appropriate use package.","code":"data(\"sim_data_wide\", package = \"devMSMs\") head(sim_data_wide, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 require(\"mice\", quietly = TRUE) #> #> Attaching package: 'mice' #> The following object is masked from 'package:stats': #> #> filter #> The following objects are masked from 'package:base': #> #> cbind, rbind data(\"sim_data_mice\", package = \"devMSMs\") class(sim_data_mice) #> [1] \"mids\" head(mice::complete(sim_data_mice, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 7 16 1 3 #> 2 2 4 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.149 0.831 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 data(\"sim_data_imp_list\", package = \"devMSMs\") head(sim_data_imp_list[[1]], n = c(5, 10)) #> X ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 1 3 1 1 7 16 1 3 #> 2 2 2 4 -7 7 0 0 0 #> 3 3 3 6 5 20 -1 0 3 #> 4 4 4 24 25 17 11 0 3 #> 5 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 #> 1 -0.227 -0.652 #> 2 0.149 0.831 #> 3 1.145 0.033 #> 4 0.301 -0.501 #> 5 -0.247 0.084 #> [1] \"\" install.packages(\"devtools\") require(devtools, quietly = TRUE) devtools::install_github(\"istallworthy/devMSMs\", quiet = TRUE) devtools::install_github(\"istallworthy/devMSMsHelpers\", quiet = TRUE) library(devMSMs) library(devMSMsHelpers)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p3--specify-core-inputs","dir":"Articles","previous_headings":"","what":"P3. Specify Core Inputs","title":"Data Requirements & Preparation","text":"Please see Specifying Core Inputs vignette detail following core inputs. , use ESETA1, measure economic strain experienced family, exposure StrDif_Tot, behavior problems measured SDQ, outcome.","code":"set.seed(1234) exposure = c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\") ti_conf = c(\"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf = c(\"SAAmylase.6\",\"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\",\"RHasSO.35\", \"WndNbrhood.6\",\"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\") # home_dir = NA outcome <- \"StrDif_Tot.58\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-data-preparation-inspection","dir":"Articles","previous_headings":"","what":"P4 Data Preparation & Inspection","title":"Data Requirements & Preparation","text":"helper functions optional arguments suppress saving output locally (save.= FALSE) printing console ( verbose = FALSE). defaults arguments TRUE. Users must supply path home directory save.= TRUE. shown Figure 2, users several options reading data. can begin workflow following options: (P4.1) long data: complete missingness can formatted converted wide data (P4.3) imputed needed (P4.2) wide data: complete missingness can formatted (P4.3) imputed needed (P4.3) data already imputed wide format can read list Figure 2. Schematic recommended preliminary steps showing transformation 3 different kinds starting data (enumerated bold) three kinds data accepted devMSMs. Users beginning single data frame long format (without missingness) can utilize helper function formatLongData() summarize exposure outcome data convert required variable names. First, load simulated longitudinal data long format (missingness) accompanies devMSMs. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (ESETA1) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (StrDif_Tot) measured 58 months. long data correctly formatted, formatLongData() allows users supply existing variables time (time_var), ID (id_var), missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. sep field allows specify delimeter integer indicates time point variable names. , format simulated long FLP data. get descriptive statistics summary exposure, ESETA1, outcome, StrDif_Tot.58, visual inspections. Users correctly formatted data long format option using following code transform data wide format, proceed using package (missing data) imputing (< 20% missing data MAR). transform newly formatted long data wide format, specifying idvar “ID”, timevar “WAVE”, supplying time points (encompassing exposure, confounder, outcome time points) data 6, 15, 24, 35, 58 times. Alternatively, users start single data frame wide data (without missingness). , load single complete, wide data frame simulated FLP example. Data missingness common human data. read simulated wide FLP data missingness. Users beginning single unformatted data frame long format can utilize helper function formatWideData() summarize exposure outcome data convert required variable names. formatWideData() allows users supply existing variables ID (id_var) missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. user can also specify time point delimeter (sep). , format simulated wide FLP data listing variables make factors integers wide format (e.g., “variable.t”), well ID missingness indicators. functions devMSMs package accept data form single data frame missing values m imputed datasets form either mids object (output mice package via imputeData()) list imputed datasets. developmental data humans amount missing data. Given creation IPTW balancing weights requires complete data, recommend imputing data. Imputation assumes missing data mechanism missing random (MAR) 20% missing data total (Leyrat et al., 2021). Given existing work demonstrating superiority, devMSMS implements ‘within’ approach imputed data, conducting steps imputed dataset pooling estimates using Rubin’s rules create final average predictions contrast comparisons Worfklows vignettes Step 5 (Leyrat et al, 2021; Granger et al., 2019). shown , users can use helper function impute wide data impute elsewhere read imputed data list use devMSMs. Users option using helper imputeData() function impute correctly formatted wide data. step can take run. user can specify many imputed datasets create (default m = 5). imputeData() draws mice() function mice package (van Buuren & Oudshoorn, 2011) conduct multiple imputation chained equations (mice). variables present dataset used impute missing data column. user can specify imputation method method field drawing following list: “pmm” (predictive mean matching), “midastouch” (weighted predictive mean matching), “sample” (random sample observed values), “rf” (random forest) “cart” (classification regression trees). Random forest imputation default given evidence efficiency superior performance (Shah et al., 2014). Please review mice documentation details. Additionally, users can specify integer value seed order offset random number generator mice() make reproducible imputations. parameter read_imps_from_file allow read already imputed data local storage (TRUE) re-run imputation code multiple times (FALSE; default). Users may use parameter supply mids object imputed data mice package (title ‘all_imp.rds’). sure inspect console warnings well resulting imputed datasets. variables missing data following imputation may need removed due high collinearity /low variability. required inputs function data frame wide format (formatted according pre-requirements listed ), m number imputed datasets create, path home directory (save.= TRUE), exposure (e.g., “variable”), outcome (e.g., “variable.t”). home directory path, exposure, outcome already defined user completed Specifying Core Inputs vignette. optional inputs follows. user can specify imputation method compatible mice() (see ). Additionally, user can specify maxit number interactions mice::mice() conduct (default 5). user can also specify para_proc, logical indicator indicating whether speed imputing using parallel processing (default = TRUE). draws 2 cores using functions parallel, doRNG, doParallel packages. user may also specify additional inputs accepted mice::mice() advise consulting [mice documentation] information. user can also indicate already created imputed datasets function wish read (read_imps_from_file = TRUE rather recreate (default). example, create 2 imputed datasets using default random forest method 0 iterations (just illustrative purposes), set seed reproducibility, assign output data use devMSMs. code takes time run. (Note: given challenges imputing data .rda files, set m = 2 maxit = 0 just illustrative purposes. recommend setting m = 5 maxit = 5 (mice default) running data.) inspect output console warnings mice(). mice object can now assigned data use deveMSMs package (see Workflows vignettes). Alternatively, user imputed datasets already created wide, formatted data using program mice, can read , list, files saved locally .csv files single folder. list can assigned data use deveMSMs package (see Workflows vignettes). , load list imputed data simulated FLP, example. (See example Rmarkdown file code files saved locally.)","code":"save.out <- FALSE verbose <- TRUE data(\"sim_data_long_miss\", package = \"devMSMs\") data_long <- sim_data_long_miss head(data_long, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr RMomAgeU #> 1 1 0 1 27.245 0 0 1 15 24 29 #> 2 1 0 1 27.245 0 0 1 15 24 29 #> 3 1 0 1 27.245 0 0 1 15 24 29 #> 4 1 0 1 27.245 0 0 1 15 24 29 #> 5 1 0 1 27.245 0 0 1 15 24 29 factor_confounders <- c(\"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO\") integer_confounders <- c(\"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw\", \"EARS_TJo\", \"MDI\") data_long_f <- formatLongData( data = data_long, exposure = exposure, outcome = outcome, sep = \"\\\\.\", time_var = \"WAVE\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> Table: Summary of ESETA1 Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |15 | 0.2983433| 0.9261390| -2.699| 3.474| #> |24 | 0.1585387| 0.9575181| -2.858| 3.284| #> |35 | 0.1388395| 0.9475905| -3.046| 3.014| #> |58 | 0.0996006| 0.9924516| -2.478| 3.173| #> |6 | 0.3337979| 0.9298080| -2.809| 4.035| #> #> Table: Summary of StrDif_Tot Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |35 | 0.6009797| 0.2830620| -0.230| 1.536| #> |58 | 0.5029778| 0.2931918| -0.281| 1.448| #> Warning in formatLongData(data = data_long, exposure = exposure, outcome = #> outcome, : The following variables are characters. Please change them to #> integers and re-run: WAVE head(data_long_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr RMomAgeU #> 1 1 0 1 27.245 0 0 1 15 24 29 #> 2 1 0 1 27.245 0 0 1 15 24 29 #> 3 1 0 1 27.245 0 0 1 15 24 29 #> 4 1 0 1 27.245 0 0 1 15 24 29 #> 5 1 0 1 27.245 0 0 1 15 24 29 require(\"stats\", quietly = TRUE) sep <- \"\\\\.\" v <- sapply(strsplit(tv_conf[!grepl(\"\\\\:\", tv_conf)], sep), head, 1) v <- c(v[!duplicated(v)], sapply(strsplit(exposure[1], sep), head, 1)) data_wide_f <- stats::reshape( data = data_long_f, idvar = \"ID\", v.names = v, timevar = \"WAVE\", times = c(6, 15, 24, 35, 58), direction = \"wide\" ) data_wide_f <- data_wide_f[, colSums(is.na(data_wide_f)) < nrow(data_wide_f)] head(data_wide_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr #> 1 1 0 1 27.245 0 0 1 15 24 #> 6 10 1 0 16.014 0 1 0 13 18 #> 11 100 1 0 31.042 1 1 1 14 15 #> 16 1000 1 0 23.597 1 1 1 10 14 #> 21 1001 1 0 25.592 1 1 1 13 23 #> RMomAgeU #> 1 29 #> 6 30 #> 11 25 #> 16 31 #> 21 27 data(\"sim_data_wide\", package = \"devMSMs\") data_wide <- sim_data_wide head(data_wide, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 data(\"sim_data_wide_miss\", package = \"devMSMs\") data_wide <- sim_data_wide_miss head(data_wide, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 factor_confounders <- c( \"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\" ) integer_confounders <- c( \"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"MDI.6\", \"MDI.15\" ) data_wide_f <- formatWideData( data = data_wide, exposure = exposure, outcome = outcome, sep = \"\\\\.\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:---------------|:---------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.2410 |Min. :-2.4780 | #> | |1st Qu.:-0.3058 |1st Qu.:-0.3495 |1st Qu.:-0.4510 |1st Qu.:-0.5220 |1st Qu.:-0.4968 | #> | |Median : 0.3735 |Median : 0.2745 |Median : 0.1635 |Median : 0.1140 |Median : 0.1275 | #> | |Mean : 0.3405 |Mean : 0.2664 |Mean : 0.1591 |Mean : 0.1229 |Mean : 0.1159 | #> | |3rd Qu.: 0.9617 |3rd Qu.: 0.9217 |3rd Qu.: 0.8015 |3rd Qu.: 0.7750 |3rd Qu.: 0.7515 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.0140 |Max. : 3.1730 | #> | |NA's :258 |NA's :258 |NA's :258 |NA's :258 |NA's :258 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| NA.s| #> |------:|--------:|------:|---------:|--------:|-----:|----:| #> | -0.497| 0.29825| 0.488| 0.4989333| 0.7055| 1.448| 258| head(data_wide_f, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 s <- 1234 m <- 2 method <- \"rf\" maxit <- 0 imputed_data <- imputeData( data = data_wide_f, exposure = exposure, outcome = outcome, sep = \"\\\\.\", m = m, method = method, maxit = maxit, para_proc = FALSE, seed = s, read_imps_from_file = FALSE, home_dir = home_dir, save.out = save.out ) #> Creating 2 imputed datasets using the rf imputation method in mice::mice(). This may take some time to run. #> #> #> USER ALERT: Please view any logged events from the imputation below: #> Table: Logged Events from mice::mice head(mice::complete(imputed_data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 0 -4 1 3 #> 2 2 5 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 1 3 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.654 0.397 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 data <- imputed_data data(\"sim_data_imp_list\", package = \"devMSMs\") data <- sim_data_imp_list head(data[[1]], n = c(5, 10)) #> X ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 1 3 1 1 7 16 1 3 #> 2 2 2 4 -7 7 0 0 0 #> 3 3 3 6 5 20 -1 0 3 #> 4 4 4 24 25 17 11 0 3 #> 5 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 #> 1 -0.227 -0.652 #> 2 0.149 0.831 #> 3 1.145 0.033 #> 4 0.301 -0.501 #> 5 -0.247 0.084"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-1--single-long-data-frame","dir":"Articles","previous_headings":"","what":"P4.1. Single Long Data Frame","title":"Data Requirements & Preparation","text":"Users beginning single data frame long format (without missingness) can utilize helper function formatLongData() summarize exposure outcome data convert required variable names. First, load simulated longitudinal data long format (missingness) accompanies devMSMs. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (ESETA1) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (StrDif_Tot) measured 58 months. long data correctly formatted, formatLongData() allows users supply existing variables time (time_var), ID (id_var), missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. sep field allows specify delimeter integer indicates time point variable names. , format simulated long FLP data. get descriptive statistics summary exposure, ESETA1, outcome, StrDif_Tot.58, visual inspections. Users correctly formatted data long format option using following code transform data wide format, proceed using package (missing data) imputing (< 20% missing data MAR). transform newly formatted long data wide format, specifying idvar “ID”, timevar “WAVE”, supplying time points (encompassing exposure, confounder, outcome time points) data 6, 15, 24, 35, 58 times.","code":"data(\"sim_data_long_miss\", package = \"devMSMs\") data_long <- sim_data_long_miss head(data_long, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr RMomAgeU #> 1 1 0 1 27.245 0 0 1 15 24 29 #> 2 1 0 1 27.245 0 0 1 15 24 29 #> 3 1 0 1 27.245 0 0 1 15 24 29 #> 4 1 0 1 27.245 0 0 1 15 24 29 #> 5 1 0 1 27.245 0 0 1 15 24 29 factor_confounders <- c(\"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO\") integer_confounders <- c(\"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw\", \"EARS_TJo\", \"MDI\") data_long_f <- formatLongData( data = data_long, exposure = exposure, outcome = outcome, sep = \"\\\\.\", time_var = \"WAVE\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> Table: Summary of ESETA1 Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |15 | 0.2983433| 0.9261390| -2.699| 3.474| #> |24 | 0.1585387| 0.9575181| -2.858| 3.284| #> |35 | 0.1388395| 0.9475905| -3.046| 3.014| #> |58 | 0.0996006| 0.9924516| -2.478| 3.173| #> |6 | 0.3337979| 0.9298080| -2.809| 4.035| #> #> Table: Summary of StrDif_Tot Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |35 | 0.6009797| 0.2830620| -0.230| 1.536| #> |58 | 0.5029778| 0.2931918| -0.281| 1.448| #> Warning in formatLongData(data = data_long, exposure = exposure, outcome = #> outcome, : The following variables are characters. Please change them to #> integers and re-run: WAVE head(data_long_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr RMomAgeU #> 1 1 0 1 27.245 0 0 1 15 24 29 #> 2 1 0 1 27.245 0 0 1 15 24 29 #> 3 1 0 1 27.245 0 0 1 15 24 29 #> 4 1 0 1 27.245 0 0 1 15 24 29 #> 5 1 0 1 27.245 0 0 1 15 24 29 require(\"stats\", quietly = TRUE) sep <- \"\\\\.\" v <- sapply(strsplit(tv_conf[!grepl(\"\\\\:\", tv_conf)], sep), head, 1) v <- c(v[!duplicated(v)], sapply(strsplit(exposure[1], sep), head, 1)) data_wide_f <- stats::reshape( data = data_long_f, idvar = \"ID\", v.names = v, timevar = \"WAVE\", times = c(6, 15, 24, 35, 58), direction = \"wide\" ) data_wide_f <- data_wide_f[, colSums(is.na(data_wide_f)) < nrow(data_wide_f)] head(data_wide_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr #> 1 1 0 1 27.245 0 0 1 15 24 #> 6 10 1 0 16.014 0 1 0 13 18 #> 11 100 1 0 31.042 1 1 1 14 15 #> 16 1000 1 0 23.597 1 1 1 10 14 #> 21 1001 1 0 25.592 1 1 1 13 23 #> RMomAgeU #> 1 29 #> 6 30 #> 11 25 #> 16 31 #> 21 27"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-1a--format-long-data","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.1a. Format Long Data","title":"Data Requirements & Preparation","text":"long data correctly formatted, formatLongData() allows users supply existing variables time (time_var), ID (id_var), missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. sep field allows specify delimeter integer indicates time point variable names. , format simulated long FLP data. get descriptive statistics summary exposure, ESETA1, outcome, StrDif_Tot.58, visual inspections.","code":"factor_confounders <- c(\"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO\") integer_confounders <- c(\"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw\", \"EARS_TJo\", \"MDI\") data_long_f <- formatLongData( data = data_long, exposure = exposure, outcome = outcome, sep = \"\\\\.\", time_var = \"WAVE\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> Table: Summary of ESETA1 Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |15 | 0.2983433| 0.9261390| -2.699| 3.474| #> |24 | 0.1585387| 0.9575181| -2.858| 3.284| #> |35 | 0.1388395| 0.9475905| -3.046| 3.014| #> |58 | 0.0996006| 0.9924516| -2.478| 3.173| #> |6 | 0.3337979| 0.9298080| -2.809| 4.035| #> #> Table: Summary of StrDif_Tot Information #> #> |WAVE | mean| sd| min| max| #> |:----|---------:|---------:|------:|-----:| #> |35 | 0.6009797| 0.2830620| -0.230| 1.536| #> |58 | 0.5029778| 0.2931918| -0.281| 1.448| #> Warning in formatLongData(data = data_long, exposure = exposure, outcome = #> outcome, : The following variables are characters. Please change them to #> integers and re-run: WAVE head(data_long_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr RMomAgeU #> 1 1 0 1 27.245 0 0 1 15 24 29 #> 2 1 0 1 27.245 0 0 1 15 24 29 #> 3 1 0 1 27.245 0 0 1 15 24 29 #> 4 1 0 1 27.245 0 0 1 15 24 29 #> 5 1 0 1 27.245 0 0 1 15 24 29"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-1b--tranform-formatted-long-data-to-wide","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.1b. Tranform Formatted Long Data to Wide","title":"Data Requirements & Preparation","text":"Users correctly formatted data long format option using following code transform data wide format, proceed using package (missing data) imputing (< 20% missing data MAR). transform newly formatted long data wide format, specifying idvar “ID”, timevar “WAVE”, supplying time points (encompassing exposure, confounder, outcome time points) data 6, 15, 24, 35, 58 times.","code":"require(\"stats\", quietly = TRUE) sep <- \"\\\\.\" v <- sapply(strsplit(tv_conf[!grepl(\"\\\\:\", tv_conf)], sep), head, 1) v <- c(v[!duplicated(v)], sapply(strsplit(exposure[1], sep), head, 1)) data_wide_f <- stats::reshape( data = data_long_f, idvar = \"ID\", v.names = v, timevar = \"WAVE\", times = c(6, 15, 24, 35, 58), direction = \"wide\" ) data_wide_f <- data_wide_f[, colSums(is.na(data_wide_f)) < nrow(data_wide_f)] head(data_wide_f, n = c(5, 10)) #> ID state BioDadInHH2 PmAge2 PmBlac2 TcBlac2 PmMrSt2 PmEd2 KFASTScr #> 1 1 0 1 27.245 0 0 1 15 24 #> 6 10 1 0 16.014 0 1 0 13 18 #> 11 100 1 0 31.042 1 1 1 14 15 #> 16 1000 1 0 23.597 1 1 1 10 14 #> 21 1001 1 0 25.592 1 1 1 13 23 #> RMomAgeU #> 1 29 #> 6 30 #> 11 25 #> 16 31 #> 21 27"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-2--single-wide-data-frame","dir":"Articles","previous_headings":"","what":"P4.2. Single Wide Data Frame","title":"Data Requirements & Preparation","text":"Alternatively, users start single data frame wide data (without missingness). , load single complete, wide data frame simulated FLP example. Data missingness common human data. read simulated wide FLP data missingness. Users beginning single unformatted data frame long format can utilize helper function formatWideData() summarize exposure outcome data convert required variable names. formatWideData() allows users supply existing variables ID (id_var) missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. user can also specify time point delimeter (sep). , format simulated wide FLP data listing variables make factors integers wide format (e.g., “variable.t”), well ID missingness indicators.","code":"data(\"sim_data_wide\", package = \"devMSMs\") data_wide <- sim_data_wide head(data_wide, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 data(\"sim_data_wide_miss\", package = \"devMSMs\") data_wide <- sim_data_wide_miss head(data_wide, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153 factor_confounders <- c( \"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\" ) integer_confounders <- c( \"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"MDI.6\", \"MDI.15\" ) data_wide_f <- formatWideData( data = data_wide, exposure = exposure, outcome = outcome, sep = \"\\\\.\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:---------------|:---------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.2410 |Min. :-2.4780 | #> | |1st Qu.:-0.3058 |1st Qu.:-0.3495 |1st Qu.:-0.4510 |1st Qu.:-0.5220 |1st Qu.:-0.4968 | #> | |Median : 0.3735 |Median : 0.2745 |Median : 0.1635 |Median : 0.1140 |Median : 0.1275 | #> | |Mean : 0.3405 |Mean : 0.2664 |Mean : 0.1591 |Mean : 0.1229 |Mean : 0.1159 | #> | |3rd Qu.: 0.9617 |3rd Qu.: 0.9217 |3rd Qu.: 0.8015 |3rd Qu.: 0.7750 |3rd Qu.: 0.7515 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.0140 |Max. : 3.1730 | #> | |NA's :258 |NA's :258 |NA's :258 |NA's :258 |NA's :258 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| NA.s| #> |------:|--------:|------:|---------:|--------:|-----:|----:| #> | -0.497| 0.29825| 0.488| 0.4989333| 0.7055| 1.448| 258| head(data_wide_f, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-2a--format-wide-data","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.2a. Format Wide Data","title":"Data Requirements & Preparation","text":"Users beginning single unformatted data frame long format can utilize helper function formatWideData() summarize exposure outcome data convert required variable names. formatWideData() allows users supply existing variables ID (id_var) missing data (missing) re-naming according required package. also allows user submit variables factors integers, function classes factor confounders (factor_confounders) factors, integer confounders (integer_confounders) integers data, others numeric. user can also specify time point delimeter (sep). , format simulated wide FLP data listing variables make factors integers wide format (e.g., “variable.t”), well ID missingness indicators.","code":"factor_confounders <- c( \"state\", \"TcBlac2\", \"BioDadInHH2\", \"HomeOwnd\", \"PmBlac2\", \"PmMrSt2\", \"SurpPreg\", \"RHealth\", \"SmokTotl\", \"DrnkFreq\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\" ) integer_confounders <- c( \"KFASTScr\", \"PmEd2\", \"RMomAgeU\", \"SWghtLB\", \"peri_health\", \"caregiv_health\", \"gov_assist\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"MDI.6\", \"MDI.15\" ) data_wide_f <- formatWideData( data = data_wide, exposure = exposure, outcome = outcome, sep = \"\\\\.\", id_var = \"ID\", missing = NA, factor_confounders = factor_confounders, integer_confounders = integer_confounders, home_dir = home_dir, save.out = save.out ) #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:---------------|:---------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.2410 |Min. :-2.4780 | #> | |1st Qu.:-0.3058 |1st Qu.:-0.3495 |1st Qu.:-0.4510 |1st Qu.:-0.5220 |1st Qu.:-0.4968 | #> | |Median : 0.3735 |Median : 0.2745 |Median : 0.1635 |Median : 0.1140 |Median : 0.1275 | #> | |Mean : 0.3405 |Mean : 0.2664 |Mean : 0.1591 |Mean : 0.1229 |Mean : 0.1159 | #> | |3rd Qu.: 0.9617 |3rd Qu.: 0.9217 |3rd Qu.: 0.8015 |3rd Qu.: 0.7750 |3rd Qu.: 0.7515 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.0140 |Max. : 3.1730 | #> | |NA's :258 |NA's :258 |NA's :258 |NA's :258 |NA's :258 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| NA.s| #> |------:|--------:|------:|---------:|--------:|-----:|----:| #> | -0.497| 0.29825| 0.488| 0.4989333| 0.7055| 1.448| 258| head(data_wide_f, n = c(5, 10)) #> ID state TcBlac2 BioDadInHH2 HomeOwnd KFASTScr PmBlac2 PmEd2 PmMrSt2 PmAge2 #> 1 1 0 0 1 1 24 0 15 1 27.245 #> 2 2 1 1 0 2 27 1 17 0 32.292 #> 3 3 0 0 0 3 15 1 13 1 25.588 #> 4 4 1 0 0 2 17 0 14 0 22.664 #> 5 5 0 0 1 1 25 0 20 1 41.153"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-3--formatted-wide-data-with-missingness","dir":"Articles","previous_headings":"","what":"P4.3. Formatted Wide Data with Missingness","title":"Data Requirements & Preparation","text":"functions devMSMs package accept data form single data frame missing values m imputed datasets form either mids object (output mice package via imputeData()) list imputed datasets. developmental data humans amount missing data. Given creation IPTW balancing weights requires complete data, recommend imputing data. Imputation assumes missing data mechanism missing random (MAR) 20% missing data total (Leyrat et al., 2021). Given existing work demonstrating superiority, devMSMS implements ‘within’ approach imputed data, conducting steps imputed dataset pooling estimates using Rubin’s rules create final average predictions contrast comparisons Worfklows vignettes Step 5 (Leyrat et al, 2021; Granger et al., 2019). shown , users can use helper function impute wide data impute elsewhere read imputed data list use devMSMs. Users option using helper imputeData() function impute correctly formatted wide data. step can take run. user can specify many imputed datasets create (default m = 5). imputeData() draws mice() function mice package (van Buuren & Oudshoorn, 2011) conduct multiple imputation chained equations (mice). variables present dataset used impute missing data column. user can specify imputation method method field drawing following list: “pmm” (predictive mean matching), “midastouch” (weighted predictive mean matching), “sample” (random sample observed values), “rf” (random forest) “cart” (classification regression trees). Random forest imputation default given evidence efficiency superior performance (Shah et al., 2014). Please review mice documentation details. Additionally, users can specify integer value seed order offset random number generator mice() make reproducible imputations. parameter read_imps_from_file allow read already imputed data local storage (TRUE) re-run imputation code multiple times (FALSE; default). Users may use parameter supply mids object imputed data mice package (title ‘all_imp.rds’). sure inspect console warnings well resulting imputed datasets. variables missing data following imputation may need removed due high collinearity /low variability. required inputs function data frame wide format (formatted according pre-requirements listed ), m number imputed datasets create, path home directory (save.= TRUE), exposure (e.g., “variable”), outcome (e.g., “variable.t”). home directory path, exposure, outcome already defined user completed Specifying Core Inputs vignette. optional inputs follows. user can specify imputation method compatible mice() (see ). Additionally, user can specify maxit number interactions mice::mice() conduct (default 5). user can also specify para_proc, logical indicator indicating whether speed imputing using parallel processing (default = TRUE). draws 2 cores using functions parallel, doRNG, doParallel packages. user may also specify additional inputs accepted mice::mice() advise consulting [mice documentation] information. user can also indicate already created imputed datasets function wish read (read_imps_from_file = TRUE rather recreate (default). example, create 2 imputed datasets using default random forest method 0 iterations (just illustrative purposes), set seed reproducibility, assign output data use devMSMs. code takes time run. (Note: given challenges imputing data .rda files, set m = 2 maxit = 0 just illustrative purposes. recommend setting m = 5 maxit = 5 (mice default) running data.) inspect output console warnings mice(). mice object can now assigned data use deveMSMs package (see Workflows vignettes). Alternatively, user imputed datasets already created wide, formatted data using program mice, can read , list, files saved locally .csv files single folder. list can assigned data use deveMSMs package (see Workflows vignettes). , load list imputed data simulated FLP, example. (See example Rmarkdown file code files saved locally.)","code":"s <- 1234 m <- 2 method <- \"rf\" maxit <- 0 imputed_data <- imputeData( data = data_wide_f, exposure = exposure, outcome = outcome, sep = \"\\\\.\", m = m, method = method, maxit = maxit, para_proc = FALSE, seed = s, read_imps_from_file = FALSE, home_dir = home_dir, save.out = save.out ) #> Creating 2 imputed datasets using the rf imputation method in mice::mice(). This may take some time to run. #> #> #> USER ALERT: Please view any logged events from the imputation below: #> Table: Logged Events from mice::mice head(mice::complete(imputed_data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 0 -4 1 3 #> 2 2 5 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 1 3 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.654 0.397 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 data <- imputed_data data(\"sim_data_imp_list\", package = \"devMSMs\") data <- sim_data_imp_list head(data[[1]], n = c(5, 10)) #> X ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 1 3 1 1 7 16 1 3 #> 2 2 2 4 -7 7 0 0 0 #> 3 3 3 6 5 20 -1 0 3 #> 4 4 4 24 25 17 11 0 3 #> 5 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 #> 1 -0.227 -0.652 #> 2 0.149 0.831 #> 3 1.145 0.033 #> 4 0.301 -0.501 #> 5 -0.247 0.084"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-3a--multiply-impute-formatted-wide-data-frame-using-mice","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.3a. Multiply Impute Formatted, Wide Data Frame using MICE","title":"Data Requirements & Preparation","text":"Users option using helper imputeData() function impute correctly formatted wide data. step can take run. user can specify many imputed datasets create (default m = 5). imputeData() draws mice() function mice package (van Buuren & Oudshoorn, 2011) conduct multiple imputation chained equations (mice). variables present dataset used impute missing data column. user can specify imputation method method field drawing following list: “pmm” (predictive mean matching), “midastouch” (weighted predictive mean matching), “sample” (random sample observed values), “rf” (random forest) “cart” (classification regression trees). Random forest imputation default given evidence efficiency superior performance (Shah et al., 2014). Please review mice documentation details. Additionally, users can specify integer value seed order offset random number generator mice() make reproducible imputations. parameter read_imps_from_file allow read already imputed data local storage (TRUE) re-run imputation code multiple times (FALSE; default). Users may use parameter supply mids object imputed data mice package (title ‘all_imp.rds’). sure inspect console warnings well resulting imputed datasets. variables missing data following imputation may need removed due high collinearity /low variability. required inputs function data frame wide format (formatted according pre-requirements listed ), m number imputed datasets create, path home directory (save.= TRUE), exposure (e.g., “variable”), outcome (e.g., “variable.t”). home directory path, exposure, outcome already defined user completed Specifying Core Inputs vignette. optional inputs follows. user can specify imputation method compatible mice() (see ). Additionally, user can specify maxit number interactions mice::mice() conduct (default 5). user can also specify para_proc, logical indicator indicating whether speed imputing using parallel processing (default = TRUE). draws 2 cores using functions parallel, doRNG, doParallel packages. user may also specify additional inputs accepted mice::mice() advise consulting [mice documentation] information. user can also indicate already created imputed datasets function wish read (read_imps_from_file = TRUE rather recreate (default). example, create 2 imputed datasets using default random forest method 0 iterations (just illustrative purposes), set seed reproducibility, assign output data use devMSMs. code takes time run. (Note: given challenges imputing data .rda files, set m = 2 maxit = 0 just illustrative purposes. recommend setting m = 5 maxit = 5 (mice default) running data.) inspect output console warnings mice(). mice object can now assigned data use deveMSMs package (see Workflows vignettes).","code":"s <- 1234 m <- 2 method <- \"rf\" maxit <- 0 imputed_data <- imputeData( data = data_wide_f, exposure = exposure, outcome = outcome, sep = \"\\\\.\", m = m, method = method, maxit = maxit, para_proc = FALSE, seed = s, read_imps_from_file = FALSE, home_dir = home_dir, save.out = save.out ) #> Creating 2 imputed datasets using the rf imputation method in mice::mice(). This may take some time to run. #> #> #> USER ALERT: Please view any logged events from the imputation below: #> Table: Logged Events from mice::mice head(mice::complete(imputed_data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 0 -4 1 3 #> 2 2 5 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 1 3 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.654 0.397 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 data <- imputed_data"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"p4-3b--read-in-as-a-list-of-wide-imputed-data-saved-locally","dir":"Articles","previous_headings":"P4 Data Preparation & Inspection","what":"P4.3b. Read in as a List of Wide Imputed Data Saved Locally","title":"Data Requirements & Preparation","text":"Alternatively, user imputed datasets already created wide, formatted data using program mice, can read , list, files saved locally .csv files single folder. list can assigned data use deveMSMs package (see Workflows vignettes). , load list imputed data simulated FLP, example. (See example Rmarkdown file code files saved locally.)","code":"data(\"sim_data_imp_list\", package = \"devMSMs\") data <- sim_data_imp_list head(data[[1]], n = c(5, 10)) #> X ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 1 3 1 1 7 16 1 3 #> 2 2 2 4 -7 7 0 0 0 #> 3 3 3 6 5 20 -1 0 3 #> 4 4 4 24 25 17 11 0 3 #> 5 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 #> 1 -0.227 -0.652 #> 2 0.149 0.831 #> 3 1.145 0.033 #> 4 0.301 -0.501 #> 5 -0.247 0.084"},{"path":"https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Data Requirements & Preparation","text":"Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Kainz, K., Greifer, N., Givens, ., Swietek, K., Lombardi, B. M., Zietz, S., & Kohn, J. L. (2017). Improving Causal Inference: Recommendations Covariate Selection Balance Propensity Score Methods. Journal Society Social Work Research, 8(2), 279–303. https://doi.org/10.1086/691464 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-1-recommended-home-directory","dir":"Articles","previous_headings":"","what":"P3.1 Recommended: Home Directory","title":"Specify Core Inputs","text":"Users required specify home directory, quotations, path designated folder output package (without final forward slash), plan save intermediary final outputs package (default) setting save.= TRUE functions. sub directories created within home directory devMSMs functions automatically save.= TRUE.","code":"home_dir <- NA # home_dir <- '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa'"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-2-recommended-time-point-delimiter","dir":"Articles","previous_headings":"","what":"P3.2 Recommended: Time Point Delimiter","title":"Specify Core Inputs","text":"Users required use consistent delimiter parsing names time-varying variables (.e., exposure, time-varying confounders, outcome) name construct time point measured. default period user can specify delimiter. devMSMs assume integer final instance delimiter wihin variable name corresponds time point measured. delimiter shoudl used time-varying variables. Users can specify different delimiter character string regular expression (regex) form. , use default period time delimiter.","code":"sep <- \"\\\\.\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-3-required-exposure-variable","dir":"Articles","previous_headings":"","what":"P3.3 Required: Exposure Variable","title":"Specify Core Inputs","text":"exposure refers developmental construct hypothesized cause outcome. Users required specify exposure variable use functions devMSMs. exposure can either continuously distributed binary, package automatically detects. user must specify exposure, list character strings corresponding exposure variable wide format, appears dataset. time exposure measured appear suffix delimiter user’s choosing (time-varying confounders). user two options specifying exposure variablee, select option best serves theory regarding developmental timing practical constraints data modeling process. First, may specify exposure time points exposure measured data. means balancing formulas created (Steps 1a, 2a, 3b Workflows vignettes) IPTW weights created (Steps 2b, 3c Workflows vignettes) assessed (Steps 2c, 3a, 4 Workflows vignettes) time points. case, epochs specified, time points included exposure main effects final substantive model history comparison (Step 5 Workflows vignettes). Second, may specify subset theoretically important time points exposure measured data. means balancing formulas created IPTW weights created assessed time points. , epochs specified, subsetted time points included exposure main effects final substantive models. Importantly, exposure variables time point included exposure included time-varying confounders, used balancing purposes . specification exposure epochs kept consistent throughout use devMSMs package. user intends specify exposure epochs, user include time points encompassed epochs . user intend specify exposure epochs, exposure constitute exposure main effects final outcome model form basis histories used history comparison. case, user specifies 4 exposure time points, required conduct subset history comparisons (Step 5b Workflows vignettes), given base code (see hypotheses() function marginaleffects package) accommodate pairwise history comparisons 5 time points. example, elected create epochs infancy (6 15 months), toddlerhood (24 35 months), early childhood (58 months) include exposure time points.","code":"exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-4-required-for-continuous-exposure-high-and-low-cutoff-values","dir":"Articles","previous_headings":"","what":"P3.4 Required for Continuous Exposure: High and Low Cutoff Values","title":"Specify Core Inputs","text":"exposure variable continuously distributed (e.g., economic strain), inherent demarcation considered high versus low levels exposure. Given part MSM process involved examining different exposure histories –vary dose timing – development result different outcome levels, need specify considered high versus low levels exposure. continuous exposures, required recommended preliminary step Workflows vignette compareHistories() devMSMs function (see Workflows vignettes). specify hi_lo_cut, list two quantile values (0-1): first represents value considered high levels exposure second represents followed considered low levels exposure. values may revised following inspection sample distribution across resulting exposure histories recommended preliminary steps Workflows vignettes. final values used creating modeling effects exposure histories Step 5 Workflows vignettes. , specify 60th 30th percentiles demarcate high low levels economic strain exposure, respectively.","code":"hi_lo_cut <- c(0.6, 0.3)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-5-optional-exposure-epochs","dir":"Articles","previous_headings":"","what":"P3.5 Optional: Exposure Epochs","title":"Specify Core Inputs","text":"modeling effect exposure outcome MSM process, user option specify epochs exposure, grouping time points exposure meaningful categories. may useful cases user wishes establish balance using time points exposure measured, substantive hypotheses coarser timescales (e.g., infancy). epochs specified, time points exposure measured used creation exposure histories final step process. specified epoch must corresponding value (values can differ number entries shown ). specify epochs, users utilize optional epoch argument providing, character string, list user-created epoch labels, one exposure time point order listed exposure. user specifies exposure epochs, exposure main effects created epoch, exposure levels averaged epochs consist two time point values. exposure epochs arguments fitModel() compareHistories() devMSMs functions (see Workflows vignettes) specification kept consistent throughout use package vignettes. constitute main effects variables modeling relation exposure outcome (Workflows vignettes Step 5a) form basis estimating comparing exposure histories (Workflows vignettes Step 5b). epochs specified, exposure time points exposure field used aforementioned steps. , specify ‘infancy’ (“ESETA1.6”, “ESETA1.15), ‘toddlerhood’ (”ESETA1.24”, “ESETA1.35”), ‘childhood’ (“ESETA1.58”).","code":"epoch <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-6-recommended-hypotheses-relevant-exposure-histories","dir":"Articles","previous_headings":"","what":"P3.6 Recommended: Hypotheses-Relevant Exposure Histories","title":"Specify Core Inputs","text":"strongly recommend users selective histories, developmental sequences high low exposure (exposure time points epochs), vital testing hypotheses. recommend user estimates compares subset possible exposure histories using reference comparison fields (rather comparing possible exposure histories). user can specify custom subset exposure histories using reference comparison fields optional inputs compareHistories() devMSMs function (see Workflows vignettes). conduct customized comparisons, users must provide least one unique valid history (e.g., “l-l-l”) reference providing character string (list strings) lowercase l’s h’s (separated -), corresponding exposure epoch (exposure time point), signify sequence exposure levels (“low” “high”, respectively). supply reference history, comparisons provide least one unique valid history comparison , quotations, providing string (list strings) l’s h’s (separated “-”), corresponding exposure epoch, signify sequence exposure levels (“low” “high”, respectively) constitutes comparison exposure history/histories compared reference Step 5b Workflows vignettes. supply one comparisons, least one reference must specified. reference exposure history compared comparison history comparisons supplied multiple comparison correction. reference comparison specified, histories compared Step 5b Workflows vignettes. However, 4 exposure main effects (either epochs exposure time points), user required select subset history comparisons (Step 5b Workflows vignettes), given base code (see hypotheses() function marginaleffects package) accommodate pairwise history comparisons 5 time points). final reference comparison values established step used estimating comparing exposure histories Step 5b Workflows vignettes. , specify low economic strain epochs (“l-l-l”) reference event comparison high levels epochs (“h-h-h”) well histories contain 1 dose exposure high economic strain different epochs.","code":"reference <- c(\"l-l-l\") comparison <- c(\"h-h-h\", \"l-l-h\", \"h-l-l\", \"l-h-l\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-7-required-outcome-variable","dir":"Articles","previous_headings":"","what":"P3.7 Required: Outcome Variable","title":"Specify Core Inputs","text":"outcome refers developmental construct hypothesized caused exposure. Users also required specify outcome variable designated final time point, required input fitModel() compareHistories() functions devMSMs package. final time point equal (, ideally greater ) final exposure time point. Note instances outcome variable measured prior time points included time-varying confounders balancing purposes. Users must specify outcome, character string suffix time point collected, corresponding variable name wide data. outcome variables measured prior time points included time-varying confounders. example, specify behavior problems measured 58 months outcome.","code":"outcome <- \"StrDif_Tot.58\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-8-recommended-confounders","dir":"Articles","previous_headings":"","what":"P3.8 Recommended: Confounders","title":"Specify Core Inputs","text":"Specifying confounders critical successful implmentation MSMs. Confounders refer variables cause either exposure outcome, thus cause spurious relation exposure outcome. MSMs assume possible confounders measured. Time invariant confounders considered stable across developmental period studying. Specifying time invariant confounders ti_conf recommended use package input createFormulas() function devMSMS. Time invariant confounders include core demographic birth characteristics (e.g., sex, racial group membership, birth complications) might cause either exposure outcome, either directly proxy, suggested theory /evidenced strong associations existing literature. user wishes specify interactions, need manually create data listing . , user can also include interaction terms time invariant variables (e.g., “variable:variable”) inclusion balancing formula. Keep mind interactions include factor variables decomposed interactions factor level. ti_conf, list character strings, provide names confounders dataset time invariant. time suffix. , specify 18 time invariant confounders measured baseline study visit, prior first exposure time point. Time-varying confounders considered vary development, regardless many times measured dataset. Specifying time-varying confounders recommended use package input createFormulas() devMSMs function (see Workflows vignettes). tv_conf, list character strings, provide names variables wide format (e.g., “variable.t”) dataset time-varying, including exposure outcome variables specified respective fields (see ). time suffix following delimiter. Note time-varying confounders also include confounders measured repeatedly time points (e.g., InRatioCor) collected one several specific time points, missing time points, time invariant. Additionally, note user specify exposure time points tv_conf, lagged values exposure automatically included time-varying confounders creation formulas. user wishes specify interactions, need manually create data listing . , user can also include interaction terms time invariant variables (e.g., “variable:variable”) inclusion balancing formula. Keep mind interactions include factor variables decomposed interactions factor level. creating balancing formula exposure time point, default devMSMs include time-varying confounders measured exposure time point. often difficult differentiate confounders measured contemporaneously mediators, balancing mediator ill-advised. However, sometimes user may good evidence know given time-varying confounder mediator exposure even measured contemporaneously. case, may specify override package default retain given variable/set time-varying confoudners formulas exposure measured contemporaneously. concur_conf: list character strings, provide names time-varying confounders (wide format) wish included contemporaneously balancing formulas (overriding default include lagged confounders). user can now proceed Data Requirements Workflows vignettes.","code":"ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\") concur_conf <- \"B18Raw.6\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-8a-recommended-time-invariant-confounders","dir":"Articles","previous_headings":"","what":"P3.8a Recommended: Time Invariant Confounders","title":"Specify Core Inputs","text":"Time invariant confounders considered stable across developmental period studying. Specifying time invariant confounders ti_conf recommended use package input createFormulas() function devMSMS. Time invariant confounders include core demographic birth characteristics (e.g., sex, racial group membership, birth complications) might cause either exposure outcome, either directly proxy, suggested theory /evidenced strong associations existing literature. user wishes specify interactions, need manually create data listing . , user can also include interaction terms time invariant variables (e.g., “variable:variable”) inclusion balancing formula. Keep mind interactions include factor variables decomposed interactions factor level. ti_conf, list character strings, provide names confounders dataset time invariant. time suffix. , specify 18 time invariant confounders measured baseline study visit, prior first exposure time point.","code":"ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-8b-recommended-time-varying-confounders","dir":"Articles","previous_headings":"","what":"P3.8b Recommended: Time-varying Confounders","title":"Specify Core Inputs","text":"Time-varying confounders considered vary development, regardless many times measured dataset. Specifying time-varying confounders recommended use package input createFormulas() devMSMs function (see Workflows vignettes). tv_conf, list character strings, provide names variables wide format (e.g., “variable.t”) dataset time-varying, including exposure outcome variables specified respective fields (see ). time suffix following delimiter. Note time-varying confounders also include confounders measured repeatedly time points (e.g., InRatioCor) collected one several specific time points, missing time points, time invariant. Additionally, note user specify exposure time points tv_conf, lagged values exposure automatically included time-varying confounders creation formulas. user wishes specify interactions, need manually create data listing . , user can also include interaction terms time invariant variables (e.g., “variable:variable”) inclusion balancing formula. Keep mind interactions include factor variables decomposed interactions factor level.","code":"tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"p3-8c-optional-concurrent-confounders","dir":"Articles","previous_headings":"","what":"P3.8c Optional: Concurrent Confounders","title":"Specify Core Inputs","text":"creating balancing formula exposure time point, default devMSMs include time-varying confounders measured exposure time point. often difficult differentiate confounders measured contemporaneously mediators, balancing mediator ill-advised. However, sometimes user may good evidence know given time-varying confounder mediator exposure even measured contemporaneously. case, may specify override package default retain given variable/set time-varying confoudners formulas exposure measured contemporaneously. concur_conf: list character strings, provide names time-varying confounders (wide format) wish included contemporaneously balancing formulas (overriding default include lagged confounders). user can now proceed Data Requirements Workflows vignettes.","code":"concur_conf <- \"B18Raw.6\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Specify_Core_Inputs.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Specify Core Inputs","text":"Arel-Bundock, Vincent. 2024. marginaleffects: Predictions, Comparisons, Slopes, Marginal Means, Hypothesis Tests. https://CRAN.R-project.org/package=marginaleffects.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Terminology.html","id":"balancing-formula","dir":"Articles","previous_headings":"","what":"Balancing Formula","title":"Terminology","text":"table summarizes three formula type’s used. Table 2. Summary formula terminology used devMSMs package creating balancing weights assessing performance devMSMs (Workflows vignettes Steps 4-6). different kinds formulas vary respect inclusion time-varying confounders type specification create using createFormulas() function. type = \"full\" type = \"short\" type = \"update\"","code":"ESETA1.t ~ time-invariant confounders + time-varying confounders + lagged outcomes + lagged outcomes ESETA1.24 ~ B18Raw.15 + B18Raw.6 + BioDadInHH2 + CORTB.15 + CORTB.6 + DrnkFreq + ES.15 + ES.6 + gov_assist + HOMEETA1.15 + HOMEETA1.6 + HomeOwnd ... ESETA1.24 ~ B18Raw.15 + BioDadInHH2 + CORTB.15 + DrnkFreq + ES.15 + gov_assist + HOMEETA1.15 + HomeOwnd ... ESETA1.24 ~ B18Raw.15 + BioDadInHH2 + CORTB.15 + DrnkFreq + ES.6 + ES.15 + gov_assist + HOMEETA1.15 + HomeOwnd ..."},{"path":"https://istallworthy.github.io/devMSMs/articles/Terminology.html","id":"core-functions-of-devmsms","dir":"Articles","previous_headings":"","what":"7 core functions of devMSMs","title":"Terminology","text":"7 key functions used devMSMs workflow. Summary 7 core functions devMSMs package.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Workflow: Continuous Exposure","text":"devMSMs available CRAN, need install directly Github (https://github.com/istallworthy/devMSMs), shown . devMSMs functions option save objects ‘.rds’ files. Users can also save content print, summary, plot methods, illustrated sections . save, users must supply path home directory (home_dir) creating initial MSM object. Users can save home directory using default file labels (.txt file type) using save.= TRUE. saving tables, users option supply name file type (e.g., save.= “custom_name.png”). Allowable file types : .png, .html, .pdf, .tex, .md. sub-folders referenced function created automatically within home directory. recommend saving outputs future use provide commented examples . output saved , function automatically provides path file aid user reading output future. functions output tables. tinytables package can customized (e.g., dimensions, footnotes, captions, combined, etc.) according options provided package (https://vincentarelbundock.github.io/tinytable/vignettes/tinytable.html).","code":"options(repos = c(CRAN = \"https://cloud.r-project.org\")) install.packages(\"devtools\") #> Installing package into '/home/runner/work/_temp/Library' #> (as 'lib' is unspecified) require(\"devtools\", quietly = TRUE) devtools::install_github(\"istallworthy/devMSMs\", quiet = TRUE) library(devMSMs) devtools::install_github(\"istallworthy/devMSMsHelpers\", quiet = TRUE) library(devMSMsHelpers) save.out = FALSE"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"phase-0-preliminary-conceptual-data-preparation","dir":"Articles","previous_headings":"","what":"Phase 0: Preliminary Conceptual & Data Preparation","title":"Workflow: Continuous Exposure","text":"Please see accompanying manuscript steps P1 (creating hypotheses) P2 (creating DAG). first step create initial MSM object specifying core variables data use package. Please see Specifying Core Inputs vignette detail following core inputs. , specify data, exposure, time invariant time-varying confounders, well exposure epochs. several optional fields user specify MSM object. user also option specify concur_conf, indicating, list character strings, names time-varying confounders (e.g., “variable.time”) wish included concurrently weights formulas (overriding default include lagged confounders). done user strong evidence differentiate confounders mediators relation exposure contemporaneously. specify home directory given nature example, recommend save core function outputs. , use default period time delimiter. specify 6 time points exposure. , specify 60th 30th percentiles demarcate high low levels economic strain exposure, respectively. specify first two exposure time points (6 15 months) considered infancy, second two (34 25 months) toddlerhood, final (58 months) childhood. See Specify Core Inputs vignette information. , specify low economic strain epochs (“l-l-l”) reference event comparison high levels epochs (“h-h-h”) examine example question comparing causal effects 0 vs 3 doses exposure economic strain children’s behavior problems. specify outcome behavior problems 58 months. specify time-invariant time-varying confounders. specify concurrent confounders , given data, unable disentangle mediators colliders. highly recommend first implementing Data Requirements & Preparation Vignette https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html assigning variable, data, one following wide data formats (see Figure 1) use package: single data frame data wide format missing data mids object (output mice::mice()) data imputed wide format list data imputed wide format data frames See Data Preparation vignette detail. first load 2 imputed datasets mice object. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (“ESETA1”) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (“StrDif_Tot”) measured 58 months. (See Data Requirements & Preparation vignette beginning data types, including missing data). set seed reproducibility. , inspect MSMS object view confirm variables categorized. users, highly recommend use helper inspectData() function (complete dataset long wide format imputed data case missingness) summarize exposure, outcome, confounders inspect sample distribution among exposure histories. Based user-specified exposure epochs high low quantile values (continuous exposures), function outputs table showing sample distribution across histories. strongly suggest visually inspecting table revising designation epochs /high low quantile values (continuous exposures) history contains reasonable number participants. gold standard required number per history cell, users guard extrapolation beyond scope data. example, data, using 75th 25th percentile cutoffs, histories represented less two cases thus re-evaluated cutoffs. Users may wish revise epoch designation high low cutoff values, applicable. function conducts summaries history distribution inspection imputed dataset imputed data supplied. required inputs inspectData() : complete data (data frame wide long format, list imputed data frames wide format, mids object), exposure (e.g., “variable”), outcome (e.g., “variable.t”). exposure continuously distributed, user required supply hi_lo_cut values demarcating high low levels. Optional inputs home directory (save.= TRUE), epochs, high/low cutoff values continuous exposures, specification reference comparison histories. helper inspectData() function outputs following files home directory: correlation plot variables dataset, tables exposure outcome descriptive statistics, two summary tables confounders considered time point. , see summaries data types well reasonable cell counts specified histories, imputed dataset.","code":"# home_dir = '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa' sep <- \"\\\\.\" exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\") hi_lo_cut <- c(0.6, 0.3) epochs <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\") reference <- c(\"l-l-l\") comparison <- c(\"h-h-h\") outcome <- \"StrDif_Tot.58\" ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\") data(\"sim_data_mice\", package = \"devMSMs\") data <- sim_data_mice head(mice::complete(data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 7 16 1 3 #> 2 2 4 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.149 0.831 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 set.seed(1234) obj <- initMSM( data, exposure = c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\"), ti_conf = c(\"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\"), tv_conf = c(\"SAAmylase.6\",\"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\",\"RHasSO.35\", \"WndNbrhood.6\",\"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\"), epoch <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\"), sep = \"\\\\.\" ) print(obj) #> Exposure (continuous): ESETA1.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58 #> Corresponding epoch: Infancy, Infancy, Toddlerhood, Toddlerhood, Childhood #> Variable and their encodings: #> var type time #> ESETA1.6 exposure 6 #> ESETA1.15 exposure 15 #> ESETA1.24 exposure 24 #> ESETA1.35 exposure 35 #> ESETA1.58 exposure 58 #> SAAmylase.6 tv_conf 6 #> SAAmylase.15 tv_conf 15 #> SAAmylase.24 tv_conf 24 #> MDI.6 tv_conf 6 #> MDI.15 tv_conf 15 #> RHasSO.6 tv_conf 6 #> RHasSO.15 tv_conf 15 #> RHasSO.24 tv_conf 24 #> RHasSO.35 tv_conf 35 #> WndNbrhood.6 tv_conf 6 #> WndNbrhood.24 tv_conf 24 #> WndNbrhood.35 tv_conf 35 #> IBRAttn.6 tv_conf 6 #> IBRAttn.15 tv_conf 15 #> IBRAttn.24 tv_conf 24 #> B18Raw.6 tv_conf 6 #> B18Raw.15 tv_conf 15 #> B18Raw.24 tv_conf 24 #> HOMEETA1.6 tv_conf 6 #> HOMEETA1.15 tv_conf 15 #> HOMEETA1.24 tv_conf 24 #> HOMEETA1.35 tv_conf 35 #> InRatioCor.6 tv_conf 6 #> InRatioCor.15 tv_conf 15 #> InRatioCor.24 tv_conf 24 #> InRatioCor.35 tv_conf 35 #> CORTB.6 tv_conf 6 #> CORTB.15 tv_conf 15 #> CORTB.24 tv_conf 24 #> EARS_TJo.24 tv_conf 24 #> EARS_TJo.35 tv_conf 35 #> LESMnPos.24 tv_conf 24 #> LESMnPos.35 tv_conf 35 #> LESMnNeg.24 tv_conf 24 #> LESMnNeg.35 tv_conf 35 #> StrDif_Tot.35 tv_conf 35 #> fscore.35 tv_conf 35 #> state ti_conf -1 #> BioDadInHH2 ti_conf -1 #> PmAge2 ti_conf -1 #> PmBlac2 ti_conf -1 #> TcBlac2 ti_conf -1 #> PmMrSt2 ti_conf -1 #> PmEd2 ti_conf -1 #> KFASTScr ti_conf -1 #> RMomAgeU ti_conf -1 #> RHealth ti_conf -1 #> HomeOwnd ti_conf -1 #> SWghtLB ti_conf -1 #> SurpPreg ti_conf -1 #> SmokTotl ti_conf -1 #> DrnkFreq ti_conf -1 #> peri_health ti_conf -1 #> caregiv_health ti_conf -1 #> gov_assist ti_conf -1 inspectData(data = data, obj = obj, outcome = outcome, hi_lo_cut = hi_lo_cut, reference = reference, comparison = comparison, verbose = TRUE, save.out = save.out) #> Imputation 1 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.4193 |1st Qu.:-0.4153 |1st Qu.:-0.4665 |1st Qu.:-0.57050 |1st Qu.:-0.51100 | #> | |Median : 0.3030 |Median : 0.2165 |Median : 0.1445 |Median : 0.07300 |Median : 0.05650 | #> | |Mean : 0.2765 |Mean : 0.2115 |Mean : 0.1154 |Mean : 0.08565 |Mean : 0.07673 | #> | |3rd Qu.: 0.9000 |3rd Qu.: 0.8620 |3rd Qu.: 0.7258 |3rd Qu.: 0.74075 |3rd Qu.: 0.71425 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|---------:|--------:|-----:| #> | -0.497| 0.297| 0.48| 0.4897314| 0.689| 1.448| #> Imputation 2 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 218 | #> +---------------+-----+ #> | l-l-l | 115 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.3245 |1st Qu.:-0.4133 |1st Qu.:-0.5020 |1st Qu.:-0.56900 |1st Qu.:-0.53350 | #> | |Median : 0.3440 |Median : 0.2215 |Median : 0.1160 |Median : 0.07400 |Median : 0.08300 | #> | |Mean : 0.3201 |Mean : 0.2022 |Mean : 0.1229 |Mean : 0.08662 |Mean : 0.07949 | #> | |3rd Qu.: 0.9423 |3rd Qu.: 0.8482 |3rd Qu.: 0.7380 |3rd Qu.: 0.74625 |3rd Qu.: 0.70550 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|--------:|--------:|-----:| #> | -0.497| 0.29675| 0.472| 0.489219| 0.69325| 1.448| #> [[1]] #> NULL #> #> [[2]] #> NULL"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-p3--specify-core-inputs","dir":"Articles","previous_headings":"","what":"STEP P3. Specify Core Inputs","title":"Workflow: Continuous Exposure","text":"first step create initial MSM object specifying core variables data use package. Please see Specifying Core Inputs vignette detail following core inputs. , specify data, exposure, time invariant time-varying confounders, well exposure epochs. several optional fields user specify MSM object. user also option specify concur_conf, indicating, list character strings, names time-varying confounders (e.g., “variable.time”) wish included concurrently weights formulas (overriding default include lagged confounders). done user strong evidence differentiate confounders mediators relation exposure contemporaneously. specify home directory given nature example, recommend save core function outputs. , use default period time delimiter. specify 6 time points exposure. , specify 60th 30th percentiles demarcate high low levels economic strain exposure, respectively. specify first two exposure time points (6 15 months) considered infancy, second two (34 25 months) toddlerhood, final (58 months) childhood. See Specify Core Inputs vignette information. , specify low economic strain epochs (“l-l-l”) reference event comparison high levels epochs (“h-h-h”) examine example question comparing causal effects 0 vs 3 doses exposure economic strain children’s behavior problems. specify outcome behavior problems 58 months. specify time-invariant time-varying confounders. specify concurrent confounders , given data, unable disentangle mediators colliders.","code":"# home_dir = '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa' sep <- \"\\\\.\" exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\") hi_lo_cut <- c(0.6, 0.3) epochs <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\") reference <- c(\"l-l-l\") comparison <- c(\"h-h-h\") outcome <- \"StrDif_Tot.58\" ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-1-recommended-home-directory","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.1 Recommended: Home Directory","title":"Workflow: Continuous Exposure","text":"specify home directory given nature example, recommend save core function outputs.","code":"# home_dir = '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa'"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-2-recommended-time-point-delimiter","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.2 Recommended: Time Point Delimiter","title":"Workflow: Continuous Exposure","text":", use default period time delimiter.","code":"sep <- \"\\\\.\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-3-required-exposure-variable","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.3 Required: Exposure Variable","title":"Workflow: Continuous Exposure","text":"specify 6 time points exposure.","code":"exposure <- c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-4--required-for-continuous-exposures-identify-high-and-low-cutoff-values","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.4. Required for Continuous Exposures: Identify High and Low Cutoff Values","title":"Workflow: Continuous Exposure","text":", specify 60th 30th percentiles demarcate high low levels economic strain exposure, respectively.","code":"hi_lo_cut <- c(0.6, 0.3)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-5-optional-exposure-epochs","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.5 Optional: Exposure Epochs","title":"Workflow: Continuous Exposure","text":"specify first two exposure time points (6 15 months) considered infancy, second two (34 25 months) toddlerhood, final (58 months) childhood.","code":"epochs <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-6-recommended-hypotheses-relevant-exposure-histories","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.6 Recommended: Hypotheses-Relevant Exposure Histories","title":"Workflow: Continuous Exposure","text":"See Specify Core Inputs vignette information. , specify low economic strain epochs (“l-l-l”) reference event comparison high levels epochs (“h-h-h”) examine example question comparing causal effects 0 vs 3 doses exposure economic strain children’s behavior problems.","code":"reference <- c(\"l-l-l\") comparison <- c(\"h-h-h\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-7-required-outcome-variable","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.7 Required: Outcome Variable","title":"Workflow: Continuous Exposure","text":"specify outcome behavior problems 58 months.","code":"outcome <- \"StrDif_Tot.58\""},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-8-recommended-confounders","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.8 Recommended: Confounders","title":"Workflow: Continuous Exposure","text":"specify time-invariant time-varying confounders.","code":"ti_conf <- c( \"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\") tv_conf <- c(\"SAAmylase.6\", \"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\", \"RHasSO.35\", \"WndNbrhood.6\", \"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p3-8c-optional-concurrent-confounders","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P3.8c Optional: Concurrent Confounders","title":"Workflow: Continuous Exposure","text":"specify concurrent confounders , given data, unable disentangle mediators colliders.","code":""},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-p4--data-preparation-inspection","dir":"Articles","previous_headings":"","what":"STEP P4. Data Preparation & Inspection","title":"Workflow: Continuous Exposure","text":"highly recommend first implementing Data Requirements & Preparation Vignette https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html assigning variable, data, one following wide data formats (see Figure 1) use package: single data frame data wide format missing data mids object (output mice::mice()) data imputed wide format list data imputed wide format data frames See Data Preparation vignette detail. first load 2 imputed datasets mice object. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (“ESETA1”) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (“StrDif_Tot”) measured 58 months. (See Data Requirements & Preparation vignette beginning data types, including missing data). set seed reproducibility. , inspect MSMS object view confirm variables categorized. users, highly recommend use helper inspectData() function (complete dataset long wide format imputed data case missingness) summarize exposure, outcome, confounders inspect sample distribution among exposure histories. Based user-specified exposure epochs high low quantile values (continuous exposures), function outputs table showing sample distribution across histories. strongly suggest visually inspecting table revising designation epochs /high low quantile values (continuous exposures) history contains reasonable number participants. gold standard required number per history cell, users guard extrapolation beyond scope data. example, data, using 75th 25th percentile cutoffs, histories represented less two cases thus re-evaluated cutoffs. Users may wish revise epoch designation high low cutoff values, applicable. function conducts summaries history distribution inspection imputed dataset imputed data supplied. required inputs inspectData() : complete data (data frame wide long format, list imputed data frames wide format, mids object), exposure (e.g., “variable”), outcome (e.g., “variable.t”). exposure continuously distributed, user required supply hi_lo_cut values demarcating high low levels. Optional inputs home directory (save.= TRUE), epochs, high/low cutoff values continuous exposures, specification reference comparison histories. helper inspectData() function outputs following files home directory: correlation plot variables dataset, tables exposure outcome descriptive statistics, two summary tables confounders considered time point. , see summaries data types well reasonable cell counts specified histories, imputed dataset.","code":"data(\"sim_data_mice\", package = \"devMSMs\") data <- sim_data_mice head(mice::complete(data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 7 16 1 3 #> 2 2 4 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.149 0.831 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153 set.seed(1234) obj <- initMSM( data, exposure = c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\"), ti_conf = c(\"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\"), tv_conf = c(\"SAAmylase.6\",\"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\",\"RHasSO.35\", \"WndNbrhood.6\",\"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\"), epoch <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\"), sep = \"\\\\.\" ) print(obj) #> Exposure (continuous): ESETA1.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58 #> Corresponding epoch: Infancy, Infancy, Toddlerhood, Toddlerhood, Childhood #> Variable and their encodings: #> var type time #> ESETA1.6 exposure 6 #> ESETA1.15 exposure 15 #> ESETA1.24 exposure 24 #> ESETA1.35 exposure 35 #> ESETA1.58 exposure 58 #> SAAmylase.6 tv_conf 6 #> SAAmylase.15 tv_conf 15 #> SAAmylase.24 tv_conf 24 #> MDI.6 tv_conf 6 #> MDI.15 tv_conf 15 #> RHasSO.6 tv_conf 6 #> RHasSO.15 tv_conf 15 #> RHasSO.24 tv_conf 24 #> RHasSO.35 tv_conf 35 #> WndNbrhood.6 tv_conf 6 #> WndNbrhood.24 tv_conf 24 #> WndNbrhood.35 tv_conf 35 #> IBRAttn.6 tv_conf 6 #> IBRAttn.15 tv_conf 15 #> IBRAttn.24 tv_conf 24 #> B18Raw.6 tv_conf 6 #> B18Raw.15 tv_conf 15 #> B18Raw.24 tv_conf 24 #> HOMEETA1.6 tv_conf 6 #> HOMEETA1.15 tv_conf 15 #> HOMEETA1.24 tv_conf 24 #> HOMEETA1.35 tv_conf 35 #> InRatioCor.6 tv_conf 6 #> InRatioCor.15 tv_conf 15 #> InRatioCor.24 tv_conf 24 #> InRatioCor.35 tv_conf 35 #> CORTB.6 tv_conf 6 #> CORTB.15 tv_conf 15 #> CORTB.24 tv_conf 24 #> EARS_TJo.24 tv_conf 24 #> EARS_TJo.35 tv_conf 35 #> LESMnPos.24 tv_conf 24 #> LESMnPos.35 tv_conf 35 #> LESMnNeg.24 tv_conf 24 #> LESMnNeg.35 tv_conf 35 #> StrDif_Tot.35 tv_conf 35 #> fscore.35 tv_conf 35 #> state ti_conf -1 #> BioDadInHH2 ti_conf -1 #> PmAge2 ti_conf -1 #> PmBlac2 ti_conf -1 #> TcBlac2 ti_conf -1 #> PmMrSt2 ti_conf -1 #> PmEd2 ti_conf -1 #> KFASTScr ti_conf -1 #> RMomAgeU ti_conf -1 #> RHealth ti_conf -1 #> HomeOwnd ti_conf -1 #> SWghtLB ti_conf -1 #> SurpPreg ti_conf -1 #> SmokTotl ti_conf -1 #> DrnkFreq ti_conf -1 #> peri_health ti_conf -1 #> caregiv_health ti_conf -1 #> gov_assist ti_conf -1 inspectData(data = data, obj = obj, outcome = outcome, hi_lo_cut = hi_lo_cut, reference = reference, comparison = comparison, verbose = TRUE, save.out = save.out) #> Imputation 1 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.4193 |1st Qu.:-0.4153 |1st Qu.:-0.4665 |1st Qu.:-0.57050 |1st Qu.:-0.51100 | #> | |Median : 0.3030 |Median : 0.2165 |Median : 0.1445 |Median : 0.07300 |Median : 0.05650 | #> | |Mean : 0.2765 |Mean : 0.2115 |Mean : 0.1154 |Mean : 0.08565 |Mean : 0.07673 | #> | |3rd Qu.: 0.9000 |3rd Qu.: 0.8620 |3rd Qu.: 0.7258 |3rd Qu.: 0.74075 |3rd Qu.: 0.71425 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|---------:|--------:|-----:| #> | -0.497| 0.297| 0.48| 0.4897314| 0.689| 1.448| #> Imputation 2 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 218 | #> +---------------+-----+ #> | l-l-l | 115 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.3245 |1st Qu.:-0.4133 |1st Qu.:-0.5020 |1st Qu.:-0.56900 |1st Qu.:-0.53350 | #> | |Median : 0.3440 |Median : 0.2215 |Median : 0.1160 |Median : 0.07400 |Median : 0.08300 | #> | |Mean : 0.3201 |Mean : 0.2022 |Mean : 0.1229 |Mean : 0.08662 |Mean : 0.07949 | #> | |3rd Qu.: 0.9423 |3rd Qu.: 0.8482 |3rd Qu.: 0.7380 |3rd Qu.: 0.74625 |3rd Qu.: 0.70550 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|--------:|--------:|-----:| #> | -0.497| 0.29675| 0.472| 0.489219| 0.69325| 1.448| #> [[1]] #> NULL #> #> [[2]] #> NULL"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p4-3b--required-read-in-wide-data","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P4.3b. Required: Read in Wide Data","title":"Workflow: Continuous Exposure","text":"highly recommend first implementing Data Requirements & Preparation Vignette https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html assigning variable, data, one following wide data formats (see Figure 1) use package: single data frame data wide format missing data mids object (output mice::mice()) data imputed wide format list data imputed wide format data frames See Data Preparation vignette detail. first load 2 imputed datasets mice object. data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). take example exposure economic strain (“ESETA1”) measured 6, 15, 24, 35, 58 months relation outcome behavior problems (“StrDif_Tot”) measured 58 months. (See Data Requirements & Preparation vignette beginning data types, including missing data).","code":"data(\"sim_data_mice\", package = \"devMSMs\") data <- sim_data_mice head(mice::complete(data, 1), n = c(5, 10)) #> ALI_Le.35 B18Raw.15 B18Raw.24 B18Raw.58 B18Raw.6 BioDadInHH2 caregiv_health #> 1 3 1 1 7 16 1 3 #> 2 2 4 -7 7 0 0 0 #> 3 3 6 5 20 -1 0 3 #> 4 4 24 25 17 11 0 3 #> 5 3 -8 -9 17 1 1 2 #> CORTB.15 CORTB.24 CORTB.6 #> 1 -0.227 -0.652 0.742 #> 2 0.149 0.831 0.018 #> 3 1.145 0.033 -0.379 #> 4 0.301 -0.501 0.000 #> 5 -0.247 0.084 0.153"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p4-4-required-create-msm-object","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P4.4 Required: Create MSM Object","title":"Workflow: Continuous Exposure","text":"set seed reproducibility. , inspect MSMS object view confirm variables categorized.","code":"set.seed(1234) obj <- initMSM( data, exposure = c(\"ESETA1.6\", \"ESETA1.15\", \"ESETA1.24\", \"ESETA1.35\", \"ESETA1.58\"), ti_conf = c(\"state\", \"BioDadInHH2\", \"PmAge2\", \"PmBlac2\", \"TcBlac2\", \"PmMrSt2\", \"PmEd2\", \"KFASTScr\", \"RMomAgeU\", \"RHealth\", \"HomeOwnd\", \"SWghtLB\", \"SurpPreg\", \"SmokTotl\", \"DrnkFreq\", \"peri_health\", \"caregiv_health\", \"gov_assist\"), tv_conf = c(\"SAAmylase.6\",\"SAAmylase.15\", \"SAAmylase.24\", \"MDI.6\", \"MDI.15\", \"RHasSO.6\", \"RHasSO.15\", \"RHasSO.24\",\"RHasSO.35\", \"WndNbrhood.6\",\"WndNbrhood.24\", \"WndNbrhood.35\", \"IBRAttn.6\", \"IBRAttn.15\", \"IBRAttn.24\", \"B18Raw.6\", \"B18Raw.15\", \"B18Raw.24\", \"HOMEETA1.6\", \"HOMEETA1.15\", \"HOMEETA1.24\", \"HOMEETA1.35\", \"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"CORTB.6\", \"CORTB.15\", \"CORTB.24\", \"EARS_TJo.24\", \"EARS_TJo.35\", \"LESMnPos.24\", \"LESMnPos.35\", \"LESMnNeg.24\", \"LESMnNeg.35\", \"StrDif_Tot.35\", \"fscore.35\"), epoch <- c(\"Infancy\", \"Infancy\", \"Toddlerhood\", \"Toddlerhood\", \"Childhood\"), sep = \"\\\\.\" ) print(obj) #> Exposure (continuous): ESETA1.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58 #> Corresponding epoch: Infancy, Infancy, Toddlerhood, Toddlerhood, Childhood #> Variable and their encodings: #> var type time #> ESETA1.6 exposure 6 #> ESETA1.15 exposure 15 #> ESETA1.24 exposure 24 #> ESETA1.35 exposure 35 #> ESETA1.58 exposure 58 #> SAAmylase.6 tv_conf 6 #> SAAmylase.15 tv_conf 15 #> SAAmylase.24 tv_conf 24 #> MDI.6 tv_conf 6 #> MDI.15 tv_conf 15 #> RHasSO.6 tv_conf 6 #> RHasSO.15 tv_conf 15 #> RHasSO.24 tv_conf 24 #> RHasSO.35 tv_conf 35 #> WndNbrhood.6 tv_conf 6 #> WndNbrhood.24 tv_conf 24 #> WndNbrhood.35 tv_conf 35 #> IBRAttn.6 tv_conf 6 #> IBRAttn.15 tv_conf 15 #> IBRAttn.24 tv_conf 24 #> B18Raw.6 tv_conf 6 #> B18Raw.15 tv_conf 15 #> B18Raw.24 tv_conf 24 #> HOMEETA1.6 tv_conf 6 #> HOMEETA1.15 tv_conf 15 #> HOMEETA1.24 tv_conf 24 #> HOMEETA1.35 tv_conf 35 #> InRatioCor.6 tv_conf 6 #> InRatioCor.15 tv_conf 15 #> InRatioCor.24 tv_conf 24 #> InRatioCor.35 tv_conf 35 #> CORTB.6 tv_conf 6 #> CORTB.15 tv_conf 15 #> CORTB.24 tv_conf 24 #> EARS_TJo.24 tv_conf 24 #> EARS_TJo.35 tv_conf 35 #> LESMnPos.24 tv_conf 24 #> LESMnPos.35 tv_conf 35 #> LESMnNeg.24 tv_conf 24 #> LESMnNeg.35 tv_conf 35 #> StrDif_Tot.35 tv_conf 35 #> fscore.35 tv_conf 35 #> state ti_conf -1 #> BioDadInHH2 ti_conf -1 #> PmAge2 ti_conf -1 #> PmBlac2 ti_conf -1 #> TcBlac2 ti_conf -1 #> PmMrSt2 ti_conf -1 #> PmEd2 ti_conf -1 #> KFASTScr ti_conf -1 #> RMomAgeU ti_conf -1 #> RHealth ti_conf -1 #> HomeOwnd ti_conf -1 #> SWghtLB ti_conf -1 #> SurpPreg ti_conf -1 #> SmokTotl ti_conf -1 #> DrnkFreq ti_conf -1 #> peri_health ti_conf -1 #> caregiv_health ti_conf -1 #> gov_assist ti_conf -1"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"p4-5--recommended-inspect-exposure-histories-and-data","dir":"Articles","previous_headings":"Phase 0: Preliminary Conceptual & Data Preparation","what":"P4.5. Recommended: Inspect Exposure Histories and Data","title":"Workflow: Continuous Exposure","text":"users, highly recommend use helper inspectData() function (complete dataset long wide format imputed data case missingness) summarize exposure, outcome, confounders inspect sample distribution among exposure histories. Based user-specified exposure epochs high low quantile values (continuous exposures), function outputs table showing sample distribution across histories. strongly suggest visually inspecting table revising designation epochs /high low quantile values (continuous exposures) history contains reasonable number participants. gold standard required number per history cell, users guard extrapolation beyond scope data. example, data, using 75th 25th percentile cutoffs, histories represented less two cases thus re-evaluated cutoffs. Users may wish revise epoch designation high low cutoff values, applicable. function conducts summaries history distribution inspection imputed dataset imputed data supplied. required inputs inspectData() : complete data (data frame wide long format, list imputed data frames wide format, mids object), exposure (e.g., “variable”), outcome (e.g., “variable.t”). exposure continuously distributed, user required supply hi_lo_cut values demarcating high low levels. Optional inputs home directory (save.= TRUE), epochs, high/low cutoff values continuous exposures, specification reference comparison histories. helper inspectData() function outputs following files home directory: correlation plot variables dataset, tables exposure outcome descriptive statistics, two summary tables confounders considered time point. , see summaries data types well reasonable cell counts specified histories, imputed dataset.","code":"inspectData(data = data, obj = obj, outcome = outcome, hi_lo_cut = hi_lo_cut, reference = reference, comparison = comparison, verbose = TRUE, save.out = save.out) #> Imputation 1 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.4193 |1st Qu.:-0.4153 |1st Qu.:-0.4665 |1st Qu.:-0.57050 |1st Qu.:-0.51100 | #> | |Median : 0.3030 |Median : 0.2165 |Median : 0.1445 |Median : 0.07300 |Median : 0.05650 | #> | |Mean : 0.2765 |Mean : 0.2115 |Mean : 0.1154 |Mean : 0.08565 |Mean : 0.07673 | #> | |3rd Qu.: 0.9000 |3rd Qu.: 0.8620 |3rd Qu.: 0.7258 |3rd Qu.: 0.74075 |3rd Qu.: 0.71425 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|---------:|--------:|-----:| #> | -0.497| 0.297| 0.48| 0.4897314| 0.689| 1.448| #> Imputation 2 #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 218 | #> +---------------+-----+ #> | l-l-l | 115 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> USER ALERT: Below are the 55 variables spanning 32 unique domains that will be treated as confounding variables for the relation between ESETA1 and StrDif_Tot.58. #> Please inspect this list carefully. It should include all time-varying covariates, time invariant covariates, as well as lagged levels of exposure and outcome variables if they were collected at time points earlier than the outcome time point. #> [1] \"B18Raw.15\" \"B18Raw.24\" \"B18Raw.6\" \"BioDadInHH2\" #> [5] \"caregiv_health\" \"CORTB.15\" \"CORTB.24\" \"CORTB.6\" #> [9] \"DrnkFreq\" \"EARS_TJo.24\" \"EARS_TJo.35\" \"fscore.35\" #> [13] \"gov_assist\" \"HOMEETA1.15\" \"HOMEETA1.24\" \"HOMEETA1.35\" #> [17] \"HOMEETA1.6\" \"HomeOwnd\" \"IBRAttn.15\" \"IBRAttn.24\" #> [21] \"IBRAttn.6\" \"InRatioCor.15\" \"InRatioCor.24\" \"InRatioCor.35\" #> [25] \"InRatioCor.6\" \"KFASTScr\" \"LESMnNeg.24\" \"LESMnNeg.35\" #> [29] \"LESMnPos.24\" \"LESMnPos.35\" \"MDI.15\" \"MDI.6\" #> [33] \"peri_health\" \"PmAge2\" \"PmBlac2\" \"PmEd2\" #> [37] \"PmMrSt2\" \"RHasSO.15\" \"RHasSO.24\" \"RHasSO.35\" #> [41] \"RHasSO.6\" \"RHealth\" \"RMomAgeU\" \"SAAmylase.15\" #> [45] \"SAAmylase.24\" \"SAAmylase.6\" \"SmokTotl\" \"state\" #> [49] \"StrDif_Tot.35\" \"SurpPreg\" \"SWghtLB\" \"TcBlac2\" #> [53] \"WndNbrhood.24\" \"WndNbrhood.35\" \"WndNbrhood.6\" #> #> The following variables are designated as numeric: #> [1] \"ALI_Le.35, CORTB.15, CORTB.24, CORTB.6, ESETA1.15, ESETA1.24, ESETA1.35, ESETA1.58, ESETA1.6, fscore.35, fscore.58, HOMEETA1.15, HOMEETA1.24, HOMEETA1.35, HOMEETA1.58, HOMEETA1.6, IBRAttn.15, IBRAttn.24, IBRAttn.6, ID, InRatioCor.15, InRatioCor.24, InRatioCor.35, InRatioCor.58, InRatioCor.6, LESMnNeg.24, LESMnNeg.35, LESMnPos.24, LESMnPos.35, PmAge2, SAAmylase.15, SAAmylase.24, SAAmylase.6, StrDif_Tot.35, StrDif_Tot.58, WndNbrhood.24, WndNbrhood.35, WndNbrhood.58, WndNbrhood.6, ESETA1.Childhood, ESETA1.Infancy, ESETA1.Toddlerhood\" #> #> The following variables are designated as factors: #> [1] \"BioDadInHH2, DrnkFreq, HomeOwnd, PmBlac2, PmMrSt2, RHasSO.15, RHasSO.24, RHasSO.35, RHasSO.58, RHasSO.6, RHealth, SmokTotl, state, SurpPreg, TcBlac2\" #> #> Table: Other variable types #> #> | |variable |type | #> |:--------------|:--------------|:-------| #> |B18Raw.15 |B18Raw.15 |integer | #> |B18Raw.24 |B18Raw.24 |integer | #> |B18Raw.58 |B18Raw.58 |integer | #> |B18Raw.6 |B18Raw.6 |integer | #> |caregiv_health |caregiv_health |integer | #> |EARS_TJo.24 |EARS_TJo.24 |integer | #> |EARS_TJo.35 |EARS_TJo.35 |integer | #> |gov_assist |gov_assist |integer | #> |KFASTScr |KFASTScr |integer | #> |MDI.15 |MDI.15 |integer | #> |MDI.6 |MDI.6 |integer | #> |peri_health |peri_health |integer | #> |PmEd2 |PmEd2 |integer | #> |RMomAgeU |RMomAgeU |integer | #> |SWghtLB |SWghtLB |integer | #> #> #> #> #>
    Summary of ESETA1 Information<\/caption> #>
    #> #> | | ESETA1.6 | ESETA1.15 | ESETA1.24 | ESETA1.35 | ESETA1.58 | #> |:--|:---------------|:---------------|:---------------|:----------------|:----------------| #> | |Min. :-2.8090 |Min. :-3.1010 |Min. :-2.8580 |Min. :-3.24100 |Min. :-2.47800 | #> | |1st Qu.:-0.3245 |1st Qu.:-0.4133 |1st Qu.:-0.5020 |1st Qu.:-0.56900 |1st Qu.:-0.53350 | #> | |Median : 0.3440 |Median : 0.2215 |Median : 0.1160 |Median : 0.07400 |Median : 0.08300 | #> | |Mean : 0.3201 |Mean : 0.2022 |Mean : 0.1229 |Mean : 0.08662 |Mean : 0.07949 | #> | |3rd Qu.: 0.9423 |3rd Qu.: 0.8482 |3rd Qu.: 0.7380 |3rd Qu.: 0.74625 |3rd Qu.: 0.70550 | #> | |Max. : 4.0350 |Max. : 3.4740 |Max. : 3.2840 |Max. : 3.01400 |Max. : 3.17300 | #> #> <\/td> #> <\/tr> #> <\/tbody> #> <\/table> #> #> Table: Summary of StrDif_Tot.58 Information #> #> | Min.| X1st.Qu.| Median| Mean| X3rd.Qu.| Max.| #> |------:|--------:|------:|--------:|--------:|-----:| #> | -0.497| 0.29675| 0.472| 0.489219| 0.69325| 1.448| #> [[1]] #> NULL #> #> [[2]] #> NULL"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"phase-1-confounder-adjustment","dir":"Articles","previous_headings":"","what":"PHASE 1: Confounder Adjustment","title":"Workflow: Continuous Exposure","text":"goal first phase minimize associations confounders exposure using IPTW balancing weights. strongly advise user carefully inspect weights formula ensure weights created evaluated appropriately step. first create comprehensive, full weights formulas relating exposure confounders time point using createFormulas() function (type = “full”). step creates full formulas containing measured confounding variables exposure time point, including time-invariant confounders lagged time-varying confounders. code automatically excludes time-varying confounders contemporaneous time point given decisively differentiated mediators balanced (Thoemmes & Ong, 2016), although can modified user strong reason believe concurrent variable truly confounder (see ). user wishes specify interactions confounders weights formulas, need manually create data listing . Keep mind interactions include factor variables decomposed interactions factor level. required input create full weights formulas using createFormulas() function : MSM object (e.g., “obj”) setting type = “full”. Optional inputs create full weights formulas using createFormulas() function follows. user may specify list custom formulas specifying custom list formulas, one exposure time point (e.g., “exposure.time ~ variable.time + variable +…”) formula format. recommend first running createFormulas() function without custom formulas (custom = NULL) using output model required format custom formulas. createFormulas() function automatically check custom formulas ensure correctly formatted formula exposure time point exposure dependent variable. However, user responsible ensuring custom formulas contain appropriate confounders formula type generating. Please see Customize weights formulas vignette detail customize formulas. chose create custom formulas instead use createFormulas() make automatically example. first create full formulas. function returns list formulas, one exposure time point. inspect . full formula contains time invariant confounders well lagged time-varying confounders time point. inspection important step, verify appropriate confounders present formula. inspect formulas . next step examines initial imbalance, strongly exposure relates confounder time point, measured confounders prior weighting using assessBalance() function. function draws calcBalStats() function (see Assessing Balance Time-Varying Exposure section accompanying manuscript). assessBalance() function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). required inputs using assessBalance() function conduct pre-balance testing : data (data frame, mids object, list imputed datasets dataframes wide format) MSM object (e.g., “obj”). Please see Assessing Balance Time-Varying Exposures vignette detail function calculates balance. optional inputs follows. user may specify balance_thresh, threshold(s) determining confounder balance, one two ways. * First, can provide single number value (0-1) absolute value standardized balance statistic (either correlation continuous exposures standardized group mean difference binary exposures) exposure confounders confounders considered balanced, considered imbalanced (default 0.1; Stuart, 2010). Second, users may make priori assertion confounders important others based theory existing research. case, can provide two numbers represent balance thresholds important less important confounders, respectively. user supplies two balance thresholds, must also supply list important confounders (time-varying: “variable.t”, time invariant: “variable”) imp_conf field. balance threshold specification kept consistent throughout use workflow. , recommended, provide two balancing thresholds identify income parent education important confounders relation economic strain behavior problems. create prebalance statistics . function returns list (one entry per imputed dataset, applicable), contains table exposure time point. able contains confounders time point, associated standardized balance statistics relating confounder exposure time point, user-supplied balance threshold, binary indicator whether confounder balanced. shown , can print, summarize, plot several versions balance statistics option supply save.save viewed output home directory. functions takes optional t field view balance statistics one exposure time points. t takes integer value 1 total number time points. specified, output shown exposure time points. imputed data, functions takes option field can used view balance one imputed data set. specified, output shown averaged across absolute values balance statistics imputed datasets. can useful average across imputed datasets get overall sense balance. non-imputed data, specify . can view prebalance statistics single imputed dataset (e.g., first imputed dataset), using field. Note supply t integers 1 however number time points exposure measured. example, first time point measures ESETA1 6 months corresponds t = 1. , can view prebalance statistics averaged across imputed data sets different time points specifying . can also used view balance statistics data imputed. can also summarize assessBalance() output view average remaining relation confounders exposure well summary table showing total number imbalanced confounders exposure time point. can view one imputed dataset averaged across . Averaging across imputed datasets, see xx confounders imbalanced respect economic strain exposure respective balance threshold. Lastly, can plot balance summary one time points, one imputed dataset averaged across . dotted red lines denote balance thresholds points colored labeled red denote confounders imbalanced relation respective balance thresholds. love plots depict standardized associations confounder exposure exposure time point, vertical red dashed lines indicating balance thresholds. Imbalanced confounders shown red variable name labels. goal second step create shortened, parsimonious weights formulas determining optimal IPTW weighting method successfully reduces imbalance data. First, create shorter, parsimonious weights formulas relating exposure confounders time point using createFormulas() function (type = “short”). exposure time point, formulas contain time invariant confounders well time-varying confounders t-1 lag. logic balancing confounders recent prior time point (t-1 ) may achieve balance levels distal time points, given stability many confounders time. Importantly, empirically assess relax assumption needed subsequent steps (Steps 3a-b). required input create shortened weights formulas using createFormulas() function : MSM object (e.g., ‘obj’) setting type = “short”. addition optional input outlined Step 1a, user also option specify keep_conf, list time-varying confounders (e.g., “variable.t”) always retain lagged confounders shortened formulas. user may use argument retain specific time-varying confounders otherwise excluded step occur lags greater t-1 formula. create short formulas . get list entries containing formula exposure time point. inspect make sure contain time-varying covariates lag one prior exposure time point. formulas considerably shorter full formulas. instance, 58-month exposure time point, formula contains time invariant confounders time-varying confounders 35-month time point. created shorter, simplified weights formulas, now create first round IPTW balancing weights (Thoemmes & Ong, 2016) using createWeights() function, shortened weights formulas, available weighting methods. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016), distributions can saved inspection. required inputs using createWeights() function create initial around IPTW balancing weights : MSM object (e.g, ‘obj’), complete data (data frame, mids object, list imputed datasets dataframes wide format), short formulas (see Step 2a). specify short formulas . optional inputs follows. method, provide one following methods calculating balancing weights using weightitMSM() methods validated longitudinal exposures: “cbps” (Covariate Balancing Propensity Score weighting), “gbm” (generalized boosted model), “glm” (generalized linear model; default), “super” (SuperLearner via SuperLearner package; Polley et al., 2013). information can found WeightIt documentation. begin specifying CBPS weighting method. createWeights() function can also take number additional arguments accapted weightitMSM() function (e.g., ‘criterion’, distribution’, ‘SL.library’). package defaults correspond weightIt defaults. user selects SuperLearner (“super”) method, default super learner libraries (‘SL.library’) “SL.glm” “SL.glm.interaction” alternative library can entered input createWeights function. binary exposures, “cbps” method allows specify estimand either ATE, ATT, ATC. “glm”, “super”, “bart” can specify ATE, ATT, ATC, ATO, ATM, ATOS. “gbm”, can specify ATE, ATT, ATC, ATO, ATM. default estimand binary exposures ATE. advise interested user review WeightIt documentation information additional optional arguments available weighting methods. Users option specify verbose = TRUE view information weights creation. function returns list weights objects form WeightItMSM output (entry imputed dataset appropriate). , create IPTW weights using default CBPS method. take run. Note save weights (supplying save.= TRUE custom file name createWeights() home directory initMWM()), function outputs file path use reading weights future use. can useful given weighting methods can take long time run, especially imputed datasets. previously saved CBPS weights, read instead re-creating . Given separate set weights created imputed dataset, conduct inspections imputed dataset. First, view basic statistics CBPS weights given imputed dataset. , note median weight value 0.77 (SD= 1.18) fairly extensive range 0 - 9. Next, look inside output summarize weighting process (drawing summary method weightIt, given imputed dataset. summary also provides effective sample size, sample size results applying weights original sample size, time point. Weighting can often result effective weighted sample size smaller orignal sample size something keep mind evaluating weighting methods. example, see original 1,292 sample reduced 605 upon weighting CBPS method. view distribution plot weights one imputed dataset. user option supply save.save plots home directory. shown , distribution heavy right tail (typical real-world data). right tail distribution represents individuals experienced statistically unexpected levels exposure given levels confounders. create inspect IPTW balancing weights using available methods order evaluate compare performance subsequent steps. , summarize plot averaging across imputed datasets order get sense overall performance. Example inspections first imputed dataset. shown , GLM method produces higher median 1.27 much greater range weights. GBM method produces similar mean GLM similarly large range (0-216). bart method similar median even larger range (0-945). super method produces similar median range 0-270. Next, evaluate well weights created using different weighting methods reduced imbalance using assessBalance() function. function calls calcBalStats() function using short formulas specifies balance statistics calculated using IPTW weights supplied. required inputs using assessBalance() function assess balance first round IPTW weights : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., ‘obj’), weights just created. optional inputs described Step 1b. assessBalance() function returns data frame (list) balance statistics, balance thresholds, binary balanced tag (1 = balanced, 0 = imbalanced) confounder relevant exposure time point. function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). retain optional important confounders (imp_conf) balance threshold (balance_thresh) specified earlier. first assess balance CBPS weighting method. function returns list balance statistics expsoure time point, one entry per imputed dataset (applicable). assessing balance using imputed data, can average across imputed datasets view overall summary performance method. can also examine imputed dataset individually. summarize CBPS balance statistics across imputed datasets examine balance first imputed dataset. user option supply save.save printed output home directory. Averaging across imputed datasets, find 2 imbalanced confounders remaining (35-month exposure time point) 241, median remaining correlation 0.06 maximum 0.07. can visualize imbalance love plots, averaging across imputed datasets, exposure time point (first time point shown ). can also plot balance given imputed datset. can see income 6 15 months remains imbalanced 4th (35-month) time point. can inspect balance statistics confounder relation exposure time points one individually, either averaging across imputed datasets one individually. user option supply save.save printed output home directory. , show example balance statistics first time point, averaged across imputed datasets. shown , two remaining imbalanced confounders related exposure correlation values 0.065 0.061. , assess balance weighting method comparing . summaries, identify optimal weighting method dataset, one yields best confounder balance. , can consider several criteria. note exist gold-standard, hard fast rules identifying optimal balance (especially using imputed data). However, can draw following guidance: Fewest imbalanced confounders remaining relative user-specified balance threshold(s) (summary output); Lowest median absolute balance statistic, across confounders time points, reflecting best overall attenuation confounding (summary output); Lowest maximum absolute balance statistic, across confounders time points (imputed datasets, applicable), indicating weakest remaining relation exposure confounder least balanced confounder (summary output); Reasonable effective sample size following weighting (imputed datasets, applicable), indicating reasonable power detect effects (weightiIt summary output). first three, examine summaries weighting methods. , find CBPS method fewest imbalanced confounders (2), lowest median balance statistic, lowest max balance statistic. examine fourth criterion, use weightIt summary method examine effective sample sizes (“Weighted”) compared orignal sample size (“Unweighted”) across weighting methods. just first imputed dataset. , also find CBPS method yields highest effective sample size 605. inspections, identify best performing weighting method CBPS. goal next step closely inspect balance reults best-performing weights created shortened weights formulas, add shortened formulas time-varying confounders lags > t-1 successfully balanced, create final round weights. next inspect balance produced weights created previous step best-performing weights method (.e., using SuperLearner method). , revisit assumption balancing proximal time-varying confounders (t-1) confers balance confounders distal prior time points (t- 1+). closely inspect balance CBPS weights, averaged across imputed datasets. real-world data, often difficult fully balance many confounding variables, especially across time. user find confounders remain imbalanced, can skip Step 3d. Given identified remaining imbalanced confounders, proceed Step 3b. Subsequently, update shortened formulas include time-varying confounders (t-1 +) successfully balanced full formulas, shown . , create final round weights formulas using createFormulas() function (setting type = “update” providing balance statistics bal_stats field). createFormulas() function draws user-provided balance statistics automatically identify add formulas exposure time point time-varying confounders lags greater 1 remain imbalanced weighting. function displays weights formula console message user time-varying confounders added. required input update shortened weights formulas using createFormulas() function : MSM object (e.g., “obj”), setting type = “update”, providing bal_stats balance statistics just created Step 3a. optional input detailed Step 1a. function returns list weights formulas labeled type, exposure, outcome, exposure time point. , update short formulas using balance statistics best-performing weights. inspect new formulas make sure imbalanced covariates added appropriate formulas. user option supply save.save printed output home directory. shown , income 6 15 months (“InRatioCor.6” “InRatioCor.15”) added 35-month weights formula. originally weights formula given lags greater t -1. remaining imbalance suggests achieving balance 24-month income successfully balance prior levels income. use weights formulas recreate CBPS weights effort achieve greatest reduction balance. Next, create final set balancing weights using optimal weighting method identified Step 2c updated formulas previous step using createWeights() function (method = “…’), SuperLearner method optimal weighting method identified Step 2c. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016) distributions saved home directory inspection. required inputs using createWeights() function create final round IPTW balancing weights using updated short weights formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), best-performing weights method, updated formulas (see Step 3a). optional input createWeights() function listed Step 2b. function returns list form WeightItMSM output. , use updated formulas CPBS weighting method create final round IPTW balancing weights. inspect final weights imputed dataset. user option supply save.save printed plot output home directory. shown , weights median value 0.77 range 0-9, . next step trim (.e., winsorize) final set weights eliminate heavy right tail distribution using trimWeights() function. function draws Weightit package (Griefer, 2023) plots summarizes trimmed weights. function outputs list trimmed weights either single nested list (labeled “0” data data frame format) nested lists imputed dataset (data imputed). required input trimWeights() function final weights just created. optional input allows user specify quantile value (0-1; default 0.95) weights replaced weight value quantile, reduce heavy right tail. , use default 95th percentile trimming weights. trim final weights . function returns list weights objects, containing trimmed weights, form weightitMSM output ( one entry per imputed dataset, applicable). entry also specifies quantile value weights trimmed. inspect trimmed weights one imputed datasets . user option supply save.save plots home directory. shown , weights still median value 0.77 smaller standard deviation range now goes 0-4. create trimmed weights using two quantile values + /- ~0.3 previously chosen quantile value, order conduct recommended sensitivity analyses subsequent steps. first create weights 92nd quantile value. Trimming 92nd quantile preserves median 0.77 even smaller standard deviation range. 98th quantile value. Trimming instead 98th quantile produces larger standard deviation range. find comparable descriptive statistics sets weights, upper range value varying quantile cutoff. assess consequences differences (e.g., different ranges) subsequent steps. created trimmed final set IPTW balancing weights, next step conduct final evaluation well reduce imbalance. assess performance final trimmed untrimmed weights using assessBalance() function. required inputs using assessBalance() function assess final, trimmed weights achieve balance full formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), weights. optional inputs assessBalance() function detailed Step 1b. , assess balance trimmed weights. Assess balance trimmed weights Summarize inspect. shown , trimmed weights result one imbalanced confounder relation exposure 15 months effective sample size 719. assess balance untrimmed weights Summarize inspect see non-trimmed weights result imbalanced confounders effective sample size 611. scenario, given , trimmed weights, imbalanced confounder (income 6 months) related exposure -0.051 trimmed weights yield higher effective sample size, proceed trimmed weights. summarize final balance statistics, averaging across imputed datasets. user option supply save.save plot output home directory. outcome modeling step (Step 5), users option include remaining imbalanced confounders time invariant covariates final outcome model. case, manually list imbalanced confounders time invariant assign covariates. Subsequently, also assess balance weights trimmed two additional quantile values assess whether final balance assessment sensitive trim value. first assess balance weights trimmed 93rd quantile value. , similarly find income 6 months imbalanced respect exposure 15 months (albeit slighter stronger correlation main analyses). next assess balance weights trimmed 98th quantile value. , find remaining imbalanced confounders (similar untrimmed results).","code":"type <- \"full\" full_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(full_formulas) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 6, the full formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 15, the full formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 24, the full formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + WndNbrhood.6 + IBRAttn.6 + IBRAttn.15 + B18Raw.6 + B18Raw.15 + HOMEETA1.6 + HOMEETA1.15 + InRatioCor.6 + InRatioCor.15 + CORTB.6 + CORTB.15 + ESETA1.6 + ESETA1.15 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 35, the full formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + WndNbrhood.6 + WndNbrhood.24 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.6 + ESETA1.15 + ESETA1.24 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 58, the full formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + RHasSO.35 + WndNbrhood.6 + WndNbrhood.24 + WndNbrhood.35 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + HOMEETA1.35 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + InRatioCor.35 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + EARS_TJo.35 + LESMnPos.24 + LESMnPos.35 + LESMnNeg.24 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.6 + ESETA1.15 + ESETA1.24 + ESETA1.35 balance_thresh <- c(0.05, 0.1) imp_conf <- c(\"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"PmEd2\") prebalance_stats <- assessBalance(obj = obj, data = data, balance_thresh = balance_thresh, imp_conf = imp_conf, save.out = save.out) print(prebalance_stats, i = 1, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.13324 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13865 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.06481 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.17598 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20129 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.14101 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23888 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.18058 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.11428 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.08223 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01624 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07892 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10536 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.0588 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13681 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.0364 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.09405 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15808 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09514 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10405 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.00731 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04693 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.04867 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.0182 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.02272 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02042 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.14314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.31012 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 for imputation (1) print(prebalance_stats, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.12646 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13395 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.0525 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.18314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20776 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.12948 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23456 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.17153 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.10139 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.07479 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01536 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07441 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10334 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.05769 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13942 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.04196 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.10162 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15135 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09639 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10475 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.0135 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04304 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.05533 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.00539 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.01557 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02454 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.15074 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.30943 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 Averaging Across Imputed Datasets summary(prebalance_stats, i = 1, save.out = save.out) #> USER ALERT: For imputation 1: As shown below, 55 out of 241 (22.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 summary(prebalance_stats, save.out = save.out) #> USER ALERT: Averaging across imputated datasets: As shown below, 60 out of 241 (24.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 15 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 12 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaged Across Imputed Datasets plot(prebalance_stats, i = 1, t = 1, save.out = save.out) plot(prebalance_stats, t = 1, save.out = save.out) type <- \"short\" short_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(short_formulas) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 6, the short formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 15, the short formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 24, the short formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 35, the short formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 58, the short formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 formulas <- short_formulas method <- \"cbps\" weights.cbps <- createWeights(obj = obj, data = data, method = method, formulas = formulas, verbose = TRUE, maxit = 1, # just for testing to speed up --will remove save.out = save.out) #> initial value 0.903706 #> final value 0.463025 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> initial value 0.585184 #> final value 0.381680 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). # weights.cbps <- readRDS('file_path_to_saved_weights.rds') print(weights.cbps, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). summary(weights.cbps[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 plot(weights.cbps, i = 1, save.out = save.out) method <- \"glm\" weights.glm <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.glm, i = 1) #> #> For imputation 1 and the `glm` weighting method, the median weight value is 1.27 (SD = 10.03; range = 0-271). summary(weights.glm[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 plot(weights.glm, i = 1, save.out = save.out) # method <- \"gbm\" # # weights.gbm <- createWeights(obj = obj, # data = data, # method = method, # formulas = formulas, # save.out = save.out) # # print(weights.gbm, # i = 1) # # summary(weights.gbm[[1]]) # # plot(weights.gbm, # i = 1, # save.out = save.out) method <- \"bart\" weights.bart <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.bart, i = 1) #> #> For imputation 1 and the `bart` weighting method, the median weight value is 1.22 (SD = 20.29; range = 0-698). summary(weights.bart[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 plot(weights.bart, i = 1, save.out = save.out) method <- \"super\" weights.super <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) #> Loading required package: nnls #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning: glm.fit: algorithm did not converge #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases print(weights.super, i = 1) #> #> For imputation 1 and the `super` weighting method, the median weight value is 1.27 (SD = 9.99; range = 0-270). summary(weights.super[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 plot(weights.super, i = 1, save.out = save.out) weights <- weights.cbps balance_stats.cbps <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.cbps, i = 1, save.out = save.out) #> USER ALERT: For imputation 1 using `cbps` weighting method: As shown below, 4 out of 241 (1.7%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.10): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 using `cbps` plot(balance_stats.cbps, t = 4, save.out = save.out) plot(balance_stats.cbps, t = 4, i = 1, save.out = save.out) print(balance_stats.cbps, t = 4, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.35 | state_1 | 0.0123 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.00736 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.01172 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.00143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.00951 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.0046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.04146 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.0365 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.01453 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.01442 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.05725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.06506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.0196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.0097 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.01158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.02051 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.03071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.00585 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.01947 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.05972 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.01793 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.03624 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.00796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.00653 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.02427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.00113 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.00166 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.01609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.00345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.01669 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.02717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.06637 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.05935 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.04559 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.05173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.03977 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.0018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.05331 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.0305 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.03406 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.03733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.01687 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.02261 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.01452 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.03428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.02188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.00991 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.01514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.0321 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.08449 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.0035 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 4 Averaging Across Imputed Datasets weights <- weights.glm balance_stats.glm <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) # weights <- weights.gbm # # balance_stats.gbm <- assessBalance(data = data, # obj = obj, # weights = weights, # imp_conf = imp_conf, # balance_thresh = balance_thresh, # save.out = save.out) weights <- weights.bart balance_stats.bart <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) weights <- weights.super balance_stats.super <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.glm, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `glm` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `glm` # summary(balance_stats.gbm, # save.out = save.out) summary(balance_stats.bart, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `bart` weighting method: As shown below, 30 out of 241 (12.4%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.11 (max: 0.21): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 6 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 3 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `bart` summary(balance_stats.super, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `super` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `super` summary(weights.cbps[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 567.0924 summary(weights.glm[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 82.74434 # summary(weights.gbm[[1]])[[1]][6] summary(weights.bart[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 25.79567 summary(weights.super[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 83.0753 print(balance_stats.cbps) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | -0.015841 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | 0.049787 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | 0.021011 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | -0.033318 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | -0.017018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | 0.026148 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | 0.001702 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.016403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | 0.072699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.013994 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.020431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.02928 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.01127 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.012702 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | 0.003785 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | 0.00374 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | -0.005058 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | -0.002294 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.030219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | -0.004567 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.02189 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | -0.027643 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.012046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.026237 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.013558 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | -0.035748 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | -0.003855 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | -0.022816 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | state_1 | 0.036174 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.012204 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | 0.004854 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.042683 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.025346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | 0.004899 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.029365 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.037699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.041403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.035278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | 0.001438 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | -0.011183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.010747 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.049295 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.033142 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.044428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | -0.016749 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.000614 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | 0.020957 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.027651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | -0.050611 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.069412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.026007 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | -0.011565 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | 0.003636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | 0.011326 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.007437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | -0.015918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | -0.038498 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.045319 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | -0.02082 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | 0.004196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.019396 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.033228 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.008945 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.045347 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | 0.010691 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.043475 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | state_1 | 0.006241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | BioDadInHH2_1 | -0.035814 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmAge2 | -0.017532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmBlac2_1 | 0.015892 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | TcBlac2_1 | 0.030768 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmMrSt2_1 | 0.062369 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmEd2 | 0.00653 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | KFASTScr | 0.032766 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RMomAgeU | 0.032742 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_1 | 0.00826 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_2 | 0.025263 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_3 | -0.029311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_4 | -0.020001 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_5 | 0.057299 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_1 | -0.032929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_2 | 0.008234 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_3 | 0.000591 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_4 | 0.022929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SWghtLB | -0.008564 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SurpPreg_1 | -0.037616 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_1 | 0.011311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_2 | -0.000889 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_3 | 0.002071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_1 | -0.011027 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_2 | 0.012054 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | peri_health | -0.040005 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | caregiv_health | 0.002807 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | gov_assist | 0.017188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.6 | 0.015602 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.15 | 0.043926 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.6 | 0.02066 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.15 | 0.002145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.6_1 | -0.027332 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.15_1 | 0.000214 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | WndNbrhood.6 | -0.000298 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.6 | 0.015692 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.15 | 0.004147 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.6 | 0.093979 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.15 | -0.003861 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.6 | 0.006479 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.15 | 0.016107 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.6 | -0.043574 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.15 | -0.002573 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.6 | 0.040583 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.15 | -0.007733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.6 | 0.038786 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.15 | 0.016269 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | state_1 | 0.012297 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.007364 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.011717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.001426 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.009506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.004603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.041457 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.036504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.014532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.014423 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.057253 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.065055 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.019599 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.009704 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.011584 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.020508 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.030714 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.005852 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.019471 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.059723 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.017933 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.036241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.007962 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.006528 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.024272 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.001126 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.001664 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.016089 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002003 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.003452 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.016688 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.027168 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.066367 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.059345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.045594 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023004 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.051726 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.039767 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.001796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.053306 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.030505 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.034064 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.037334 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.016869 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.022606 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.014519 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.034283 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.021881 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.009914 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.015144 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.032104 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.084487 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.003504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | state_1 | 0.046707 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | BioDadInHH2_1 | -0.032556 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmAge2 | -0.011158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmBlac2_1 | 0.045969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | TcBlac2_1 | 0.062286 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmMrSt2_1 | -0.02112 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmEd2 | 0.003704 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | KFASTScr | 0.001911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RMomAgeU | 0.042917 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_1 | 0.001836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_2 | 0.011966 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_3 | -0.000588 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_4 | -0.031635 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_5 | 0.03408 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_1 | -0.020218 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_2 | 0.024941 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_3 | 0.002759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_4 | 0.002021 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SWghtLB | -0.022619 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SurpPreg_1 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_1 | -0.044081 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_2 | 0.003514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_3 | -0.008938 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_1 | 0.010825 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_2 | -0.012394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | peri_health | -0.019048 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | caregiv_health | -0.001676 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | gov_assist | 0.01349 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.6 | 0.028656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.15 | -0.02358 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.24 | -0.017473 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.6 | 0.035384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.15 | -0.069623 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.6_1 | 0.066159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.15_1 | 0.005755 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.24_1 | -0.025656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.35_1 | -0.013387 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.6 | -0.042805 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.24 | -0.006412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.35 | 0.003724 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.6 | -0.04382 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.15 | -0.01477 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.24 | -0.048202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.6 | 0.03759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.15 | 0.078278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.24 | 0.051997 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.6 | -0.030969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.15 | 0.004609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.24 | -0.047911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.35 | -0.07415 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.6 | -0.036626 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.15 | -0.046776 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.24 | -0.044794 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.35 | -0.021949 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.6 | 0.024018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.15 | -0.008257 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.24 | 0.004373 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.24 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.35 | 0.023288 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.24 | -0.019433 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.35 | -0.016828 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.24 | 0.027503 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.35 | 0.054757 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | StrDif_Tot.35 | 0.022732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | fscore.35 | -0.059882 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.6 | 0.039731 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.15 | 0.031636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.24 | 0.014185 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.35 | 0.019732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points Averaging Across Imputed Datasets plot(balance_stats.cbps, t = 4, save.out = save.out) type <- \"update\" bal_stats <- balance_stats.cbps updated_formulas <- createFormulas(obj = obj, type = type, bal_stats = bal_stats, save.out = save.out) print(updated_formulas, save.out = save.out) #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 6, the update formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 15, the update formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 24, the update formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 35, the update formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 58, the update formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 formulas <- updated_formulas method <- \"cbps\" final_weights <- createWeights(data = data, obj = obj, method = method, formulas = formulas, max.it = 1, # testing only save.out = save.out) print(final_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.77 (SD = 1.18; range = 0-9). plot(final_weights, i = 1, save.out = save.out) quantile <- 0.95 weights <- final_weights trim_weights <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 95th quantile, the median weight value is 0.77 (SD = 0.93; range = 0-4). plot(trim_weights, i = 1, save.out = save.out) quantile <- 0.92 trim_weights.s1 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s1, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 92th quantile, the median weight value is 0.77 (SD = 0.82; range = 0-3). plot(trim_weights.s1, i = 1, save.out = save.out) quantile <- 0.98 trim_weights.s2 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s2, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 98th quantile, the median weight value is 0.77 (SD = 1.06; range = 0-5). plot(trim_weights.s2, i = 1, save.out = save.out) weights <- trim_weights final_balance_stats_trim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats_trim, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.018002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.01641 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.009705 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.017384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.017685 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00618 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.036545 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.020649 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.005992 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.001056 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.0065 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.004525 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.006969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.011918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.003678 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.003725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.006049 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.008359 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.000996 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.008394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.010939 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.009158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.005918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.007173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.017437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.000413 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.008989 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.015211 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.010964 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.01114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.018068 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.017711 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.002143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.025159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.024603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.047661 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.005651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.03469 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets summary(trim_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 weights <- final_weights final_balance_stats_untrim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_untrim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.07): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(final_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` plot(final_balance_stats_trim, t = 2, save.out = save.out) # covariates <- c(\"list_imbalanced_ti_conf\") weights <- trim_weights.s1 final_balance_stats.s1 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s1, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 3 out of 241 (1.2%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats.s1, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.02248 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.02024 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.01219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.0244 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.02265 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00906 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.04175 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.02587 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.01202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.00346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.00661 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.00912 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.00351 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.01245 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.00579 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.00296 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.00995 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.00817 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.00333 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.01431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.01323 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.0114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.00775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.0125 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.02183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.00145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.01119 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.01836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.01106 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.016 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.0208 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.02262 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.0034 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.02608 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.02883 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.06024 | 0.05 | 0 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.00713 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.0427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets weights <- trim_weights.s2 final_balance_stats.s2 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s2, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps`"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-1-create-full-weights-formulas-conduct-pre-balance-checking","dir":"Articles","previous_headings":"","what":"STEP 1: Create Full Weights Formulas & Conduct Pre-Balance Checking","title":"Workflow: Continuous Exposure","text":"first create comprehensive, full weights formulas relating exposure confounders time point using createFormulas() function (type = “full”). step creates full formulas containing measured confounding variables exposure time point, including time-invariant confounders lagged time-varying confounders. code automatically excludes time-varying confounders contemporaneous time point given decisively differentiated mediators balanced (Thoemmes & Ong, 2016), although can modified user strong reason believe concurrent variable truly confounder (see ). user wishes specify interactions confounders weights formulas, need manually create data listing . Keep mind interactions include factor variables decomposed interactions factor level. required input create full weights formulas using createFormulas() function : MSM object (e.g., “obj”) setting type = “full”. Optional inputs create full weights formulas using createFormulas() function follows. user may specify list custom formulas specifying custom list formulas, one exposure time point (e.g., “exposure.time ~ variable.time + variable +…”) formula format. recommend first running createFormulas() function without custom formulas (custom = NULL) using output model required format custom formulas. createFormulas() function automatically check custom formulas ensure correctly formatted formula exposure time point exposure dependent variable. However, user responsible ensuring custom formulas contain appropriate confounders formula type generating. Please see Customize weights formulas vignette detail customize formulas. chose create custom formulas instead use createFormulas() make automatically example. first create full formulas. function returns list formulas, one exposure time point. inspect . full formula contains time invariant confounders well lagged time-varying confounders time point. inspection important step, verify appropriate confounders present formula. inspect formulas . next step examines initial imbalance, strongly exposure relates confounder time point, measured confounders prior weighting using assessBalance() function. function draws calcBalStats() function (see Assessing Balance Time-Varying Exposure section accompanying manuscript). assessBalance() function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). required inputs using assessBalance() function conduct pre-balance testing : data (data frame, mids object, list imputed datasets dataframes wide format) MSM object (e.g., “obj”). Please see Assessing Balance Time-Varying Exposures vignette detail function calculates balance. optional inputs follows. user may specify balance_thresh, threshold(s) determining confounder balance, one two ways. * First, can provide single number value (0-1) absolute value standardized balance statistic (either correlation continuous exposures standardized group mean difference binary exposures) exposure confounders confounders considered balanced, considered imbalanced (default 0.1; Stuart, 2010). Second, users may make priori assertion confounders important others based theory existing research. case, can provide two numbers represent balance thresholds important less important confounders, respectively. user supplies two balance thresholds, must also supply list important confounders (time-varying: “variable.t”, time invariant: “variable”) imp_conf field. balance threshold specification kept consistent throughout use workflow. , recommended, provide two balancing thresholds identify income parent education important confounders relation economic strain behavior problems. create prebalance statistics . function returns list (one entry per imputed dataset, applicable), contains table exposure time point. able contains confounders time point, associated standardized balance statistics relating confounder exposure time point, user-supplied balance threshold, binary indicator whether confounder balanced. shown , can print, summarize, plot several versions balance statistics option supply save.save viewed output home directory. functions takes optional t field view balance statistics one exposure time points. t takes integer value 1 total number time points. specified, output shown exposure time points. imputed data, functions takes option field can used view balance one imputed data set. specified, output shown averaged across absolute values balance statistics imputed datasets. can useful average across imputed datasets get overall sense balance. non-imputed data, specify . can view prebalance statistics single imputed dataset (e.g., first imputed dataset), using field. Note supply t integers 1 however number time points exposure measured. example, first time point measures ESETA1 6 months corresponds t = 1. , can view prebalance statistics averaged across imputed data sets different time points specifying . can also used view balance statistics data imputed. can also summarize assessBalance() output view average remaining relation confounders exposure well summary table showing total number imbalanced confounders exposure time point. can view one imputed dataset averaged across . Averaging across imputed datasets, see xx confounders imbalanced respect economic strain exposure respective balance threshold. Lastly, can plot balance summary one time points, one imputed dataset averaged across . dotted red lines denote balance thresholds points colored labeled red denote confounders imbalanced relation respective balance thresholds. love plots depict standardized associations confounder exposure exposure time point, vertical red dashed lines indicating balance thresholds. Imbalanced confounders shown red variable name labels.","code":"type <- \"full\" full_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(full_formulas) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 6, the full formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 15, the full formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 24, the full formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + WndNbrhood.6 + IBRAttn.6 + IBRAttn.15 + B18Raw.6 + B18Raw.15 + HOMEETA1.6 + HOMEETA1.15 + InRatioCor.6 + InRatioCor.15 + CORTB.6 + CORTB.15 + ESETA1.6 + ESETA1.15 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 35, the full formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + WndNbrhood.6 + WndNbrhood.24 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.6 + ESETA1.15 + ESETA1.24 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 58, the full formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + RHasSO.35 + WndNbrhood.6 + WndNbrhood.24 + WndNbrhood.35 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + HOMEETA1.35 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + InRatioCor.35 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + EARS_TJo.35 + LESMnPos.24 + LESMnPos.35 + LESMnNeg.24 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.6 + ESETA1.15 + ESETA1.24 + ESETA1.35 balance_thresh <- c(0.05, 0.1) imp_conf <- c(\"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"PmEd2\") prebalance_stats <- assessBalance(obj = obj, data = data, balance_thresh = balance_thresh, imp_conf = imp_conf, save.out = save.out) print(prebalance_stats, i = 1, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.13324 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13865 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.06481 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.17598 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20129 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.14101 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23888 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.18058 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.11428 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.08223 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01624 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07892 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10536 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.0588 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13681 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.0364 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.09405 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15808 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09514 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10405 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.00731 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04693 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.04867 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.0182 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.02272 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02042 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.14314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.31012 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 for imputation (1) print(prebalance_stats, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.12646 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13395 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.0525 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.18314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20776 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.12948 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23456 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.17153 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.10139 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.07479 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01536 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07441 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10334 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.05769 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13942 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.04196 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.10162 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15135 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09639 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10475 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.0135 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04304 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.05533 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.00539 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.01557 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02454 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.15074 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.30943 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 Averaging Across Imputed Datasets summary(prebalance_stats, i = 1, save.out = save.out) #> USER ALERT: For imputation 1: As shown below, 55 out of 241 (22.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 summary(prebalance_stats, save.out = save.out) #> USER ALERT: Averaging across imputated datasets: As shown below, 60 out of 241 (24.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 15 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 12 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaged Across Imputed Datasets plot(prebalance_stats, i = 1, t = 1, save.out = save.out) plot(prebalance_stats, t = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"a--create-full-weights-formulas-at-each-exposure-time-point","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"1a. Create Full Weights Formulas at each Exposure Time Point","title":"Workflow: Continuous Exposure","text":"first create comprehensive, full weights formulas relating exposure confounders time point using createFormulas() function (type = “full”). step creates full formulas containing measured confounding variables exposure time point, including time-invariant confounders lagged time-varying confounders. code automatically excludes time-varying confounders contemporaneous time point given decisively differentiated mediators balanced (Thoemmes & Ong, 2016), although can modified user strong reason believe concurrent variable truly confounder (see ). user wishes specify interactions confounders weights formulas, need manually create data listing . Keep mind interactions include factor variables decomposed interactions factor level. required input create full weights formulas using createFormulas() function : MSM object (e.g., “obj”) setting type = “full”. Optional inputs create full weights formulas using createFormulas() function follows. user may specify list custom formulas specifying custom list formulas, one exposure time point (e.g., “exposure.time ~ variable.time + variable +…”) formula format. recommend first running createFormulas() function without custom formulas (custom = NULL) using output model required format custom formulas. createFormulas() function automatically check custom formulas ensure correctly formatted formula exposure time point exposure dependent variable. However, user responsible ensuring custom formulas contain appropriate confounders formula type generating. Please see Customize weights formulas vignette detail customize formulas. chose create custom formulas instead use createFormulas() make automatically example. first create full formulas. function returns list formulas, one exposure time point. inspect . full formula contains time invariant confounders well lagged time-varying confounders time point. inspection important step, verify appropriate confounders present formula. inspect formulas .","code":"type <- \"full\" full_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(full_formulas) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 6, the full formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 15, the full formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 24, the full formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + WndNbrhood.6 + IBRAttn.6 + IBRAttn.15 + B18Raw.6 + B18Raw.15 + HOMEETA1.6 + HOMEETA1.15 + InRatioCor.6 + InRatioCor.15 + CORTB.6 + CORTB.15 + ESETA1.6 + ESETA1.15 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 35, the full formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + WndNbrhood.6 + WndNbrhood.24 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.6 + ESETA1.15 + ESETA1.24 #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 58, the full formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + SAAmylase.15 + SAAmylase.24 + MDI.6 + MDI.15 + RHasSO.6 + RHasSO.15 + RHasSO.24 + RHasSO.35 + WndNbrhood.6 + WndNbrhood.24 + WndNbrhood.35 + IBRAttn.6 + IBRAttn.15 + IBRAttn.24 + B18Raw.6 + B18Raw.15 + B18Raw.24 + HOMEETA1.6 + HOMEETA1.15 + HOMEETA1.24 + HOMEETA1.35 + InRatioCor.6 + InRatioCor.15 + InRatioCor.24 + InRatioCor.35 + CORTB.6 + CORTB.15 + CORTB.24 + EARS_TJo.24 + EARS_TJo.35 + LESMnPos.24 + LESMnPos.35 + LESMnNeg.24 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.6 + ESETA1.15 + ESETA1.24 + ESETA1.35"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"b--conduct-exploratory-pre-balance-assessment","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"1b. Conduct Exploratory Pre-Balance Assessment","title":"Workflow: Continuous Exposure","text":"next step examines initial imbalance, strongly exposure relates confounder time point, measured confounders prior weighting using assessBalance() function. function draws calcBalStats() function (see Assessing Balance Time-Varying Exposure section accompanying manuscript). assessBalance() function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). required inputs using assessBalance() function conduct pre-balance testing : data (data frame, mids object, list imputed datasets dataframes wide format) MSM object (e.g., “obj”). Please see Assessing Balance Time-Varying Exposures vignette detail function calculates balance. optional inputs follows. user may specify balance_thresh, threshold(s) determining confounder balance, one two ways. * First, can provide single number value (0-1) absolute value standardized balance statistic (either correlation continuous exposures standardized group mean difference binary exposures) exposure confounders confounders considered balanced, considered imbalanced (default 0.1; Stuart, 2010). Second, users may make priori assertion confounders important others based theory existing research. case, can provide two numbers represent balance thresholds important less important confounders, respectively. user supplies two balance thresholds, must also supply list important confounders (time-varying: “variable.t”, time invariant: “variable”) imp_conf field. balance threshold specification kept consistent throughout use workflow. , recommended, provide two balancing thresholds identify income parent education important confounders relation economic strain behavior problems. create prebalance statistics . function returns list (one entry per imputed dataset, applicable), contains table exposure time point. able contains confounders time point, associated standardized balance statistics relating confounder exposure time point, user-supplied balance threshold, binary indicator whether confounder balanced. shown , can print, summarize, plot several versions balance statistics option supply save.save viewed output home directory. functions takes optional t field view balance statistics one exposure time points. t takes integer value 1 total number time points. specified, output shown exposure time points. imputed data, functions takes option field can used view balance one imputed data set. specified, output shown averaged across absolute values balance statistics imputed datasets. can useful average across imputed datasets get overall sense balance. non-imputed data, specify . can view prebalance statistics single imputed dataset (e.g., first imputed dataset), using field. Note supply t integers 1 however number time points exposure measured. example, first time point measures ESETA1 6 months corresponds t = 1. , can view prebalance statistics averaged across imputed data sets different time points specifying . can also used view balance statistics data imputed. can also summarize assessBalance() output view average remaining relation confounders exposure well summary table showing total number imbalanced confounders exposure time point. can view one imputed dataset averaged across . Averaging across imputed datasets, see xx confounders imbalanced respect economic strain exposure respective balance threshold. Lastly, can plot balance summary one time points, one imputed dataset averaged across . dotted red lines denote balance thresholds points colored labeled red denote confounders imbalanced relation respective balance thresholds. love plots depict standardized associations confounder exposure exposure time point, vertical red dashed lines indicating balance thresholds. Imbalanced confounders shown red variable name labels.","code":"balance_thresh <- c(0.05, 0.1) imp_conf <- c(\"InRatioCor.6\", \"InRatioCor.15\", \"InRatioCor.24\", \"InRatioCor.35\", \"PmEd2\") prebalance_stats <- assessBalance(obj = obj, data = data, balance_thresh = balance_thresh, imp_conf = imp_conf, save.out = save.out) print(prebalance_stats, i = 1, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.13324 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13865 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.06481 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.17598 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20129 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.14101 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23888 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.18058 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.11428 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.08223 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01624 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07892 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10536 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.0588 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13681 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.0364 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.09405 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15808 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09514 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10405 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.00731 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04693 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.04867 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.0182 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.02272 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02042 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.14314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.31012 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 for imputation (1) print(prebalance_stats, t = 1, save.out = save.out) #> #> +----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | 0.12646 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | -0.13395 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | -0.0525 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | 0.18314 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | 0.20776 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | -0.12948 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | -0.23456 | 0.05 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.17153 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | -0.10139 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.07479 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.01536 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.07441 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.10334 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.05769 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | -0.13942 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | -0.04196 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | 0.10162 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | 0.15135 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.09639 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | 0.10475 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.0135 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | 0.04304 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.05533 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.00539 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.01557 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | 0.02454 | 0.1 | 1 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | 0.15074 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | 0.30943 | 0.1 | 0 | #> +----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 1 Averaging Across Imputed Datasets summary(prebalance_stats, i = 1, save.out = save.out) #> USER ALERT: For imputation 1: As shown below, 55 out of 241 (22.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 summary(prebalance_stats, save.out = save.out) #> USER ALERT: Averaging across imputated datasets: As shown below, 60 out of 241 (24.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.31): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 15 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 12 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 11 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 8 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaged Across Imputed Datasets plot(prebalance_stats, i = 1, t = 1, save.out = save.out) plot(prebalance_stats, t = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-2-create-simplified-weights-formulas-determine-optimal-weighting-method","dir":"Articles","previous_headings":"","what":"STEP 2: Create Simplified Weights Formulas & Determine Optimal Weighting Method","title":"Workflow: Continuous Exposure","text":"goal second step create shortened, parsimonious weights formulas determining optimal IPTW weighting method successfully reduces imbalance data. First, create shorter, parsimonious weights formulas relating exposure confounders time point using createFormulas() function (type = “short”). exposure time point, formulas contain time invariant confounders well time-varying confounders t-1 lag. logic balancing confounders recent prior time point (t-1 ) may achieve balance levels distal time points, given stability many confounders time. Importantly, empirically assess relax assumption needed subsequent steps (Steps 3a-b). required input create shortened weights formulas using createFormulas() function : MSM object (e.g., ‘obj’) setting type = “short”. addition optional input outlined Step 1a, user also option specify keep_conf, list time-varying confounders (e.g., “variable.t”) always retain lagged confounders shortened formulas. user may use argument retain specific time-varying confounders otherwise excluded step occur lags greater t-1 formula. create short formulas . get list entries containing formula exposure time point. inspect make sure contain time-varying covariates lag one prior exposure time point. formulas considerably shorter full formulas. instance, 58-month exposure time point, formula contains time invariant confounders time-varying confounders 35-month time point. created shorter, simplified weights formulas, now create first round IPTW balancing weights (Thoemmes & Ong, 2016) using createWeights() function, shortened weights formulas, available weighting methods. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016), distributions can saved inspection. required inputs using createWeights() function create initial around IPTW balancing weights : MSM object (e.g, ‘obj’), complete data (data frame, mids object, list imputed datasets dataframes wide format), short formulas (see Step 2a). specify short formulas . optional inputs follows. method, provide one following methods calculating balancing weights using weightitMSM() methods validated longitudinal exposures: “cbps” (Covariate Balancing Propensity Score weighting), “gbm” (generalized boosted model), “glm” (generalized linear model; default), “super” (SuperLearner via SuperLearner package; Polley et al., 2013). information can found WeightIt documentation. begin specifying CBPS weighting method. createWeights() function can also take number additional arguments accapted weightitMSM() function (e.g., ‘criterion’, distribution’, ‘SL.library’). package defaults correspond weightIt defaults. user selects SuperLearner (“super”) method, default super learner libraries (‘SL.library’) “SL.glm” “SL.glm.interaction” alternative library can entered input createWeights function. binary exposures, “cbps” method allows specify estimand either ATE, ATT, ATC. “glm”, “super”, “bart” can specify ATE, ATT, ATC, ATO, ATM, ATOS. “gbm”, can specify ATE, ATT, ATC, ATO, ATM. default estimand binary exposures ATE. advise interested user review WeightIt documentation information additional optional arguments available weighting methods. Users option specify verbose = TRUE view information weights creation. function returns list weights objects form WeightItMSM output (entry imputed dataset appropriate). , create IPTW weights using default CBPS method. take run. Note save weights (supplying save.= TRUE custom file name createWeights() home directory initMWM()), function outputs file path use reading weights future use. can useful given weighting methods can take long time run, especially imputed datasets. previously saved CBPS weights, read instead re-creating . Given separate set weights created imputed dataset, conduct inspections imputed dataset. First, view basic statistics CBPS weights given imputed dataset. , note median weight value 0.77 (SD= 1.18) fairly extensive range 0 - 9. Next, look inside output summarize weighting process (drawing summary method weightIt, given imputed dataset. summary also provides effective sample size, sample size results applying weights original sample size, time point. Weighting can often result effective weighted sample size smaller orignal sample size something keep mind evaluating weighting methods. example, see original 1,292 sample reduced 605 upon weighting CBPS method. view distribution plot weights one imputed dataset. user option supply save.save plots home directory. shown , distribution heavy right tail (typical real-world data). right tail distribution represents individuals experienced statistically unexpected levels exposure given levels confounders. create inspect IPTW balancing weights using available methods order evaluate compare performance subsequent steps. , summarize plot averaging across imputed datasets order get sense overall performance. Example inspections first imputed dataset. shown , GLM method produces higher median 1.27 much greater range weights. GBM method produces similar mean GLM similarly large range (0-216). bart method similar median even larger range (0-945). super method produces similar median range 0-270. Next, evaluate well weights created using different weighting methods reduced imbalance using assessBalance() function. function calls calcBalStats() function using short formulas specifies balance statistics calculated using IPTW weights supplied. required inputs using assessBalance() function assess balance first round IPTW weights : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., ‘obj’), weights just created. optional inputs described Step 1b. assessBalance() function returns data frame (list) balance statistics, balance thresholds, binary balanced tag (1 = balanced, 0 = imbalanced) confounder relevant exposure time point. function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). retain optional important confounders (imp_conf) balance threshold (balance_thresh) specified earlier. first assess balance CBPS weighting method. function returns list balance statistics expsoure time point, one entry per imputed dataset (applicable). assessing balance using imputed data, can average across imputed datasets view overall summary performance method. can also examine imputed dataset individually. summarize CBPS balance statistics across imputed datasets examine balance first imputed dataset. user option supply save.save printed output home directory. Averaging across imputed datasets, find 2 imbalanced confounders remaining (35-month exposure time point) 241, median remaining correlation 0.06 maximum 0.07. can visualize imbalance love plots, averaging across imputed datasets, exposure time point (first time point shown ). can also plot balance given imputed datset. can see income 6 15 months remains imbalanced 4th (35-month) time point. can inspect balance statistics confounder relation exposure time points one individually, either averaging across imputed datasets one individually. user option supply save.save printed output home directory. , show example balance statistics first time point, averaged across imputed datasets. shown , two remaining imbalanced confounders related exposure correlation values 0.065 0.061. , assess balance weighting method comparing . summaries, identify optimal weighting method dataset, one yields best confounder balance. , can consider several criteria. note exist gold-standard, hard fast rules identifying optimal balance (especially using imputed data). However, can draw following guidance: Fewest imbalanced confounders remaining relative user-specified balance threshold(s) (summary output); Lowest median absolute balance statistic, across confounders time points, reflecting best overall attenuation confounding (summary output); Lowest maximum absolute balance statistic, across confounders time points (imputed datasets, applicable), indicating weakest remaining relation exposure confounder least balanced confounder (summary output); Reasonable effective sample size following weighting (imputed datasets, applicable), indicating reasonable power detect effects (weightiIt summary output). first three, examine summaries weighting methods. , find CBPS method fewest imbalanced confounders (2), lowest median balance statistic, lowest max balance statistic. examine fourth criterion, use weightIt summary method examine effective sample sizes (“Weighted”) compared orignal sample size (“Unweighted”) across weighting methods. just first imputed dataset. , also find CBPS method yields highest effective sample size 605. inspections, identify best performing weighting method CBPS.","code":"type <- \"short\" short_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(short_formulas) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 6, the short formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 15, the short formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 24, the short formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 35, the short formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 58, the short formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 formulas <- short_formulas method <- \"cbps\" weights.cbps <- createWeights(obj = obj, data = data, method = method, formulas = formulas, verbose = TRUE, maxit = 1, # just for testing to speed up --will remove save.out = save.out) #> initial value 0.903706 #> final value 0.463025 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> initial value 0.585184 #> final value 0.381680 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). # weights.cbps <- readRDS('file_path_to_saved_weights.rds') print(weights.cbps, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). summary(weights.cbps[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 plot(weights.cbps, i = 1, save.out = save.out) method <- \"glm\" weights.glm <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.glm, i = 1) #> #> For imputation 1 and the `glm` weighting method, the median weight value is 1.27 (SD = 10.03; range = 0-271). summary(weights.glm[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 plot(weights.glm, i = 1, save.out = save.out) # method <- \"gbm\" # # weights.gbm <- createWeights(obj = obj, # data = data, # method = method, # formulas = formulas, # save.out = save.out) # # print(weights.gbm, # i = 1) # # summary(weights.gbm[[1]]) # # plot(weights.gbm, # i = 1, # save.out = save.out) method <- \"bart\" weights.bart <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.bart, i = 1) #> #> For imputation 1 and the `bart` weighting method, the median weight value is 1.22 (SD = 20.29; range = 0-698). summary(weights.bart[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 plot(weights.bart, i = 1, save.out = save.out) method <- \"super\" weights.super <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) #> Loading required package: nnls #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning: glm.fit: algorithm did not converge #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases print(weights.super, i = 1) #> #> For imputation 1 and the `super` weighting method, the median weight value is 1.27 (SD = 9.99; range = 0-270). summary(weights.super[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 plot(weights.super, i = 1, save.out = save.out) weights <- weights.cbps balance_stats.cbps <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.cbps, i = 1, save.out = save.out) #> USER ALERT: For imputation 1 using `cbps` weighting method: As shown below, 4 out of 241 (1.7%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.10): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 using `cbps` plot(balance_stats.cbps, t = 4, save.out = save.out) plot(balance_stats.cbps, t = 4, i = 1, save.out = save.out) print(balance_stats.cbps, t = 4, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.35 | state_1 | 0.0123 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.00736 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.01172 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.00143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.00951 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.0046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.04146 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.0365 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.01453 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.01442 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.05725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.06506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.0196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.0097 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.01158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.02051 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.03071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.00585 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.01947 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.05972 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.01793 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.03624 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.00796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.00653 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.02427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.00113 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.00166 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.01609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.00345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.01669 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.02717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.06637 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.05935 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.04559 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.05173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.03977 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.0018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.05331 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.0305 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.03406 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.03733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.01687 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.02261 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.01452 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.03428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.02188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.00991 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.01514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.0321 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.08449 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.0035 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 4 Averaging Across Imputed Datasets weights <- weights.glm balance_stats.glm <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) # weights <- weights.gbm # # balance_stats.gbm <- assessBalance(data = data, # obj = obj, # weights = weights, # imp_conf = imp_conf, # balance_thresh = balance_thresh, # save.out = save.out) weights <- weights.bart balance_stats.bart <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) weights <- weights.super balance_stats.super <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.glm, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `glm` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `glm` # summary(balance_stats.gbm, # save.out = save.out) summary(balance_stats.bart, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `bart` weighting method: As shown below, 30 out of 241 (12.4%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.11 (max: 0.21): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 6 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 3 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `bart` summary(balance_stats.super, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `super` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `super` summary(weights.cbps[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 567.0924 summary(weights.glm[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 82.74434 # summary(weights.gbm[[1]])[[1]][6] summary(weights.bart[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 25.79567 summary(weights.super[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 83.0753"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"a--create-simplified-weights-formulas","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"2a. Create Simplified Weights Formulas","title":"Workflow: Continuous Exposure","text":"First, create shorter, parsimonious weights formulas relating exposure confounders time point using createFormulas() function (type = “short”). exposure time point, formulas contain time invariant confounders well time-varying confounders t-1 lag. logic balancing confounders recent prior time point (t-1 ) may achieve balance levels distal time points, given stability many confounders time. Importantly, empirically assess relax assumption needed subsequent steps (Steps 3a-b). required input create shortened weights formulas using createFormulas() function : MSM object (e.g., ‘obj’) setting type = “short”. addition optional input outlined Step 1a, user also option specify keep_conf, list time-varying confounders (e.g., “variable.t”) always retain lagged confounders shortened formulas. user may use argument retain specific time-varying confounders otherwise excluded step occur lags greater t-1 formula. create short formulas . get list entries containing formula exposure time point. inspect make sure contain time-varying covariates lag one prior exposure time point. formulas considerably shorter full formulas. instance, 58-month exposure time point, formula contains time invariant confounders time-varying confounders 35-month time point.","code":"type <- \"short\" short_formulas <- createFormulas(obj = obj, type = type, save.out = save.out) print(short_formulas) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 6, the short formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 15, the short formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 24, the short formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 35, the short formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 58, the short formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"b--create-iptw-balancing-weights-using-multiple-weighting-methods","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"2b. Create IPTW Balancing Weights Using Multiple Weighting Methods","title":"Workflow: Continuous Exposure","text":"created shorter, simplified weights formulas, now create first round IPTW balancing weights (Thoemmes & Ong, 2016) using createWeights() function, shortened weights formulas, available weighting methods. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016), distributions can saved inspection. required inputs using createWeights() function create initial around IPTW balancing weights : MSM object (e.g, ‘obj’), complete data (data frame, mids object, list imputed datasets dataframes wide format), short formulas (see Step 2a). specify short formulas . optional inputs follows. method, provide one following methods calculating balancing weights using weightitMSM() methods validated longitudinal exposures: “cbps” (Covariate Balancing Propensity Score weighting), “gbm” (generalized boosted model), “glm” (generalized linear model; default), “super” (SuperLearner via SuperLearner package; Polley et al., 2013). information can found WeightIt documentation. begin specifying CBPS weighting method. createWeights() function can also take number additional arguments accapted weightitMSM() function (e.g., ‘criterion’, distribution’, ‘SL.library’). package defaults correspond weightIt defaults. user selects SuperLearner (“super”) method, default super learner libraries (‘SL.library’) “SL.glm” “SL.glm.interaction” alternative library can entered input createWeights function. binary exposures, “cbps” method allows specify estimand either ATE, ATT, ATC. “glm”, “super”, “bart” can specify ATE, ATT, ATC, ATO, ATM, ATOS. “gbm”, can specify ATE, ATT, ATC, ATO, ATM. default estimand binary exposures ATE. advise interested user review WeightIt documentation information additional optional arguments available weighting methods. Users option specify verbose = TRUE view information weights creation. function returns list weights objects form WeightItMSM output (entry imputed dataset appropriate). , create IPTW weights using default CBPS method. take run. Note save weights (supplying save.= TRUE custom file name createWeights() home directory initMWM()), function outputs file path use reading weights future use. can useful given weighting methods can take long time run, especially imputed datasets. previously saved CBPS weights, read instead re-creating . Given separate set weights created imputed dataset, conduct inspections imputed dataset. First, view basic statistics CBPS weights given imputed dataset. , note median weight value 0.77 (SD= 1.18) fairly extensive range 0 - 9. Next, look inside output summarize weighting process (drawing summary method weightIt, given imputed dataset. summary also provides effective sample size, sample size results applying weights original sample size, time point. Weighting can often result effective weighted sample size smaller orignal sample size something keep mind evaluating weighting methods. example, see original 1,292 sample reduced 605 upon weighting CBPS method. view distribution plot weights one imputed dataset. user option supply save.save plots home directory. shown , distribution heavy right tail (typical real-world data). right tail distribution represents individuals experienced statistically unexpected levels exposure given levels confounders. create inspect IPTW balancing weights using available methods order evaluate compare performance subsequent steps. , summarize plot averaging across imputed datasets order get sense overall performance. Example inspections first imputed dataset. shown , GLM method produces higher median 1.27 much greater range weights. GBM method produces similar mean GLM similarly large range (0-216). bart method similar median even larger range (0-945). super method produces similar median range 0-270.","code":"formulas <- short_formulas method <- \"cbps\" weights.cbps <- createWeights(obj = obj, data = data, method = method, formulas = formulas, verbose = TRUE, maxit = 1, # just for testing to speed up --will remove save.out = save.out) #> initial value 0.903706 #> final value 0.463025 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> initial value 0.585184 #> final value 0.381680 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). # weights.cbps <- readRDS('file_path_to_saved_weights.rds') print(weights.cbps, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). summary(weights.cbps[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 plot(weights.cbps, i = 1, save.out = save.out) method <- \"glm\" weights.glm <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.glm, i = 1) #> #> For imputation 1 and the `glm` weighting method, the median weight value is 1.27 (SD = 10.03; range = 0-271). summary(weights.glm[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 plot(weights.glm, i = 1, save.out = save.out) # method <- \"gbm\" # # weights.gbm <- createWeights(obj = obj, # data = data, # method = method, # formulas = formulas, # save.out = save.out) # # print(weights.gbm, # i = 1) # # summary(weights.gbm[[1]]) # # plot(weights.gbm, # i = 1, # save.out = save.out) method <- \"bart\" weights.bart <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.bart, i = 1) #> #> For imputation 1 and the `bart` weighting method, the median weight value is 1.22 (SD = 20.29; range = 0-698). summary(weights.bart[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 plot(weights.bart, i = 1, save.out = save.out) method <- \"super\" weights.super <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) #> Loading required package: nnls #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning: glm.fit: algorithm did not converge #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases print(weights.super, i = 1) #> #> For imputation 1 and the `super` weighting method, the median weight value is 1.27 (SD = 9.99; range = 0-270). summary(weights.super[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 plot(weights.super, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"cbps","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"CBPS","title":"Workflow: Continuous Exposure","text":", create IPTW weights using default CBPS method. take run. Note save weights (supplying save.= TRUE custom file name createWeights() home directory initMWM()), function outputs file path use reading weights future use. can useful given weighting methods can take long time run, especially imputed datasets. previously saved CBPS weights, read instead re-creating . Given separate set weights created imputed dataset, conduct inspections imputed dataset. First, view basic statistics CBPS weights given imputed dataset. , note median weight value 0.77 (SD= 1.18) fairly extensive range 0 - 9. Next, look inside output summarize weighting process (drawing summary method weightIt, given imputed dataset. summary also provides effective sample size, sample size results applying weights original sample size, time point. Weighting can often result effective weighted sample size smaller orignal sample size something keep mind evaluating weighting methods. example, see original 1,292 sample reduced 605 upon weighting CBPS method. view distribution plot weights one imputed dataset. user option supply save.save plots home directory. shown , distribution heavy right tail (typical real-world data). right tail distribution represents individuals experienced statistically unexpected levels exposure given levels confounders. create inspect IPTW balancing weights using available methods order evaluate compare performance subsequent steps. , summarize plot averaging across imputed datasets order get sense overall performance. Example inspections first imputed dataset.","code":"weights.cbps <- createWeights(obj = obj, data = data, method = method, formulas = formulas, verbose = TRUE, maxit = 1, # just for testing to speed up --will remove save.out = save.out) #> initial value 0.903706 #> final value 0.463025 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> initial value 0.585184 #> final value 0.381680 #> stopped after 2 iterations #> Warning: The optimziation failed to converge; try again with a higher value of #> `maxit`. #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). # weights.cbps <- readRDS('file_path_to_saved_weights.rds') print(weights.cbps, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.68 (SD = 1.01; range = 0-11). summary(weights.cbps[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 10.69 #> #> - Units with the 5 most extreme weights: #> #> 798 1145 737 1235 877 #> all 7.7683 8.696 9.0943 9.1878 10.69 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.131 0.654 0.418 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 567.09 plot(weights.cbps, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"glm","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"GLM","title":"Workflow: Continuous Exposure","text":"shown , GLM method produces higher median 1.27 much greater range weights.","code":"method <- \"glm\" weights.glm <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.glm, i = 1) #> #> For imputation 1 and the `glm` weighting method, the median weight value is 1.27 (SD = 10.03; range = 0-271). summary(weights.glm[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 271.3462 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.1877 58.3054 63.4626 178.9983 271.3462 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.824 0.96 1.144 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 82.74 plot(weights.glm, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"gbm","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"GBM","title":"Workflow: Continuous Exposure","text":"GBM method produces similar mean GLM similarly large range (0-216).","code":"# method <- \"gbm\" # # weights.gbm <- createWeights(obj = obj, # data = data, # method = method, # formulas = formulas, # save.out = save.out) # # print(weights.gbm, # i = 1) # # summary(weights.gbm[[1]]) # # plot(weights.gbm, # i = 1, # save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"bart","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Bart","title":"Workflow: Continuous Exposure","text":"bart method similar median even larger range (0-945).","code":"method <- \"bart\" weights.bart <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) print(weights.bart, i = 1) #> #> For imputation 1 and the `bart` weighting method, the median weight value is 1.22 (SD = 20.29; range = 0-698). summary(weights.bart[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 698.1747 #> #> - Units with the 5 most extreme weights: #> #> 30 1235 591 475 1145 #> all 53.8862 65.6455 102.4181 117.0061 698.1747 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 7.009 1.034 1.602 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 25.8 plot(weights.bart, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"super","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Super","title":"Workflow: Continuous Exposure","text":"super method produces similar median range 0-270.","code":"method <- \"super\" weights.super <- createWeights(obj = obj, data = data, method = method, formulas = formulas, save.out = save.out) #> Loading required package: nnls #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning: glm.fit: algorithm did not converge #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases #> Warning in predict.lm(object, newdata, se.fit, scale = 1, type = if (type == : #> prediction from rank-deficient fit; attr(*, \"non-estim\") has doubtful cases print(weights.super, i = 1) #> #> For imputation 1 and the `super` weighting method, the median weight value is 1.27 (SD = 9.99; range = 0-270). summary(weights.super[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 270.0915 #> #> - Units with the 5 most extreme weights: #> #> 1030 475 697 1145 591 #> all 52.0024 58.0163 63.2837 178.6145 270.0915 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 3.816 0.959 1.141 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 83.08 plot(weights.super, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"c--assess-all-weighting-methods-to-determine-optimal-method","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"2c. Assess All Weighting Methods to Determine Optimal Method","title":"Workflow: Continuous Exposure","text":"Next, evaluate well weights created using different weighting methods reduced imbalance using assessBalance() function. function calls calcBalStats() function using short formulas specifies balance statistics calculated using IPTW weights supplied. required inputs using assessBalance() function assess balance first round IPTW weights : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., ‘obj’), weights just created. optional inputs described Step 1b. assessBalance() function returns data frame (list) balance statistics, balance thresholds, binary balanced tag (1 = balanced, 0 = imbalanced) confounder relevant exposure time point. function outputs balance statistics (correlations continuous exposures standardized mean differences binary exposures) relating exposure time point confounders table well plots. function also provides summary balance statistics averaging across time points (imputed datasets supplied). retain optional important confounders (imp_conf) balance threshold (balance_thresh) specified earlier. first assess balance CBPS weighting method. function returns list balance statistics expsoure time point, one entry per imputed dataset (applicable). assessing balance using imputed data, can average across imputed datasets view overall summary performance method. can also examine imputed dataset individually. summarize CBPS balance statistics across imputed datasets examine balance first imputed dataset. user option supply save.save printed output home directory. Averaging across imputed datasets, find 2 imbalanced confounders remaining (35-month exposure time point) 241, median remaining correlation 0.06 maximum 0.07. can visualize imbalance love plots, averaging across imputed datasets, exposure time point (first time point shown ). can also plot balance given imputed datset. can see income 6 15 months remains imbalanced 4th (35-month) time point. can inspect balance statistics confounder relation exposure time points one individually, either averaging across imputed datasets one individually. user option supply save.save printed output home directory. , show example balance statistics first time point, averaged across imputed datasets. shown , two remaining imbalanced confounders related exposure correlation values 0.065 0.061. , assess balance weighting method comparing . summaries, identify optimal weighting method dataset, one yields best confounder balance. , can consider several criteria. note exist gold-standard, hard fast rules identifying optimal balance (especially using imputed data). However, can draw following guidance: Fewest imbalanced confounders remaining relative user-specified balance threshold(s) (summary output); Lowest median absolute balance statistic, across confounders time points, reflecting best overall attenuation confounding (summary output); Lowest maximum absolute balance statistic, across confounders time points (imputed datasets, applicable), indicating weakest remaining relation exposure confounder least balanced confounder (summary output); Reasonable effective sample size following weighting (imputed datasets, applicable), indicating reasonable power detect effects (weightiIt summary output). first three, examine summaries weighting methods. , find CBPS method fewest imbalanced confounders (2), lowest median balance statistic, lowest max balance statistic. examine fourth criterion, use weightIt summary method examine effective sample sizes (“Weighted”) compared orignal sample size (“Unweighted”) across weighting methods. just first imputed dataset. , also find CBPS method yields highest effective sample size 605. inspections, identify best performing weighting method CBPS.","code":"weights <- weights.cbps balance_stats.cbps <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.cbps, i = 1, save.out = save.out) #> USER ALERT: For imputation 1 using `cbps` weighting method: As shown below, 4 out of 241 (1.7%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.10): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 using `cbps` plot(balance_stats.cbps, t = 4, save.out = save.out) plot(balance_stats.cbps, t = 4, i = 1, save.out = save.out) print(balance_stats.cbps, t = 4, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.35 | state_1 | 0.0123 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.00736 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.01172 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.00143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.00951 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.0046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.04146 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.0365 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.01453 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.01442 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.05725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.06506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.0196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.0097 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.01158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.02051 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.03071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.00585 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.01947 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.05972 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.01793 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.03624 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.00796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.00653 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.02427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.00113 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.00166 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.01609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.00345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.01669 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.02717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.06637 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.05935 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.04559 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.05173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.03977 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.0018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.05331 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.0305 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.03406 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.03733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.01687 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.02261 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.01452 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.03428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.02188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.00991 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.01514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.0321 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.08449 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.0035 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 4 Averaging Across Imputed Datasets weights <- weights.glm balance_stats.glm <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) # weights <- weights.gbm # # balance_stats.gbm <- assessBalance(data = data, # obj = obj, # weights = weights, # imp_conf = imp_conf, # balance_thresh = balance_thresh, # save.out = save.out) weights <- weights.bart balance_stats.bart <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) weights <- weights.super balance_stats.super <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.glm, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `glm` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `glm` # summary(balance_stats.gbm, # save.out = save.out) summary(balance_stats.bart, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `bart` weighting method: As shown below, 30 out of 241 (12.4%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.11 (max: 0.21): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 6 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 3 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `bart` summary(balance_stats.super, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `super` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `super` summary(weights.cbps[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 567.0924 summary(weights.glm[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 82.74434 # summary(weights.gbm[[1]])[[1]][6] summary(weights.bart[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 25.79567 summary(weights.super[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 83.0753"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"cbps-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"CBPS","title":"Workflow: Continuous Exposure","text":"first assess balance CBPS weighting method. function returns list balance statistics expsoure time point, one entry per imputed dataset (applicable). assessing balance using imputed data, can average across imputed datasets view overall summary performance method. can also examine imputed dataset individually. summarize CBPS balance statistics across imputed datasets examine balance first imputed dataset. user option supply save.save printed output home directory. Averaging across imputed datasets, find 2 imbalanced confounders remaining (35-month exposure time point) 241, median remaining correlation 0.06 maximum 0.07. can visualize imbalance love plots, averaging across imputed datasets, exposure time point (first time point shown ). can also plot balance given imputed datset. can see income 6 15 months remains imbalanced 4th (35-month) time point. can inspect balance statistics confounder relation exposure time points one individually, either averaging across imputed datasets one individually. user option supply save.save printed output home directory. , show example balance statistics first time point, averaged across imputed datasets. shown , two remaining imbalanced confounders related exposure correlation values 0.065 0.061. , assess balance weighting method comparing .","code":"weights <- weights.cbps balance_stats.cbps <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.cbps, i = 1, save.out = save.out) #> USER ALERT: For imputation 1 using `cbps` weighting method: As shown below, 4 out of 241 (1.7%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.10): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates for imputation 1 using `cbps` plot(balance_stats.cbps, t = 4, save.out = save.out) plot(balance_stats.cbps, t = 4, i = 1, save.out = save.out) print(balance_stats.cbps, t = 4, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.35 | state_1 | 0.0123 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.00736 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.01172 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.00143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.00951 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.0046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.04146 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.0365 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.01453 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.01442 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.05725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.06506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.0196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.0097 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.01158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.02051 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.03071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.00585 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.01947 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.05972 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.01793 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.03624 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.00796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.00653 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.02427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.00113 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.00166 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.01609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.00345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.01669 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.02717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.06637 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.05935 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.04559 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.05173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.03977 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.0018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.05331 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.0305 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.03406 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.03733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.01687 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.02261 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.01452 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.03428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.02188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.00991 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.01514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.0321 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.08449 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.0035 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 4 Averaging Across Imputed Datasets"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"glm-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"GLM","title":"Workflow: Continuous Exposure","text":"","code":"weights <- weights.glm balance_stats.glm <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"gbm-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"GBM","title":"Workflow: Continuous Exposure","text":"","code":"# weights <- weights.gbm # # balance_stats.gbm <- assessBalance(data = data, # obj = obj, # weights = weights, # imp_conf = imp_conf, # balance_thresh = balance_thresh, # save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"bart-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Bart","title":"Workflow: Continuous Exposure","text":"","code":"weights <- weights.bart balance_stats.bart <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"super-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Super","title":"Workflow: Continuous Exposure","text":"summaries, identify optimal weighting method dataset, one yields best confounder balance. , can consider several criteria. note exist gold-standard, hard fast rules identifying optimal balance (especially using imputed data). However, can draw following guidance: Fewest imbalanced confounders remaining relative user-specified balance threshold(s) (summary output); Lowest median absolute balance statistic, across confounders time points, reflecting best overall attenuation confounding (summary output); Lowest maximum absolute balance statistic, across confounders time points (imputed datasets, applicable), indicating weakest remaining relation exposure confounder least balanced confounder (summary output); Reasonable effective sample size following weighting (imputed datasets, applicable), indicating reasonable power detect effects (weightiIt summary output). first three, examine summaries weighting methods. , find CBPS method fewest imbalanced confounders (2), lowest median balance statistic, lowest max balance statistic. examine fourth criterion, use weightIt summary method examine effective sample sizes (“Weighted”) compared orignal sample size (“Unweighted”) across weighting methods. just first imputed dataset. , also find CBPS method yields highest effective sample size 605. inspections, identify best performing weighting method CBPS.","code":"weights <- weights.super balance_stats.super <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(balance_stats.cbps, save.out = save.out) #> Averaging across imputed datasets using cbps weighting method. #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 0 out of 241 (0.0%) covariates across time points remain imbalanced: #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(balance_stats.glm, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `glm` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `glm` # summary(balance_stats.gbm, # save.out = save.out) summary(balance_stats.bart, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `bart` weighting method: As shown below, 30 out of 241 (12.4%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.11 (max: 0.21): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 6 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 14 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 3 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `bart` summary(balance_stats.super, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `super` weighting method: As shown below, 31 out of 241 (12.9%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.13 (max: 0.29): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 7 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 18 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 2 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `super` summary(weights.cbps[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 567.0924 summary(weights.glm[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 82.74434 # summary(weights.gbm[[1]])[[1]][6] summary(weights.bart[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.00000 #> Weighted 25.79567 summary(weights.super[[1]])[[1]][6] #> $effective.sample.size #> Total #> Unweighted 1292.0000 #> Weighted 83.0753"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-3-create-updated-formulas-re-specify-weights-using-optimal-weighting-method","dir":"Articles","previous_headings":"","what":"STEP 3: Create Updated Formulas & Re-Specify Weights Using Optimal Weighting Method","title":"Workflow: Continuous Exposure","text":"goal next step closely inspect balance reults best-performing weights created shortened weights formulas, add shortened formulas time-varying confounders lags > t-1 successfully balanced, create final round weights. next inspect balance produced weights created previous step best-performing weights method (.e., using SuperLearner method). , revisit assumption balancing proximal time-varying confounders (t-1) confers balance confounders distal prior time points (t- 1+). closely inspect balance CBPS weights, averaged across imputed datasets. real-world data, often difficult fully balance many confounding variables, especially across time. user find confounders remain imbalanced, can skip Step 3d. Given identified remaining imbalanced confounders, proceed Step 3b. Subsequently, update shortened formulas include time-varying confounders (t-1 +) successfully balanced full formulas, shown . , create final round weights formulas using createFormulas() function (setting type = “update” providing balance statistics bal_stats field). createFormulas() function draws user-provided balance statistics automatically identify add formulas exposure time point time-varying confounders lags greater 1 remain imbalanced weighting. function displays weights formula console message user time-varying confounders added. required input update shortened weights formulas using createFormulas() function : MSM object (e.g., “obj”), setting type = “update”, providing bal_stats balance statistics just created Step 3a. optional input detailed Step 1a. function returns list weights formulas labeled type, exposure, outcome, exposure time point. , update short formulas using balance statistics best-performing weights. inspect new formulas make sure imbalanced covariates added appropriate formulas. user option supply save.save printed output home directory. shown , income 6 15 months (“InRatioCor.6” “InRatioCor.15”) added 35-month weights formula. originally weights formula given lags greater t -1. remaining imbalance suggests achieving balance 24-month income successfully balance prior levels income. use weights formulas recreate CBPS weights effort achieve greatest reduction balance. Next, create final set balancing weights using optimal weighting method identified Step 2c updated formulas previous step using createWeights() function (method = “…’), SuperLearner method optimal weighting method identified Step 2c. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016) distributions saved home directory inspection. required inputs using createWeights() function create final round IPTW balancing weights using updated short weights formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), best-performing weights method, updated formulas (see Step 3a). optional input createWeights() function listed Step 2b. function returns list form WeightItMSM output. , use updated formulas CPBS weighting method create final round IPTW balancing weights. inspect final weights imputed dataset. user option supply save.save printed plot output home directory. shown , weights median value 0.77 range 0-9, . next step trim (.e., winsorize) final set weights eliminate heavy right tail distribution using trimWeights() function. function draws Weightit package (Griefer, 2023) plots summarizes trimmed weights. function outputs list trimmed weights either single nested list (labeled “0” data data frame format) nested lists imputed dataset (data imputed). required input trimWeights() function final weights just created. optional input allows user specify quantile value (0-1; default 0.95) weights replaced weight value quantile, reduce heavy right tail. , use default 95th percentile trimming weights. trim final weights . function returns list weights objects, containing trimmed weights, form weightitMSM output ( one entry per imputed dataset, applicable). entry also specifies quantile value weights trimmed. inspect trimmed weights one imputed datasets . user option supply save.save plots home directory. shown , weights still median value 0.77 smaller standard deviation range now goes 0-4. create trimmed weights using two quantile values + /- ~0.3 previously chosen quantile value, order conduct recommended sensitivity analyses subsequent steps. first create weights 92nd quantile value. Trimming 92nd quantile preserves median 0.77 even smaller standard deviation range. 98th quantile value. Trimming instead 98th quantile produces larger standard deviation range. find comparable descriptive statistics sets weights, upper range value varying quantile cutoff. assess consequences differences (e.g., different ranges) subsequent steps.","code":"print(balance_stats.cbps) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | -0.015841 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | 0.049787 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | 0.021011 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | -0.033318 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | -0.017018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | 0.026148 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | 0.001702 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.016403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | 0.072699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.013994 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.020431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.02928 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.01127 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.012702 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | 0.003785 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | 0.00374 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | -0.005058 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | -0.002294 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.030219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | -0.004567 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.02189 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | -0.027643 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.012046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.026237 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.013558 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | -0.035748 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | -0.003855 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | -0.022816 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | state_1 | 0.036174 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.012204 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | 0.004854 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.042683 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.025346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | 0.004899 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.029365 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.037699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.041403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.035278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | 0.001438 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | -0.011183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.010747 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.049295 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.033142 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.044428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | -0.016749 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.000614 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | 0.020957 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.027651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | -0.050611 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.069412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.026007 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | -0.011565 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | 0.003636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | 0.011326 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.007437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | -0.015918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | -0.038498 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.045319 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | -0.02082 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | 0.004196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.019396 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.033228 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.008945 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.045347 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | 0.010691 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.043475 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | state_1 | 0.006241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | BioDadInHH2_1 | -0.035814 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmAge2 | -0.017532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmBlac2_1 | 0.015892 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | TcBlac2_1 | 0.030768 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmMrSt2_1 | 0.062369 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmEd2 | 0.00653 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | KFASTScr | 0.032766 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RMomAgeU | 0.032742 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_1 | 0.00826 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_2 | 0.025263 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_3 | -0.029311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_4 | -0.020001 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_5 | 0.057299 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_1 | -0.032929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_2 | 0.008234 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_3 | 0.000591 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_4 | 0.022929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SWghtLB | -0.008564 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SurpPreg_1 | -0.037616 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_1 | 0.011311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_2 | -0.000889 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_3 | 0.002071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_1 | -0.011027 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_2 | 0.012054 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | peri_health | -0.040005 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | caregiv_health | 0.002807 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | gov_assist | 0.017188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.6 | 0.015602 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.15 | 0.043926 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.6 | 0.02066 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.15 | 0.002145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.6_1 | -0.027332 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.15_1 | 0.000214 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | WndNbrhood.6 | -0.000298 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.6 | 0.015692 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.15 | 0.004147 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.6 | 0.093979 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.15 | -0.003861 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.6 | 0.006479 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.15 | 0.016107 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.6 | -0.043574 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.15 | -0.002573 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.6 | 0.040583 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.15 | -0.007733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.6 | 0.038786 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.15 | 0.016269 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | state_1 | 0.012297 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.007364 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.011717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.001426 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.009506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.004603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.041457 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.036504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.014532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.014423 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.057253 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.065055 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.019599 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.009704 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.011584 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.020508 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.030714 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.005852 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.019471 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.059723 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.017933 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.036241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.007962 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.006528 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.024272 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.001126 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.001664 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.016089 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002003 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.003452 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.016688 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.027168 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.066367 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.059345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.045594 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023004 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.051726 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.039767 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.001796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.053306 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.030505 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.034064 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.037334 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.016869 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.022606 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.014519 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.034283 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.021881 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.009914 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.015144 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.032104 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.084487 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.003504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | state_1 | 0.046707 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | BioDadInHH2_1 | -0.032556 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmAge2 | -0.011158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmBlac2_1 | 0.045969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | TcBlac2_1 | 0.062286 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmMrSt2_1 | -0.02112 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmEd2 | 0.003704 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | KFASTScr | 0.001911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RMomAgeU | 0.042917 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_1 | 0.001836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_2 | 0.011966 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_3 | -0.000588 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_4 | -0.031635 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_5 | 0.03408 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_1 | -0.020218 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_2 | 0.024941 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_3 | 0.002759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_4 | 0.002021 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SWghtLB | -0.022619 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SurpPreg_1 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_1 | -0.044081 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_2 | 0.003514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_3 | -0.008938 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_1 | 0.010825 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_2 | -0.012394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | peri_health | -0.019048 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | caregiv_health | -0.001676 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | gov_assist | 0.01349 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.6 | 0.028656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.15 | -0.02358 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.24 | -0.017473 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.6 | 0.035384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.15 | -0.069623 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.6_1 | 0.066159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.15_1 | 0.005755 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.24_1 | -0.025656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.35_1 | -0.013387 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.6 | -0.042805 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.24 | -0.006412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.35 | 0.003724 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.6 | -0.04382 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.15 | -0.01477 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.24 | -0.048202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.6 | 0.03759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.15 | 0.078278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.24 | 0.051997 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.6 | -0.030969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.15 | 0.004609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.24 | -0.047911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.35 | -0.07415 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.6 | -0.036626 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.15 | -0.046776 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.24 | -0.044794 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.35 | -0.021949 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.6 | 0.024018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.15 | -0.008257 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.24 | 0.004373 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.24 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.35 | 0.023288 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.24 | -0.019433 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.35 | -0.016828 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.24 | 0.027503 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.35 | 0.054757 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | StrDif_Tot.35 | 0.022732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | fscore.35 | -0.059882 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.6 | 0.039731 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.15 | 0.031636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.24 | 0.014185 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.35 | 0.019732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points Averaging Across Imputed Datasets plot(balance_stats.cbps, t = 4, save.out = save.out) type <- \"update\" bal_stats <- balance_stats.cbps updated_formulas <- createFormulas(obj = obj, type = type, bal_stats = bal_stats, save.out = save.out) print(updated_formulas, save.out = save.out) #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 6, the update formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 15, the update formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 24, the update formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 35, the update formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 58, the update formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35 formulas <- updated_formulas method <- \"cbps\" final_weights <- createWeights(data = data, obj = obj, method = method, formulas = formulas, max.it = 1, # testing only save.out = save.out) print(final_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.77 (SD = 1.18; range = 0-9). plot(final_weights, i = 1, save.out = save.out) quantile <- 0.95 weights <- final_weights trim_weights <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 95th quantile, the median weight value is 0.77 (SD = 0.93; range = 0-4). plot(trim_weights, i = 1, save.out = save.out) quantile <- 0.92 trim_weights.s1 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s1, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 92th quantile, the median weight value is 0.77 (SD = 0.82; range = 0-3). plot(trim_weights.s1, i = 1, save.out = save.out) quantile <- 0.98 trim_weights.s2 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s2, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 98th quantile, the median weight value is 0.77 (SD = 1.06; range = 0-5). plot(trim_weights.s2, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"a--examine-balance-of-optimal-weighting-method","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"3a. Examine Balance of Optimal Weighting Method","title":"Workflow: Continuous Exposure","text":"next inspect balance produced weights created previous step best-performing weights method (.e., using SuperLearner method). , revisit assumption balancing proximal time-varying confounders (t-1) confers balance confounders distal prior time points (t- 1+). closely inspect balance CBPS weights, averaged across imputed datasets. real-world data, often difficult fully balance many confounding variables, especially across time. user find confounders remain imbalanced, can skip Step 3d. Given identified remaining imbalanced confounders, proceed Step 3b.","code":"print(balance_stats.cbps) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.6 | state_1 | -0.015841 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | BioDadInHH2_1 | 0.049787 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmAge2 | 0.021011 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmBlac2_1 | -0.033318 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | TcBlac2_1 | -0.017018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmMrSt2_1 | 0.026148 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | PmEd2 | 0.001702 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | KFASTScr | -0.016403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RMomAgeU | 0.072699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_1 | -0.013994 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_2 | -0.020431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_3 | 0.02928 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_4 | 0.01127 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | RHealth_5 | 0.012702 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_1 | 0.003785 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_2 | 0.00374 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_3 | -0.005058 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | HomeOwnd_4 | -0.002294 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SWghtLB | -0.030219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SurpPreg_1 | -0.004567 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_1 | 0.02189 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_2 | -0.027643 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | SmokTotl_3 | 0.012046 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_1 | -0.026237 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | DrnkFreq_2 | 0.013558 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | peri_health | -0.035748 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | caregiv_health | -0.003855 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.6 | gov_assist | -0.022816 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | state_1 | 0.036174 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.012204 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | 0.004854 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.042683 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.025346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | 0.004899 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.029365 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.037699 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.041403 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.035278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | 0.001438 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | -0.011183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.010747 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.049295 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.033142 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.044428 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | -0.016749 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.000614 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | 0.020957 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.027651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | -0.050611 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.069412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.026007 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | -0.011565 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | 0.003636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | 0.011326 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.007437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | -0.015918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | -0.038498 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.045319 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | -0.02082 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | 0.004196 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.019396 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.033228 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.008945 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.045347 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | 0.010691 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.043475 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | state_1 | 0.006241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | BioDadInHH2_1 | -0.035814 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmAge2 | -0.017532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmBlac2_1 | 0.015892 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | TcBlac2_1 | 0.030768 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmMrSt2_1 | 0.062369 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | PmEd2 | 0.00653 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | KFASTScr | 0.032766 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RMomAgeU | 0.032742 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_1 | 0.00826 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_2 | 0.025263 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_3 | -0.029311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_4 | -0.020001 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHealth_5 | 0.057299 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_1 | -0.032929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_2 | 0.008234 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_3 | 0.000591 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HomeOwnd_4 | 0.022929 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SWghtLB | -0.008564 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SurpPreg_1 | -0.037616 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_1 | 0.011311 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_2 | -0.000889 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SmokTotl_3 | 0.002071 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_1 | -0.011027 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | DrnkFreq_2 | 0.012054 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | peri_health | -0.040005 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | caregiv_health | 0.002807 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | gov_assist | 0.017188 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.6 | 0.015602 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | SAAmylase.15 | 0.043926 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.6 | 0.02066 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | MDI.15 | 0.002145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.6_1 | -0.027332 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | RHasSO.15_1 | 0.000214 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | WndNbrhood.6 | -0.000298 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.6 | 0.015692 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | IBRAttn.15 | 0.004147 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.6 | 0.093979 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | B18Raw.15 | -0.003861 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.6 | 0.006479 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | HOMEETA1.15 | 0.016107 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.6 | -0.043574 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | InRatioCor.15 | -0.002573 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.6 | 0.040583 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | CORTB.15 | -0.007733 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.6 | 0.038786 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.24 | ESETA1.15 | 0.016269 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | state_1 | 0.012297 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | BioDadInHH2_1 | -0.007364 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmAge2 | -0.011717 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmBlac2_1 | -0.001426 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | TcBlac2_1 | -0.009506 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmMrSt2_1 | 0.004603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | PmEd2 | -0.041457 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | KFASTScr | -0.036504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RMomAgeU | 0.014532 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_1 | -0.014423 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_2 | -0.057253 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_3 | 0.065055 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_4 | 0.019599 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHealth_5 | 0.009704 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_1 | 0.011584 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_2 | 0.020508 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_3 | -0.030714 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HomeOwnd_4 | 0.005852 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SWghtLB | -0.019471 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SurpPreg_1 | 0.059723 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_1 | 0.017933 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_2 | -0.036241 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SmokTotl_3 | 0.0324 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_1 | -0.007962 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | DrnkFreq_2 | 0.006528 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | peri_health | 0.024272 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | caregiv_health | 0.001126 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | gov_assist | 0.001664 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.6 | -0.02835 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.15 | -0.016089 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | SAAmylase.24 | 0.002003 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.6 | -0.003452 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | MDI.15 | 0.016688 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.6_1 | 0.027168 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.15_1 | 0.066367 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | RHasSO.24_1 | 0.059345 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.6 | -0.045594 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | WndNbrhood.24 | -0.023004 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.6 | -0.051726 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.15 | -0.039767 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | IBRAttn.24 | -0.001796 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.6 | 0.053306 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.15 | 0.04418 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | B18Raw.24 | 0.030505 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.6 | -0.034064 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.15 | -0.037334 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | HOMEETA1.24 | -0.016869 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.6 | -0.03603 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.15 | -0.022606 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | InRatioCor.24 | -0.014519 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.6 | 0.034283 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.15 | 0.00186 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | CORTB.24 | 0.021881 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | EARS_TJo.24 | -0.009914 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnPos.24 | -0.015144 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | LESMnNeg.24 | 0.032104 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.6 | 0.084487 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.15 | 0.08033 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.35 | ESETA1.24 | 0.003504 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | state_1 | 0.046707 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | BioDadInHH2_1 | -0.032556 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmAge2 | -0.011158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmBlac2_1 | 0.045969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | TcBlac2_1 | 0.062286 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmMrSt2_1 | -0.02112 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | PmEd2 | 0.003704 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | KFASTScr | 0.001911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RMomAgeU | 0.042917 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_1 | 0.001836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_2 | 0.011966 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_3 | -0.000588 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_4 | -0.031635 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHealth_5 | 0.03408 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_1 | -0.020218 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_2 | 0.024941 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_3 | 0.002759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HomeOwnd_4 | 0.002021 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SWghtLB | -0.022619 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SurpPreg_1 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_1 | -0.044081 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_2 | 0.003514 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SmokTotl_3 | -0.008938 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_1 | 0.010825 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | DrnkFreq_2 | -0.012394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | peri_health | -0.019048 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | caregiv_health | -0.001676 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | gov_assist | 0.01349 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.6 | 0.028656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.15 | -0.02358 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | SAAmylase.24 | -0.017473 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.6 | 0.035384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | MDI.15 | -0.069623 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.6_1 | 0.066159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.15_1 | 0.005755 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.24_1 | -0.025656 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | RHasSO.35_1 | -0.013387 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.6 | -0.042805 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.24 | -0.006412 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | WndNbrhood.35 | 0.003724 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.6 | -0.04382 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.15 | -0.01477 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | IBRAttn.24 | -0.048202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.6 | 0.03759 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.15 | 0.078278 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | B18Raw.24 | 0.051997 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.6 | -0.030969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.15 | 0.004609 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.24 | -0.047911 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | HOMEETA1.35 | -0.07415 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.6 | -0.036626 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.15 | -0.046776 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.24 | -0.044794 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | InRatioCor.35 | -0.021949 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.6 | 0.024018 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.15 | -0.008257 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | CORTB.24 | 0.004373 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.24 | -0.018775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | EARS_TJo.35 | 0.023288 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.24 | -0.019433 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnPos.35 | -0.016828 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.24 | 0.027503 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | LESMnNeg.35 | 0.054757 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | StrDif_Tot.35 | 0.022732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | fscore.35 | -0.059882 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.6 | 0.039731 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.15 | 0.031636 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.24 | 0.014185 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.58 | ESETA1.35 | 0.019732 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points Averaging Across Imputed Datasets plot(balance_stats.cbps, t = 4, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-3b--update-simplified-formulas","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Step 3b. Update Simplified Formulas","title":"Workflow: Continuous Exposure","text":"Subsequently, update shortened formulas include time-varying confounders (t-1 +) successfully balanced full formulas, shown . , create final round weights formulas using createFormulas() function (setting type = “update” providing balance statistics bal_stats field). createFormulas() function draws user-provided balance statistics automatically identify add formulas exposure time point time-varying confounders lags greater 1 remain imbalanced weighting. function displays weights formula console message user time-varying confounders added. required input update shortened weights formulas using createFormulas() function : MSM object (e.g., “obj”), setting type = “update”, providing bal_stats balance statistics just created Step 3a. optional input detailed Step 1a. function returns list weights formulas labeled type, exposure, outcome, exposure time point. , update short formulas using balance statistics best-performing weights. inspect new formulas make sure imbalanced covariates added appropriate formulas. user option supply save.save printed output home directory. shown , income 6 15 months (“InRatioCor.6” “InRatioCor.15”) added 35-month weights formula. originally weights formula given lags greater t -1. remaining imbalance suggests achieving balance 24-month income successfully balance prior levels income. use weights formulas recreate CBPS weights effort achieve greatest reduction balance.","code":"type <- \"update\" bal_stats <- balance_stats.cbps updated_formulas <- createFormulas(obj = obj, type = type, bal_stats = bal_stats, save.out = save.out) print(updated_formulas, save.out = save.out) #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 6, the update formula for ESETA1.6 is: #> ESETA1.6 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 15, the update formula for ESETA1.15 is: #> ESETA1.15 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.6 + MDI.6 + RHasSO.6 + WndNbrhood.6 + IBRAttn.6 + B18Raw.6 + HOMEETA1.6 + InRatioCor.6 + CORTB.6 + ESETA1.6 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 24, the update formula for ESETA1.24 is: #> ESETA1.24 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.15 + MDI.15 + RHasSO.15 + IBRAttn.15 + B18Raw.15 + HOMEETA1.15 + InRatioCor.15 + CORTB.15 + ESETA1.15 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 35, the update formula for ESETA1.35 is: #> ESETA1.35 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + SAAmylase.24 + RHasSO.24 + WndNbrhood.24 + IBRAttn.24 + B18Raw.24 + HOMEETA1.24 + InRatioCor.24 + CORTB.24 + EARS_TJo.24 + LESMnPos.24 + LESMnNeg.24 + ESETA1.24 #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 58, the update formula for ESETA1.58 is: #> ESETA1.58 ~ state + BioDadInHH2 + PmAge2 + PmBlac2 + TcBlac2 + PmMrSt2 + PmEd2 + KFASTScr + RMomAgeU + RHealth + HomeOwnd + SWghtLB + SurpPreg + SmokTotl + DrnkFreq + peri_health + caregiv_health + gov_assist + RHasSO.35 + WndNbrhood.35 + HOMEETA1.35 + InRatioCor.35 + EARS_TJo.35 + LESMnPos.35 + LESMnNeg.35 + StrDif_Tot.35 + fscore.35 + ESETA1.35"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-3c--create-final-balancing-weights","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Step 3c. Create Final Balancing Weights","title":"Workflow: Continuous Exposure","text":"Next, create final set balancing weights using optimal weighting method identified Step 2c updated formulas previous step using createWeights() function (method = “…’), SuperLearner method optimal weighting method identified Step 2c. function calls weightitMSM() function WeightIt package (Greifer, 2023) uses time-specific formulas create weights time point automatically multiplying together create one weight per person. Weights stabilized, recommended (Cole & Hernan, 2008; Thoemmes & Ong, 2016) distributions saved home directory inspection. required inputs using createWeights() function create final round IPTW balancing weights using updated short weights formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), best-performing weights method, updated formulas (see Step 3a). optional input createWeights() function listed Step 2b. function returns list form WeightItMSM output. , use updated formulas CPBS weighting method create final round IPTW balancing weights. inspect final weights imputed dataset. user option supply save.save printed plot output home directory. shown , weights median value 0.77 range 0-9, .","code":"formulas <- updated_formulas method <- \"cbps\" final_weights <- createWeights(data = data, obj = obj, method = method, formulas = formulas, max.it = 1, # testing only save.out = save.out) print(final_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, the median weight value is 0.77 (SD = 1.18; range = 0-9). plot(final_weights, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"d--trim-final-balancing-weights","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"3d. Trim Final Balancing Weights","title":"Workflow: Continuous Exposure","text":"next step trim (.e., winsorize) final set weights eliminate heavy right tail distribution using trimWeights() function. function draws Weightit package (Griefer, 2023) plots summarizes trimmed weights. function outputs list trimmed weights either single nested list (labeled “0” data data frame format) nested lists imputed dataset (data imputed). required input trimWeights() function final weights just created. optional input allows user specify quantile value (0-1; default 0.95) weights replaced weight value quantile, reduce heavy right tail. , use default 95th percentile trimming weights. trim final weights . function returns list weights objects, containing trimmed weights, form weightitMSM output ( one entry per imputed dataset, applicable). entry also specifies quantile value weights trimmed. inspect trimmed weights one imputed datasets . user option supply save.save plots home directory. shown , weights still median value 0.77 smaller standard deviation range now goes 0-4. create trimmed weights using two quantile values + /- ~0.3 previously chosen quantile value, order conduct recommended sensitivity analyses subsequent steps. first create weights 92nd quantile value. Trimming 92nd quantile preserves median 0.77 even smaller standard deviation range. 98th quantile value. Trimming instead 98th quantile produces larger standard deviation range. find comparable descriptive statistics sets weights, upper range value varying quantile cutoff. assess consequences differences (e.g., different ranges) subsequent steps.","code":"quantile <- 0.95 weights <- final_weights trim_weights <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 95th quantile, the median weight value is 0.77 (SD = 0.93; range = 0-4). plot(trim_weights, i = 1, save.out = save.out) quantile <- 0.92 trim_weights.s1 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s1, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 92th quantile, the median weight value is 0.77 (SD = 0.82; range = 0-3). plot(trim_weights.s1, i = 1, save.out = save.out) quantile <- 0.98 trim_weights.s2 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s2, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 98th quantile, the median weight value is 0.77 (SD = 1.06; range = 0-5). plot(trim_weights.s2, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"sensitvity-analyses","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Sensitvity Analyses","title":"Workflow: Continuous Exposure","text":"create trimmed weights using two quantile values + /- ~0.3 previously chosen quantile value, order conduct recommended sensitivity analyses subsequent steps. first create weights 92nd quantile value. Trimming 92nd quantile preserves median 0.77 even smaller standard deviation range. 98th quantile value. Trimming instead 98th quantile produces larger standard deviation range. find comparable descriptive statistics sets weights, upper range value varying quantile cutoff. assess consequences differences (e.g., different ranges) subsequent steps.","code":"quantile <- 0.92 trim_weights.s1 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s1, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 92th quantile, the median weight value is 0.77 (SD = 0.82; range = 0-3). plot(trim_weights.s1, i = 1, save.out = save.out) quantile <- 0.98 trim_weights.s2 <- trimWeights(weights = weights, at = quantile, save.out = save.out) print(trim_weights.s2, i = 1) #> #> For imputation 1 and the `cbps` weighting method, after trimming at 98th quantile, the median weight value is 0.77 (SD = 1.06; range = 0-5). plot(trim_weights.s2, i = 1, save.out = save.out)"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-4-conduct-final-balance-assessment","dir":"Articles","previous_headings":"","what":"Step 4: Conduct Final Balance Assessment","title":"Workflow: Continuous Exposure","text":"created trimmed final set IPTW balancing weights, next step conduct final evaluation well reduce imbalance. assess performance final trimmed untrimmed weights using assessBalance() function. required inputs using assessBalance() function assess final, trimmed weights achieve balance full formulas : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), weights. optional inputs assessBalance() function detailed Step 1b. , assess balance trimmed weights. Assess balance trimmed weights Summarize inspect. shown , trimmed weights result one imbalanced confounder relation exposure 15 months effective sample size 719. assess balance untrimmed weights Summarize inspect see non-trimmed weights result imbalanced confounders effective sample size 611. scenario, given , trimmed weights, imbalanced confounder (income 6 months) related exposure -0.051 trimmed weights yield higher effective sample size, proceed trimmed weights. summarize final balance statistics, averaging across imputed datasets. user option supply save.save plot output home directory. outcome modeling step (Step 5), users option include remaining imbalanced confounders time invariant covariates final outcome model. case, manually list imbalanced confounders time invariant assign covariates. Subsequently, also assess balance weights trimmed two additional quantile values assess whether final balance assessment sensitive trim value. first assess balance weights trimmed 93rd quantile value. , similarly find income 6 months imbalanced respect exposure 15 months (albeit slighter stronger correlation main analyses). next assess balance weights trimmed 98th quantile value. , find remaining imbalanced confounders (similar untrimmed results).","code":"weights <- trim_weights final_balance_stats_trim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats_trim, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.018002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.01641 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.009705 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.017384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.017685 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00618 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.036545 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.020649 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.005992 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.001056 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.0065 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.004525 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.006969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.011918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.003678 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.003725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.006049 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.008359 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.000996 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.008394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.010939 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.009158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.005918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.007173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.017437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.000413 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.008989 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.015211 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.010964 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.01114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.018068 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.017711 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.002143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.025159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.024603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.047661 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.005651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.03469 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets summary(trim_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 weights <- final_weights final_balance_stats_untrim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_untrim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.07): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(final_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` plot(final_balance_stats_trim, t = 2, save.out = save.out) # covariates <- c(\"list_imbalanced_ti_conf\") weights <- trim_weights.s1 final_balance_stats.s1 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s1, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 3 out of 241 (1.2%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats.s1, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.02248 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.02024 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.01219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.0244 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.02265 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00906 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.04175 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.02587 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.01202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.00346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.00661 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.00912 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.00351 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.01245 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.00579 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.00296 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.00995 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.00817 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.00333 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.01431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.01323 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.0114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.00775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.0125 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.02183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.00145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.01119 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.01836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.01106 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.016 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.0208 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.02262 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.0034 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.02608 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.02883 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.06024 | 0.05 | 0 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.00713 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.0427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets weights <- trim_weights.s2 final_balance_stats.s2 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s2, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps`"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"trimmed","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Trimmed","title":"Workflow: Continuous Exposure","text":"Assess balance trimmed weights Summarize inspect. shown , trimmed weights result one imbalanced confounder relation exposure 15 months effective sample size 719.","code":"weights <- trim_weights final_balance_stats_trim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats_trim, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.018002 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.01641 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.009705 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.017384 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.017685 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00618 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.036545 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.020649 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.005992 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.001056 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.0065 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.004525 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.006969 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.011918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.003678 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.003725 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.006049 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.008359 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.000996 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.008394 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.010939 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.009158 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.005918 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.007173 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.017437 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.000413 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.008989 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.015211 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.010964 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.01114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.018068 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.017711 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.002143 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.025159 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.024603 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.047661 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.005651 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.03469 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets summary(trim_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 3.528 #> #> - Units with the 5 most extreme weights: #> #> 89 79 30 27 11 #> all 3.528 3.528 3.528 3.528 3.528 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 0.896 0.687 0.372 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 717.08"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"untrimmed","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Untrimmed","title":"Workflow: Continuous Exposure","text":"assess balance untrimmed weights Summarize inspect see non-trimmed weights result imbalanced confounders effective sample size 611. scenario, given , trimmed weights, imbalanced confounder (income 6 months) related exposure -0.051 trimmed weights yield higher effective sample size, proceed trimmed weights. summarize final balance statistics, averaging across imputed datasets. user option supply save.save plot output home directory. outcome modeling step (Step 5), users option include remaining imbalanced confounders time invariant covariates final outcome model. case, manually list imbalanced confounders time invariant assign covariates.","code":"weights <- final_weights final_balance_stats_untrim <- assessBalance(data = data, obj = obj, balance_thresh = balance_thresh, imp_conf = imp_conf, weights = weights, save.out = save.out) summary(final_balance_stats_untrim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.07): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` summary(final_weights[[1]]) #> Time 1 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 2 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 3 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 4 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 #> #> Time 5 #> Summary of weights #> #> - Weight ranges: #> #> Min Max #> all 0 |---------------------------| 8.5138 #> #> - Units with the 5 most extreme weights: #> #> 1246 1145 294 697 919 #> all 7.4581 7.6788 7.9902 8.2032 8.5138 #> #> - Weight statistics: #> #> Coef of Var MAD Entropy # Zeros #> all 1.066 0.725 0.443 0 #> #> - Effective Sample Sizes: #> #> Total #> Unweighted 1292. #> Weighted 605.04 summary(final_balance_stats_trim, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` plot(final_balance_stats_trim, t = 2, save.out = save.out) # covariates <- c(\"list_imbalanced_ti_conf\")"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"sensitvity-analyses-1","dir":"Articles","previous_headings":"PHASE 1: Confounder Adjustment","what":"Sensitvity Analyses","title":"Workflow: Continuous Exposure","text":"Subsequently, also assess balance weights trimmed two additional quantile values assess whether final balance assessment sensitive trim value. first assess balance weights trimmed 93rd quantile value. , similarly find income 6 months imbalanced respect exposure 15 months (albeit slighter stronger correlation main analyses). next assess balance weights trimmed 98th quantile value. , find remaining imbalanced confounders (similar untrimmed results).","code":"weights <- trim_weights.s1 final_balance_stats.s1 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s1, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 3 out of 241 (1.2%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 1 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps` print(final_balance_stats.s1, t = 2, save.out = save.out) #> #> +-----------+----------------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +===========+================+===============+============+==========+ #> | ESETA1.15 | state_1 | 0.02248 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | BioDadInHH2_1 | -0.02024 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmAge2 | -0.01219 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmBlac2_1 | 0.0244 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | TcBlac2_1 | 0.02265 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmMrSt2_1 | -0.00906 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | PmEd2 | -0.04175 | 0.05 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | KFASTScr | -0.02587 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RMomAgeU | -0.01202 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_1 | -0.00346 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_2 | -0.00661 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_3 | 0.00912 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_4 | 0.00351 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHealth_5 | -0.01245 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_1 | -0.00579 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_2 | 0.00296 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_3 | 0.00995 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HomeOwnd_4 | 0.00817 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SWghtLB | -0.00333 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SurpPreg_1 | 0.01431 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_1 | 0.01323 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_2 | 0.0114 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SmokTotl_3 | -0.00775 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_1 | 0.0125 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | DrnkFreq_2 | -0.02183 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | peri_health | -0.00145 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | caregiv_health | 0.01119 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | gov_assist | 0.01836 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | SAAmylase.6 | 0.01106 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | MDI.6 | 0.016 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | RHasSO.6_1 | 0.0208 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | WndNbrhood.6 | -0.02262 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | IBRAttn.6 | -0.0034 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | B18Raw.6 | 0.02608 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | HOMEETA1.6 | -0.02883 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | InRatioCor.6 | -0.06024 | 0.05 | 0 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | CORTB.6 | -0.00713 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> | ESETA1.15 | ESETA1.6 | 0.0427 | 0.1 | 1 | #> +-----------+----------------+---------------+------------+----------+ #> #> Table: Balance Stats for Exposure Time 2 Averaging Across Imputed Datasets weights <- trim_weights.s2 final_balance_stats.s2 <- assessBalance(data = data, obj = obj, weights = weights, imp_conf = imp_conf, balance_thresh = balance_thresh, save.out = save.out) summary(final_balance_stats.s2, save.out = save.out) #> USER ALERT: Averaging across imputed datasets using `cbps` weighting method: As shown below, 2 out of 241 (0.8%) covariates across time points remain imbalanced with a remaining median absolute correlation of 0.06 (max: 0.06): #> +-----------+-----------------------+----------------------------+ #> | Exposure | Total # of covariates | # of imbalanced covariates | #> +===========+=======================+============================+ #> | ESETA1.6 | 28 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.15 | 38 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.24 | 47 | 0 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.35 | 59 | 2 | #> +-----------+-----------------------+----------------------------+ #> | ESETA1.58 | 69 | 0 | #> +-----------+-----------------------+----------------------------+ #> #> Table: Imbalanced Covariates Averaging Across Imputed Datasetrs using `cbps`"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"phase-2-assess-substantive-associations-between-exposure-and-outcome","dir":"Articles","previous_headings":"","what":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","title":"Workflow: Continuous Exposure","text":"created IPTW balancing weights minimize associations confounders exposure time point, can move substantive modeling phase. goal final step fit weighted model relating exposure meaningful epochs developmental time outcome, summarizing visualizing results. step, user models compares various counterfactuals, effects different developmental histories exposure outcome, test substantive hypotheses dose timing. First, use fitModel() function fit weighted generalized linear model relating exposure outcome. function draws glm_weightit() function WeightIt package (Greifer, 2023). exposure main effects models reflect exposure levels exposure time point unless exposure epochs specified. One benefits creating balancing weights can used variety different marginal outcome models encompassed function subset possible models. Note models can get complex advise interpreting individual terms. required inputs using fitModel() function : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), outcome, list trimmed weights, model list (“m0”, “m1”, “m2”, “m3”). first inspect following list models. M0: Baseline model regressing outcome main effects exposure (e.g., infancy, toddlerhood, childhood). M1: Covariate model regressing outcome main effects exposure well user-specified covariates (e.g., confounders measured baseline first time point remained imbalanced weighting Step 4). M2: Interaction model regressing outcome main effects exposure well interactions exposure main effects (e.g., infancy:toddlerhood) user-specified interaction order M3: Full model regressing outcome main effects exposure, user-specified covariates, well exposure main effect interactions interactions expoure covariates, user-specified interaction order , specify M0 model. user selects covariate model (“m1” “m3”), required supply list covariates corresponds covariates wide data (see Step 4). optional inputs fitModel() function follows. user selects interaction model (“m2” “m3”), required provide interaction order integer int_order field reflects maximum interaction (e.g., 3) (automatically include lower order interactions (e.g., 2-way)). interaction order exceed total number exposure main effects (3 case, specified 3 exposure epochs). specify interaction model (“m2” “m3”), also need specify interaction order ( included lower-level interactoins) exposure main effects fitModel() function . user can also specify family (function, quotations; e.g., gaussian) link (quotations, e.g., “identity”) functions generalized linear model (defaults gaussian “link”, respectively). possible families : binomial, gaussian, Gama, inverse.gaussian, poisson, quasi, quasibinomial, quasipoisson. binomial Poisson families, set family quasibinomial quasipoisson, respectively, avoid warning non-integer numbers successes. `quasi’ versions family objects give point estimates standard errors give warning. gaussian family accepts links: “identity”, “log” “inverse”; binomial family links “logit”, “probit”, “cauchit”, (corresponding logistic, normal Cauchy CDFs respectively) “log” “cloglog” (complementary log-log); Gamma family links “inverse”, “identity”, “log”; poisson family links “log”, “identity”, “sqrt”; inverse.gaussian family links 1/mu^2, inverse, identity log. quasi family accepts links “logit”, “probit”, “cloglog”, “identity”, “inverse”, “log”, “1/mu^2”, “sqrt”, function power can used create power link function. , retain default family link functions. function returns list fitted model objects, glm output. fit outcome model using trimmed weights . function returns list models (one per imputed dataset, applicable). inspect model output. user option supply save.save printed output home directory. inspect model averaged across imputed datasets. Importantly, first examine results Wald test top output. case imputed data, likelihood ratio test done pooling parameters via Rubin’s Rules. test compares user-specified model nested version model omits exposure variables test whether exposure predicts variation outcome. Models pooled prior conducting likelihood ratio test imputed data.) conduct sensitivity analyses, fitting model weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recomend user supply new name (e.g., save.= “model_m1_s1.rds”). first fit model weights trimmed 92nd quantile. similarly find significant likelihoood ratio test. fit model weights trimmed 98th quantile. comparable result. final step, use fitted model results test substantive hypotheses dose timing. estimate compare average marginal estimates outcome user-specified exposure history (.e., permutation high (“h) low (“l”) levels exposure exposure epoch) using compareHistories() function. draws primarily avg_predictions() hypotheses() functions marginaleffects package (Arel-Bundock, 2023). First, compareHistories() function creates average predictions outcome exposure history. n combinations user-specified exposure histories, set value predictors full dataset values combination, leaving variables . gives us n datasets, size original dataset used fit model. n datasets, compute predicted values given model taking average predicted value n datasets. n averaged predicted values expected potential outcomes combination. (imputed data, function outputs pooled predicted values using Rubin’s Rules.) Next, using predicted values, function conducts comparisons different histories (pooling across imputed datasets imputed data using Rubin’s Rules). Lastly, function implements correction multiple comparisons (treating run function family) plotting results. Box plots display outcome x-axis exposure history y-axis whiskers display standard errors. required inputs using compareHistories() function : MSM object (e.g., “obj”) fitted model output (previous steps). optional inputs follows. create histories high low values continuous exposures, hi_lo_cut user can specify list two quantile values (0-1; default median split +/- 0.001) demarcating high low levels exposure, respectively. (Imputed data stacked calculate cutoff values.) suggest drawing existing hypotheses examining variability exposure variable determine high low cutoffs. recommend users begin specifying meaningful high low percentile cutoffs examining many individuals sample fall user-specified exposure histories created percentile cutoffs (see Specify Core Inputs vignette). gold standard recommendations sufficient cell numbers per history, users ensure reasonable coverage histories avoid extrapolation maximize precision. , draw high low cutoffs previously specified, 60th 30th percentile values denote high low levels economic strain, respectively. user also option estimate compare custom subset user-specified exposure histories (.e., sequences high low levels exposure epoch time point) using reference comparison fields. conduct recommended customized comparisons, users must provide least one unique valid history (e.g., “l-l-l”) reference , quotations, provide string (list strings) lowercase l’s h’s (separated -), corresponding exposure epoch (time point), signify sequence exposure levels (“low” “high”, respectively). user supplies reference history, required provide least one unique valid history comparison , quotations, providing comparison string (list strings) l’s h’s (separated “-”), corresponding exposure epoch, signify sequence exposure levels (“low” “high”, respectively) constitutes comparison exposure history/histories compared reference. user supplies one comparisons, least one reference must specified. reference exposure history compared comparison history comparisons subject multiple comparison correction. reference comparison specified, histories compared . 4 exposure main effects (either epochs exposure time points), user required select subset history comparisons (Step 5b), given base code (see hypotheses() function marginaleffects package; Arel-Bundock, 2023) accommodate pairwise history comparisons 5 time points. user can also specify multiple comparison method mc_method quotations, providing shorthand method (“holm”, “hochberg”,“hommel”, “bonferroni”, “BH” (default), “”, “fdr”, “n” (see stats::p.adjust documentation; R Core Team) multiple comparison correction applied final (pooled across imputed datasets applicable) contrasts comparing effects different exposure histories outcome (default Benjamini-Hochburg). code run considered family. user iterates function specifying different comparisons time, strongly recommend interpreting outcome inclusive set comparisons avoid false discovery. , retain default Benjamini-Hochburg method multiple comparison. Based substantive interests, user also option choose level dosage (“h” “l”) tallied labels dose counts tables figures (dose_level; default “h”). example, exposure variable coded way lower levels conceptualized exposure (e.g., lower income), user may wish choose dosage level “l”. , given interest histories high economic strain, specify wish tally high doses exposure. Lastly, user can provide alternate plotting labels exposure outcome exp_lab out_lab fields (defaults variable names), well list (equal number exposure main effects +1) colors Brewer color palette (colors; default “Dark2”). See RColorBrewer::display.brewer.() https://r-graph-gallery.com/38-rcolorbrewers-palettes.html). , specify plotting labels 4 colors. function returns data frame user-specified history comparisons containing contrast estimates, standard errors, statistics, p-values, low high confidence intervals, corrected p-values, labeled history dose. function outputs list two entries. first contains predicted values history second contains comparisons. inspect compared histories output (now averaged across imputed datsets). user option supply save.save printed output home directory. first confirm distribution sample across exposure histories reasonable. summarize results. inspect history comparison conclude evidence children experienced different histories exposure economic strain infancy, toddlerhood, early childhood differ behavioral problems early childhood. Lastly, plot results. user option supply save.save plot output home directory. conduct sensitivity analyses assessing comparing histories drawing models used weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recommend user supply new name (e.g., save.= “history_comparisons_s1.rds”). first compare histories using model fit weights trimmed 92nd quantile value. shown , results indicate marginal non-significant contrast “l-l-l” “h-h-h” histories economic strain exposure relation behavior problems early childhood. compare histories using model fit weights trimmed 98th quantile value. Similarly, find evidence differences behavioral problems function history exposure economic strain.","code":"m <- \"m0\" #int_order <- 2 family <- gaussian link <- \"identity\" weights <- trim_weights models <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.181783 3 0.4300163 NA 1 2.021014 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.483 | [0.452, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.112, 0.169] | 0.442 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.003 | [-0.042, 0.048] | 0.891 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.012 | [-0.054, 0.079] | 0.650 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s1 models.s1 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s1, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -0.42805 3 0.6223825 NA 1 1.252613 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.481 | [0.450, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.085, 0.141] | 0.400 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.006 | [-0.040, 0.051] | 0.784 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.015 | [-0.061, 0.091] | 0.601 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s2 models.s2 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s2, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.653469 3 0.3504546 NA 1 2.86164 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+--------+-----------------+--------+ #> | | (1) | #> +--------------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+========+=================+========+ #> | (Intercept) | 0.485 | [0.454, 0.515] | <0.001 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Childhood | 0.029 | [-0.150, 0.209] | 0.487 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Infancy | -0.002 | [-0.055, 0.052] | 0.934 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.009 | [-0.061, 0.080] | 0.748 | #> +--------------------+--------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+--------+-----------------+--------+ hi_lo_cut <- c(0.6, 0.3) mc_comp_method <- \"BH\" dose_level <- \"h\" exp_lab <- \"Economic Strain\" out_lab <- \"Behavior Problems\" colors <- c(\"blue4\", \"darkgreen\", \"darkgoldenrod\", \"red2\") model <- models results <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) print(results) #> Summary of Exposure Main Effects: #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> #> Below are the pooled average predictions by user-specified history: #> +-------+----------+-----------+----------+-----------+ #> | term | estimate | std.error | conf.low | conf.high | #> +=======+==========+===========+==========+===========+ #> | l-l-l | 0.47 | 0.014 | 0.44 | 0.49 | #> +-------+----------+-----------+----------+-----------+ #> | h-h-h | 0.5 | 0.019 | 0.43 | 0.57 | #> +-------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+============+============+===========+=============+============+==============+ #> | (h-h-h) - (l-l-l) | 0.02991272 | 0.01979075 | 0.2172254 | -0.02903923 | 0.08886468 | 0.2172254 | #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ summary(results, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02991272 0.01979075 1.511449 3.40476 0.2172254 #> conf.low conf.high dose p.value_corr #> 1 -0.02903923 0.08886468 3 - 0 0.2172254 plot(results, save.out = save.out) model <- models.s1 results.s1 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s1, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.03275407 0.01735569 1.887224 5.210738 0.1154298 #> conf.low conf.high dose p.value_corr #> 1 -0.01132286 0.07683101 3 - 0 0.1154298 model <- models.s2 results.s2 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s2, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02588619 0.0234072 1.105907 2.462813 0.3649947 #> conf.low conf.high dose p.value_corr #> 1 -0.05869734 0.1104697 3 - 0 0.3649947"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-5-fit-weighted-outcome-model-summarize-visualize-results","dir":"Articles","previous_headings":"","what":"Step 5: Fit Weighted Outcome Model & Summarize & Visualize Results","title":"Workflow: Continuous Exposure","text":"goal final step fit weighted model relating exposure meaningful epochs developmental time outcome, summarizing visualizing results. step, user models compares various counterfactuals, effects different developmental histories exposure outcome, test substantive hypotheses dose timing. First, use fitModel() function fit weighted generalized linear model relating exposure outcome. function draws glm_weightit() function WeightIt package (Greifer, 2023). exposure main effects models reflect exposure levels exposure time point unless exposure epochs specified. One benefits creating balancing weights can used variety different marginal outcome models encompassed function subset possible models. Note models can get complex advise interpreting individual terms. required inputs using fitModel() function : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), outcome, list trimmed weights, model list (“m0”, “m1”, “m2”, “m3”). first inspect following list models. M0: Baseline model regressing outcome main effects exposure (e.g., infancy, toddlerhood, childhood). M1: Covariate model regressing outcome main effects exposure well user-specified covariates (e.g., confounders measured baseline first time point remained imbalanced weighting Step 4). M2: Interaction model regressing outcome main effects exposure well interactions exposure main effects (e.g., infancy:toddlerhood) user-specified interaction order M3: Full model regressing outcome main effects exposure, user-specified covariates, well exposure main effect interactions interactions expoure covariates, user-specified interaction order , specify M0 model. user selects covariate model (“m1” “m3”), required supply list covariates corresponds covariates wide data (see Step 4). optional inputs fitModel() function follows. user selects interaction model (“m2” “m3”), required provide interaction order integer int_order field reflects maximum interaction (e.g., 3) (automatically include lower order interactions (e.g., 2-way)). interaction order exceed total number exposure main effects (3 case, specified 3 exposure epochs). specify interaction model (“m2” “m3”), also need specify interaction order ( included lower-level interactoins) exposure main effects fitModel() function . user can also specify family (function, quotations; e.g., gaussian) link (quotations, e.g., “identity”) functions generalized linear model (defaults gaussian “link”, respectively). possible families : binomial, gaussian, Gama, inverse.gaussian, poisson, quasi, quasibinomial, quasipoisson. binomial Poisson families, set family quasibinomial quasipoisson, respectively, avoid warning non-integer numbers successes. `quasi’ versions family objects give point estimates standard errors give warning. gaussian family accepts links: “identity”, “log” “inverse”; binomial family links “logit”, “probit”, “cauchit”, (corresponding logistic, normal Cauchy CDFs respectively) “log” “cloglog” (complementary log-log); Gamma family links “inverse”, “identity”, “log”; poisson family links “log”, “identity”, “sqrt”; inverse.gaussian family links 1/mu^2, inverse, identity log. quasi family accepts links “logit”, “probit”, “cloglog”, “identity”, “inverse”, “log”, “1/mu^2”, “sqrt”, function power can used create power link function. , retain default family link functions. function returns list fitted model objects, glm output. fit outcome model using trimmed weights . function returns list models (one per imputed dataset, applicable). inspect model output. user option supply save.save printed output home directory. inspect model averaged across imputed datasets. Importantly, first examine results Wald test top output. case imputed data, likelihood ratio test done pooling parameters via Rubin’s Rules. test compares user-specified model nested version model omits exposure variables test whether exposure predicts variation outcome. Models pooled prior conducting likelihood ratio test imputed data.) conduct sensitivity analyses, fitting model weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recomend user supply new name (e.g., save.= “model_m1_s1.rds”). first fit model weights trimmed 92nd quantile. similarly find significant likelihoood ratio test. fit model weights trimmed 98th quantile. comparable result. final step, use fitted model results test substantive hypotheses dose timing. estimate compare average marginal estimates outcome user-specified exposure history (.e., permutation high (“h) low (“l”) levels exposure exposure epoch) using compareHistories() function. draws primarily avg_predictions() hypotheses() functions marginaleffects package (Arel-Bundock, 2023). First, compareHistories() function creates average predictions outcome exposure history. n combinations user-specified exposure histories, set value predictors full dataset values combination, leaving variables . gives us n datasets, size original dataset used fit model. n datasets, compute predicted values given model taking average predicted value n datasets. n averaged predicted values expected potential outcomes combination. (imputed data, function outputs pooled predicted values using Rubin’s Rules.) Next, using predicted values, function conducts comparisons different histories (pooling across imputed datasets imputed data using Rubin’s Rules). Lastly, function implements correction multiple comparisons (treating run function family) plotting results. Box plots display outcome x-axis exposure history y-axis whiskers display standard errors. required inputs using compareHistories() function : MSM object (e.g., “obj”) fitted model output (previous steps). optional inputs follows. create histories high low values continuous exposures, hi_lo_cut user can specify list two quantile values (0-1; default median split +/- 0.001) demarcating high low levels exposure, respectively. (Imputed data stacked calculate cutoff values.) suggest drawing existing hypotheses examining variability exposure variable determine high low cutoffs. recommend users begin specifying meaningful high low percentile cutoffs examining many individuals sample fall user-specified exposure histories created percentile cutoffs (see Specify Core Inputs vignette). gold standard recommendations sufficient cell numbers per history, users ensure reasonable coverage histories avoid extrapolation maximize precision. , draw high low cutoffs previously specified, 60th 30th percentile values denote high low levels economic strain, respectively. user also option estimate compare custom subset user-specified exposure histories (.e., sequences high low levels exposure epoch time point) using reference comparison fields. conduct recommended customized comparisons, users must provide least one unique valid history (e.g., “l-l-l”) reference , quotations, provide string (list strings) lowercase l’s h’s (separated -), corresponding exposure epoch (time point), signify sequence exposure levels (“low” “high”, respectively). user supplies reference history, required provide least one unique valid history comparison , quotations, providing comparison string (list strings) l’s h’s (separated “-”), corresponding exposure epoch, signify sequence exposure levels (“low” “high”, respectively) constitutes comparison exposure history/histories compared reference. user supplies one comparisons, least one reference must specified. reference exposure history compared comparison history comparisons subject multiple comparison correction. reference comparison specified, histories compared . 4 exposure main effects (either epochs exposure time points), user required select subset history comparisons (Step 5b), given base code (see hypotheses() function marginaleffects package; Arel-Bundock, 2023) accommodate pairwise history comparisons 5 time points. user can also specify multiple comparison method mc_method quotations, providing shorthand method (“holm”, “hochberg”,“hommel”, “bonferroni”, “BH” (default), “”, “fdr”, “n” (see stats::p.adjust documentation; R Core Team) multiple comparison correction applied final (pooled across imputed datasets applicable) contrasts comparing effects different exposure histories outcome (default Benjamini-Hochburg). code run considered family. user iterates function specifying different comparisons time, strongly recommend interpreting outcome inclusive set comparisons avoid false discovery. , retain default Benjamini-Hochburg method multiple comparison. Based substantive interests, user also option choose level dosage (“h” “l”) tallied labels dose counts tables figures (dose_level; default “h”). example, exposure variable coded way lower levels conceptualized exposure (e.g., lower income), user may wish choose dosage level “l”. , given interest histories high economic strain, specify wish tally high doses exposure. Lastly, user can provide alternate plotting labels exposure outcome exp_lab out_lab fields (defaults variable names), well list (equal number exposure main effects +1) colors Brewer color palette (colors; default “Dark2”). See RColorBrewer::display.brewer.() https://r-graph-gallery.com/38-rcolorbrewers-palettes.html). , specify plotting labels 4 colors. function returns data frame user-specified history comparisons containing contrast estimates, standard errors, statistics, p-values, low high confidence intervals, corrected p-values, labeled history dose. function outputs list two entries. first contains predicted values history second contains comparisons. inspect compared histories output (now averaged across imputed datsets). user option supply save.save printed output home directory. first confirm distribution sample across exposure histories reasonable. summarize results. inspect history comparison conclude evidence children experienced different histories exposure economic strain infancy, toddlerhood, early childhood differ behavioral problems early childhood. Lastly, plot results. user option supply save.save plot output home directory. conduct sensitivity analyses assessing comparing histories drawing models used weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recommend user supply new name (e.g., save.= “history_comparisons_s1.rds”). first compare histories using model fit weights trimmed 92nd quantile value. shown , results indicate marginal non-significant contrast “l-l-l” “h-h-h” histories economic strain exposure relation behavior problems early childhood. compare histories using model fit weights trimmed 98th quantile value. Similarly, find evidence differences behavioral problems function history exposure economic strain.","code":"m <- \"m0\" #int_order <- 2 family <- gaussian link <- \"identity\" weights <- trim_weights models <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.181783 3 0.4300163 NA 1 2.021014 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.483 | [0.452, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.112, 0.169] | 0.442 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.003 | [-0.042, 0.048] | 0.891 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.012 | [-0.054, 0.079] | 0.650 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s1 models.s1 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s1, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -0.42805 3 0.6223825 NA 1 1.252613 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.481 | [0.450, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.085, 0.141] | 0.400 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.006 | [-0.040, 0.051] | 0.784 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.015 | [-0.061, 0.091] | 0.601 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s2 models.s2 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s2, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.653469 3 0.3504546 NA 1 2.86164 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+--------+-----------------+--------+ #> | | (1) | #> +--------------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+========+=================+========+ #> | (Intercept) | 0.485 | [0.454, 0.515] | <0.001 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Childhood | 0.029 | [-0.150, 0.209] | 0.487 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Infancy | -0.002 | [-0.055, 0.052] | 0.934 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.009 | [-0.061, 0.080] | 0.748 | #> +--------------------+--------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+--------+-----------------+--------+ hi_lo_cut <- c(0.6, 0.3) mc_comp_method <- \"BH\" dose_level <- \"h\" exp_lab <- \"Economic Strain\" out_lab <- \"Behavior Problems\" colors <- c(\"blue4\", \"darkgreen\", \"darkgoldenrod\", \"red2\") model <- models results <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) print(results) #> Summary of Exposure Main Effects: #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> #> Below are the pooled average predictions by user-specified history: #> +-------+----------+-----------+----------+-----------+ #> | term | estimate | std.error | conf.low | conf.high | #> +=======+==========+===========+==========+===========+ #> | l-l-l | 0.47 | 0.014 | 0.44 | 0.49 | #> +-------+----------+-----------+----------+-----------+ #> | h-h-h | 0.5 | 0.019 | 0.43 | 0.57 | #> +-------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+============+============+===========+=============+============+==============+ #> | (h-h-h) - (l-l-l) | 0.02991272 | 0.01979075 | 0.2172254 | -0.02903923 | 0.08886468 | 0.2172254 | #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ summary(results, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02991272 0.01979075 1.511449 3.40476 0.2172254 #> conf.low conf.high dose p.value_corr #> 1 -0.02903923 0.08886468 3 - 0 0.2172254 plot(results, save.out = save.out) model <- models.s1 results.s1 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s1, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.03275407 0.01735569 1.887224 5.210738 0.1154298 #> conf.low conf.high dose p.value_corr #> 1 -0.01132286 0.07683101 3 - 0 0.1154298 model <- models.s2 results.s2 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s2, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02588619 0.0234072 1.105907 2.462813 0.3649947 #> conf.low conf.high dose p.value_corr #> 1 -0.05869734 0.1104697 3 - 0 0.3649947"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-5a--select-fit-a-weighted-outcome-model","dir":"Articles","previous_headings":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","what":"Step 5a. Select & Fit a Weighted Outcome Model","title":"Workflow: Continuous Exposure","text":"First, use fitModel() function fit weighted generalized linear model relating exposure outcome. function draws glm_weightit() function WeightIt package (Greifer, 2023). exposure main effects models reflect exposure levels exposure time point unless exposure epochs specified. One benefits creating balancing weights can used variety different marginal outcome models encompassed function subset possible models. Note models can get complex advise interpreting individual terms. required inputs using fitModel() function : complete data (data frame, mids object, list imputed datasets dataframes wide format), MSM object (e.g., “obj”), outcome, list trimmed weights, model list (“m0”, “m1”, “m2”, “m3”). first inspect following list models. M0: Baseline model regressing outcome main effects exposure (e.g., infancy, toddlerhood, childhood). M1: Covariate model regressing outcome main effects exposure well user-specified covariates (e.g., confounders measured baseline first time point remained imbalanced weighting Step 4). M2: Interaction model regressing outcome main effects exposure well interactions exposure main effects (e.g., infancy:toddlerhood) user-specified interaction order M3: Full model regressing outcome main effects exposure, user-specified covariates, well exposure main effect interactions interactions expoure covariates, user-specified interaction order , specify M0 model. user selects covariate model (“m1” “m3”), required supply list covariates corresponds covariates wide data (see Step 4). optional inputs fitModel() function follows. user selects interaction model (“m2” “m3”), required provide interaction order integer int_order field reflects maximum interaction (e.g., 3) (automatically include lower order interactions (e.g., 2-way)). interaction order exceed total number exposure main effects (3 case, specified 3 exposure epochs). specify interaction model (“m2” “m3”), also need specify interaction order ( included lower-level interactoins) exposure main effects fitModel() function . user can also specify family (function, quotations; e.g., gaussian) link (quotations, e.g., “identity”) functions generalized linear model (defaults gaussian “link”, respectively). possible families : binomial, gaussian, Gama, inverse.gaussian, poisson, quasi, quasibinomial, quasipoisson. binomial Poisson families, set family quasibinomial quasipoisson, respectively, avoid warning non-integer numbers successes. `quasi’ versions family objects give point estimates standard errors give warning. gaussian family accepts links: “identity”, “log” “inverse”; binomial family links “logit”, “probit”, “cauchit”, (corresponding logistic, normal Cauchy CDFs respectively) “log” “cloglog” (complementary log-log); Gamma family links “inverse”, “identity”, “log”; poisson family links “log”, “identity”, “sqrt”; inverse.gaussian family links 1/mu^2, inverse, identity log. quasi family accepts links “logit”, “probit”, “cloglog”, “identity”, “inverse”, “log”, “1/mu^2”, “sqrt”, function power can used create power link function. , retain default family link functions. function returns list fitted model objects, glm output. fit outcome model using trimmed weights . function returns list models (one per imputed dataset, applicable). inspect model output. user option supply save.save printed output home directory. inspect model averaged across imputed datasets. Importantly, first examine results Wald test top output. case imputed data, likelihood ratio test done pooling parameters via Rubin’s Rules. test compares user-specified model nested version model omits exposure variables test whether exposure predicts variation outcome. Models pooled prior conducting likelihood ratio test imputed data.) conduct sensitivity analyses, fitting model weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recomend user supply new name (e.g., save.= “model_m1_s1.rds”). first fit model weights trimmed 92nd quantile. similarly find significant likelihoood ratio test. fit model weights trimmed 98th quantile. comparable result.","code":"m <- \"m0\" #int_order <- 2 family <- gaussian link <- \"identity\" weights <- trim_weights models <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.181783 3 0.4300163 NA 1 2.021014 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.483 | [0.452, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.112, 0.169] | 0.442 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.003 | [-0.042, 0.048] | 0.891 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.012 | [-0.054, 0.079] | 0.650 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s1 models.s1 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s1, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -0.42805 3 0.6223825 NA 1 1.252613 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.481 | [0.450, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.085, 0.141] | 0.400 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.006 | [-0.040, 0.051] | 0.784 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.015 | [-0.061, 0.091] | 0.601 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s2 models.s2 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s2, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.653469 3 0.3504546 NA 1 2.86164 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+--------+-----------------+--------+ #> | | (1) | #> +--------------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+========+=================+========+ #> | (Intercept) | 0.485 | [0.454, 0.515] | <0.001 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Childhood | 0.029 | [-0.150, 0.209] | 0.487 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Infancy | -0.002 | [-0.055, 0.052] | 0.934 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.009 | [-0.061, 0.080] | 0.748 | #> +--------------------+--------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+--------+-----------------+--------+"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"sensitvity-analyses-2","dir":"Articles","previous_headings":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","what":"Sensitvity Analyses","title":"Workflow: Continuous Exposure","text":"conduct sensitivity analyses, fitting model weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recomend user supply new name (e.g., save.= “model_m1_s1.rds”). first fit model weights trimmed 92nd quantile. similarly find significant likelihoood ratio test. fit model weights trimmed 98th quantile. comparable result.","code":"weights <- trim_weights.s1 models.s1 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s1, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -0.42805 3 0.6223825 NA 1 1.252613 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+-------+-----------------+--------+ #> | | (1) | #> +--------------------+-------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+=======+=================+========+ #> | (Intercept) | 0.481 | [0.450, 0.513] | <0.001 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Childhood | 0.028 | [-0.085, 0.141] | 0.400 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Infancy | 0.006 | [-0.040, 0.051] | 0.784 | #> +--------------------+-------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.015 | [-0.061, 0.091] | 0.601 | #> +--------------------+-------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+-------+-----------------+--------+ weights <- trim_weights.s2 models.s2 <- fitModel(data = data, obj = obj, weights = weights, outcome = outcome, model = m, family = family, link = link, save.out = save.out) print(models.s2, save.out = save.out) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> test statistic df1 df2 dfcom p.value riv #> 1 ~~ 2 -1.653469 3 0.3504546 NA 1 2.86164 #> #> #> The marginal model, m0, pooled across imputed datasets is summarized below: #> +--------------------+--------+-----------------+--------+ #> | | (1) | #> +--------------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +====================+========+=================+========+ #> | (Intercept) | 0.485 | [0.454, 0.515] | <0.001 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Childhood | 0.029 | [-0.150, 0.209] | 0.487 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Infancy | -0.002 | [-0.055, 0.052] | 0.934 | #> +--------------------+--------+-----------------+--------+ #> | ESETA1.Toddlerhood | 0.009 | [-0.061, 0.080] | 0.748 | #> +--------------------+--------+-----------------+--------+ #> | Num.Obs. | 1292 | | | #> +--------------------+--------+-----------------+--------+"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"step-5b--estimate-compare-and-visualize-model-predicted-outcome-as-a-function-of-exposure-history","dir":"Articles","previous_headings":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","what":"Step 5b. Estimate, Compare, and Visualize Model-Predicted Outcome as a Function of Exposure History","title":"Workflow: Continuous Exposure","text":"final step, use fitted model results test substantive hypotheses dose timing. estimate compare average marginal estimates outcome user-specified exposure history (.e., permutation high (“h) low (“l”) levels exposure exposure epoch) using compareHistories() function. draws primarily avg_predictions() hypotheses() functions marginaleffects package (Arel-Bundock, 2023). First, compareHistories() function creates average predictions outcome exposure history. n combinations user-specified exposure histories, set value predictors full dataset values combination, leaving variables . gives us n datasets, size original dataset used fit model. n datasets, compute predicted values given model taking average predicted value n datasets. n averaged predicted values expected potential outcomes combination. (imputed data, function outputs pooled predicted values using Rubin’s Rules.) Next, using predicted values, function conducts comparisons different histories (pooling across imputed datasets imputed data using Rubin’s Rules). Lastly, function implements correction multiple comparisons (treating run function family) plotting results. Box plots display outcome x-axis exposure history y-axis whiskers display standard errors. required inputs using compareHistories() function : MSM object (e.g., “obj”) fitted model output (previous steps). optional inputs follows. create histories high low values continuous exposures, hi_lo_cut user can specify list two quantile values (0-1; default median split +/- 0.001) demarcating high low levels exposure, respectively. (Imputed data stacked calculate cutoff values.) suggest drawing existing hypotheses examining variability exposure variable determine high low cutoffs. recommend users begin specifying meaningful high low percentile cutoffs examining many individuals sample fall user-specified exposure histories created percentile cutoffs (see Specify Core Inputs vignette). gold standard recommendations sufficient cell numbers per history, users ensure reasonable coverage histories avoid extrapolation maximize precision. , draw high low cutoffs previously specified, 60th 30th percentile values denote high low levels economic strain, respectively. user also option estimate compare custom subset user-specified exposure histories (.e., sequences high low levels exposure epoch time point) using reference comparison fields. conduct recommended customized comparisons, users must provide least one unique valid history (e.g., “l-l-l”) reference , quotations, provide string (list strings) lowercase l’s h’s (separated -), corresponding exposure epoch (time point), signify sequence exposure levels (“low” “high”, respectively). user supplies reference history, required provide least one unique valid history comparison , quotations, providing comparison string (list strings) l’s h’s (separated “-”), corresponding exposure epoch, signify sequence exposure levels (“low” “high”, respectively) constitutes comparison exposure history/histories compared reference. user supplies one comparisons, least one reference must specified. reference exposure history compared comparison history comparisons subject multiple comparison correction. reference comparison specified, histories compared . 4 exposure main effects (either epochs exposure time points), user required select subset history comparisons (Step 5b), given base code (see hypotheses() function marginaleffects package; Arel-Bundock, 2023) accommodate pairwise history comparisons 5 time points. user can also specify multiple comparison method mc_method quotations, providing shorthand method (“holm”, “hochberg”,“hommel”, “bonferroni”, “BH” (default), “”, “fdr”, “n” (see stats::p.adjust documentation; R Core Team) multiple comparison correction applied final (pooled across imputed datasets applicable) contrasts comparing effects different exposure histories outcome (default Benjamini-Hochburg). code run considered family. user iterates function specifying different comparisons time, strongly recommend interpreting outcome inclusive set comparisons avoid false discovery. , retain default Benjamini-Hochburg method multiple comparison. Based substantive interests, user also option choose level dosage (“h” “l”) tallied labels dose counts tables figures (dose_level; default “h”). example, exposure variable coded way lower levels conceptualized exposure (e.g., lower income), user may wish choose dosage level “l”. , given interest histories high economic strain, specify wish tally high doses exposure. Lastly, user can provide alternate plotting labels exposure outcome exp_lab out_lab fields (defaults variable names), well list (equal number exposure main effects +1) colors Brewer color palette (colors; default “Dark2”). See RColorBrewer::display.brewer.() https://r-graph-gallery.com/38-rcolorbrewers-palettes.html). , specify plotting labels 4 colors. function returns data frame user-specified history comparisons containing contrast estimates, standard errors, statistics, p-values, low high confidence intervals, corrected p-values, labeled history dose. function outputs list two entries. first contains predicted values history second contains comparisons. inspect compared histories output (now averaged across imputed datsets). user option supply save.save printed output home directory. first confirm distribution sample across exposure histories reasonable. summarize results. inspect history comparison conclude evidence children experienced different histories exposure economic strain infancy, toddlerhood, early childhood differ behavioral problems early childhood. Lastly, plot results. user option supply save.save plot output home directory. conduct sensitivity analyses assessing comparing histories drawing models used weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recommend user supply new name (e.g., save.= “history_comparisons_s1.rds”). first compare histories using model fit weights trimmed 92nd quantile value. shown , results indicate marginal non-significant contrast “l-l-l” “h-h-h” histories economic strain exposure relation behavior problems early childhood. compare histories using model fit weights trimmed 98th quantile value. Similarly, find evidence differences behavioral problems function history exposure economic strain.","code":"hi_lo_cut <- c(0.6, 0.3) mc_comp_method <- \"BH\" dose_level <- \"h\" exp_lab <- \"Economic Strain\" out_lab <- \"Behavior Problems\" colors <- c(\"blue4\", \"darkgreen\", \"darkgoldenrod\", \"red2\") model <- models results <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) print(results) #> Summary of Exposure Main Effects: #> USER ALERT: Out of the total of 1292 individuals in the sample, below is the distribution of the 333 (26%) individuals that fall into 2 user-selected exposure histories (out of the 27 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch Infancy, Toddlerhood, Childhood. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+-----+ #> | epoch_history | n | #> +===============+=====+ #> | h-h-h | 214 | #> +---------------+-----+ #> | l-l-l | 119 | #> +---------------+-----+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects Infancy, Toddlerhood, Childhood: #> #> Below are the pooled average predictions by user-specified history: #> +-------+----------+-----------+----------+-----------+ #> | term | estimate | std.error | conf.low | conf.high | #> +=======+==========+===========+==========+===========+ #> | l-l-l | 0.47 | 0.014 | 0.44 | 0.49 | #> +-------+----------+-----------+----------+-----------+ #> | h-h-h | 0.5 | 0.019 | 0.43 | 0.57 | #> +-------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+============+============+===========+=============+============+==============+ #> | (h-h-h) - (l-l-l) | 0.02991272 | 0.01979075 | 0.2172254 | -0.02903923 | 0.08886468 | 0.2172254 | #> +-------------------+------------+------------+-----------+-------------+------------+--------------+ summary(results, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02991272 0.01979075 1.511449 3.40476 0.2172254 #> conf.low conf.high dose p.value_corr #> 1 -0.02903923 0.08886468 3 - 0 0.2172254 plot(results, save.out = save.out) model <- models.s1 results.s1 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s1, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.03275407 0.01735569 1.887224 5.210738 0.1154298 #> conf.low conf.high dose p.value_corr #> 1 -0.01132286 0.07683101 3 - 0 0.1154298 model <- models.s2 results.s2 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s2, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02588619 0.0234072 1.105907 2.462813 0.3649947 #> conf.low conf.high dose p.value_corr #> 1 -0.05869734 0.1104697 3 - 0 0.3649947"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"sensitvity-analyses-3","dir":"Articles","previous_headings":"PHASE 2: Assess Substantive Associations between Exposure and Outcome","what":"Sensitvity Analyses","title":"Workflow: Continuous Exposure","text":"conduct sensitivity analyses assessing comparing histories drawing models used weights trimmed two different values. note save.= TRUE using default file naming, saving model output overwrite output main model. save sensitivity analyses, recommend user supply new name (e.g., save.= “history_comparisons_s1.rds”). first compare histories using model fit weights trimmed 92nd quantile value. shown , results indicate marginal non-significant contrast “l-l-l” “h-h-h” histories economic strain exposure relation behavior problems early childhood. compare histories using model fit weights trimmed 98th quantile value. Similarly, find evidence differences behavioral problems function history exposure economic strain.","code":"model <- models.s1 results.s1 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s1, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.03275407 0.01735569 1.887224 5.210738 0.1154298 #> conf.low conf.high dose p.value_corr #> 1 -0.01132286 0.07683101 3 - 0 0.1154298 model <- models.s2 results.s2 <- compareHistories(fit = model, comparison = comparison, reference = reference, hi_lo_cut = hi_lo_cut, mc_comp_method = mc_comp_method, dose = \"h\", save.out = save.out) summary(results.s2, save.out = save.out) #> term estimate std.error statistic df p.value #> 1 (h-h-h) - (l-l-l) 0.02588619 0.0234072 1.105907 2.462813 0.3649947 #> conf.low conf.high dose p.value_corr #> 1 -0.05869734 0.1104697 3 - 0 0.3649947"},{"path":"https://istallworthy.github.io/devMSMs/articles/Workflow_Continuous_Exposure.html","id":"references","dir":"Articles","previous_headings":"","what":"References","title":"Workflow: Continuous Exposure","text":"Arel-Bundock, V. 2023. marginaleffects: Predictions, Comparisons, Slopes, Marginal Means,Hypothesis Tests. https://CRAN.R-project.org/package=marginaleffects. Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Cole, S. R., & Hernán, M. . (2008). Constructing Inverse Probability Weights Marginal Structural Models. American Journal Epidemiology, 168(6), 656–664. https://doi.org/10.1093/aje/kwn164. Greifer, Noah. 2023.WeightIt: Weighting Covariate Balance Observational Studies. https://CRAN.R-project.org/package=WeightIt. Lumley, Thomas. 2023. “survey: Analysis Complex Survey Samples.” Polley, Eric, Erin LeDell, Chris Kennedy, Mark van der Laan. 2023. SuperLearner: SuperLearner Prediction. https://CRAN.R-project.org/package=SuperLearner. R Core Team (2013). R: language environment statistical computing. R Foundation Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URLhttp://www.R-project.org/. Stuart, E. . (2010). Matching methods causal inference: review look forward. Statistical Science: Review Journal Institute Mathematical Statistics, 25(1), 1–21. https://doi.org/10.1214/09-STS313. Thoemmes, F., & Ong, . D. (2016). Primer Inverse Probability Treatment Weighting Marginal Structural Models. https://doi.org/10.1177/2167696815621645. Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150.","code":""},{"path":"https://istallworthy.github.io/devMSMs/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Isabella Stallworthy. Author, maintainer. Noah Greifer. Author, contributor. Kyle Butts. Contributor. Meriah DeJoseph. Author. Emily Padrutt. Author. Daniel Berry. Author.","code":""},{"path":"https://istallworthy.github.io/devMSMs/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Stallworthy , Greifer N, DeJoseph M, Padrutt E, Berry D (2024). devMSMs: Implementing Marginal Structural Models Longitudinal Data. R package version 0.0.0.9001, https://github.com/istallworthy/devMSMs, https://istallworthy.github.io/devMSMs/.","code":"@Manual{, title = {devMSMs: Implementing Marginal Structural Models with Longitudinal Data}, author = {Isabella Stallworthy and Noah Greifer and Meriah DeJoseph and Emily Padrutt and Daniel Berry}, year = {2024}, note = {R package version 0.0.0.9001, https://github.com/istallworthy/devMSMs}, url = {https://istallworthy.github.io/devMSMs/}, }"},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"devmsms-implementing-marginal-structural-models-msms--with-longitudinal-data","dir":"","previous_headings":"","what":"Implementing Marginal Structural Models with Longitudinal Data","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"study work humans fundamentally interested questions causation. specifically, scientists, clinicians, educators, policymakers alike often interested causal processes involving questions (timing) levels (dose) different factors influence human functioning development, order inform scientific understanding improve people’s lives. However, many, conceptual, methodological, practical barriers prevented use methods causal inference developed fields. goal devMSMs package accompanying tutorial paper, Investigating Causal Questions Human Development Using Marginal Structural Models: Tutorial Introduction devMSMs Package R (insert preprint link ), provide set tools implementing marginal structural models (MSMs; Robins et al., 2000). MSMs orginated epidemiology public health represent one -utilized tool improving causal inference longitudinal observational data, given certain assumptions. brief, MSMs leverage inverse-probability--treatment-weights (IPTW) potential outcomes framework. MSMs first focus problem confounding, using IPTW attenuate associations measured confounders exposure (e.g., experience, characteristic, event –biology broader environment) time. weighted model can fitted relating time-varying exposure future outcome. Finally, model-predicted effects different exposure histories vary dose timing can evaluated compared counterfactuals, reveal putative causal effects. employ term exposure (sometimes referred “treatment” literatures) encompass variety environmental factors, individual characteristics, experiences constitute putative causal events within causal model. Exposures may distal proximal, reflecting developing child’s experience within different environments many levels (Bronfenbrenner & Ceci, 1994), ranging family (e.g., parenting), home (e.g., economic strain), school (e.g., teacher quality), neighborhood (e.g., diversity), greater politico-cultural-economic context (e.g., inequality). Exposures also reflect factors internal child, including neurodevelopmental (e.g., risk markers), physiological (e.g., stress), behavioral (e.g., anxiety) patterns child’s development exposed.","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"core-features","dir":"","previous_headings":"","what":"Core Features","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"Core features devMSMs include: flexible functions built-user guidance, drawing established expertise best practices implementing longitudinal IPTW weighting outcome modeling, answer substantive causal questions dose timing functions accept complete imputed data accommodate missingness often found human studies novel recommended workflow, based expertise several disciplines, using devMSMs functions longitudinal data (see Workflows vignettes) accompanying simulated longitudinal dataset, based real-world, Family Life Project (FLP) study human development, getting know package functions accompanying suite helper functions assist users preparing inspecting data prior implementation devMSMs executable, step--step user guidance implementing devMSMs workflow preliminary steps form vignettes geared toward users levels R programming experience, along R markdown template file brief conceptual introduction, example empirical application, additional resources accompanying tutorial paper","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"package contains 7 core functions implementing two phases MSM process: longitudinal confounder adjustment outcome modeling longitudinal data time-varying exposures. summary terms used devMSMs vignettes functions. details examples can found accompanying manuscript.","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"devMSMs can installed R Studio Github using devtools package: helper functions can installed accompanying devMSMsHelpers repo:","code":"require(devtools, quietly = TRUE) devtools::install_github(\"istallworthy/devMSMs\") library(devMSMs) devtools::install_github(\"istallworthy/devMSMsHelpers\") library(devMSMsHelpers)"},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"recommended-workflow","dir":"","previous_headings":"","what":"Recommended Workflow","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"propose recommended workflow using devMSMs answer causal questions longituinal data. suggest using vignettes order appear Articles tab. reading accompanying manuscript, recommend first reviewing Terminology Data Requirements vignettes begin preparing data. recommend downloading R markdown template file contains code described Specify Core Inputs Workflows vignettes (binary (TBA) continuous exposures) implementing steps .","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"citation--bug-reports","dir":"","previous_headings":"","what":"Citation & Bug Reports","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"Please cite use devMSMs using following citation: Stallworthy , Greifer N, DeJoseph M, Padrutt E, Butts K, Berry D (2024). devMSMs: Implementing Marginal Structural Models Longitudinal Data. R package version 0.0.0.9000, https://istallworthy.github.io/devMSMs/. Please report bugs following link: https://github.com/istallworthy/devMSMs/issues","code":""},{"path":"https://istallworthy.github.io/devMSMs/index.html","id":"additional-resources","dir":"","previous_headings":"","what":"Additional Resources","title":"Implementing Marginal Structural Models with Longitudinal Data","text":"Arel-Bundock, Diniz, M. ., Greifer, N., & Bacher, E. (2024). marginaleffects: Predictions, Comparisons, Slopes, Marginal Means, Hypothesis Tests (0.12.0) [Computer software]. https://cran.r-project.org/web/packages/marginaleffects/index.html. Austin, P. C. (2011). Introduction Propensity Score Methods Reducing Effects Confounding Observational Studies. Multivariate Behavioral Research, 46(3), 399–424. https://doi.org/10.1080/00273171.2011.568786 Blackwell, M. (2013). Framework Dynamic Causal Inference Political Science. American Journal Political Science, 57(2), 504–520. https://doi.org/10.1111/j.1540-5907.2012.00626.x Cole, S. R., & Hernán, M. . (2008). Constructing Inverse Probability Weights Marginal Structural Models. American Journal Epidemiology, 168(6), 656–664. https://doi.org/10.1093/aje/kwn164 Eronen, M. . (2020). Causal discovery problem psychological interventions. New Ideas Psychology, 59, 100785. https://doi.org/10.1016/j.newideapsych.2020.100785 Fong, C., Hazlett, C., & Imai, K. (2018).Covariate balancing propensity score continuous treatment: Application efficacy political advertisements. Annals Applied Statistics, 12(1), 156–177. https://doi.org/10.1214/17-AOAS1101 Foster, E. M. (2010). Causal inference developmental psychology. Developmental Psychology, 46(6), 1454–1480. https://doi.org/10.1037/a0020204 Greifer N (2024).cobalt: Covariate Balance Tables Plots. R package version 4.5.2, https://github.com/ngreifer/cobalt, https://ngreifer.github.io/cobalt/ Greifer N (2024). WeightIt: Weighting Covariate Balance Observational Studies. https://ngreifer.github.io/WeightIt/, https://github.com/ngreifer/WeightIt Jackson, John W.(2016). Diagnostics Confounding Time-varying Joint Exposures. Epidemiology, 2016 Nov, 27(6), 859-69. https://doi.org/10.1097/EDE.0000000000000547. Haber, N. ., Wood, M. E., Wieten, S., & Breskin, .(2022). DAG Omitted Objects Displayed (DAGWOOD): framework revealing causal assumptions DAGs. Annals Epidemiology, 68, 64–71. https://doi.org/10.1016/j.annepidem.2022.01.001 Hernán, M., & Robins, J. (2024). Causal Inference: . CRC Press. Hirano, K., & Imbens, G. W. (2004).Propensity Score Continuous Treatments. Applied Bayesian Modeling Causal Inference Incomplete-Data Perspectives (pp. 73–84). John Wiley & Sons, Ltd. https://doi.org/10.1002/0470090456.ch7 Kainz, K., Greifer, N., Givens, ., Swietek, K., Lombardi, B. M., Zietz, S., & Kohn, J. L. (2017). Improving Causal Inference: Recommendations Covariate Selection Balance Propensity Score Methods. Journal Society Social Work Research, 8(2), 279–303. https://doi.org/10.1086/691464 Loh, W. W., Ren, D., & West, S. G. (2024). Parametric g-formula Testing Time-Varying Causal Effects: , Matters, Implement Lavaan. Multivariate Behavioral Research, 59(5), 995–1018. https://doi.org/10.1080/00273171.2024.2354228 Pishgar, F., Greifer, N., Leyrat, C., & Stuart, E. (2021). MatchThem: Matching andWeighting Multiple Imputation. R Journal, 13(2), 292–305. https://doi.org/10.32614/RJ-2021-073 Robins, J. M., Hernán, M.Á., & Brumback, B. (2000). Marginal Structural Models Causal Inference Epidemiology. Epidemiology, 11(5), 550–560. Rubin, D. B. (2005). Causal Inference Using Potential Outcomes: Design, Modeling, Decisions. Journal American Statistical Association, 100(469), 322–331. https://doi.org/10.1198/016214504000001880 Rubin, D. B. (1974). Estimating causal effects treatments randomized nonrandomized studies. Journal Educational Psychology, 66(5), 688–701. https://doi.org/10.1037/h0037350 Stuart, E. . (2010). Matching methods causal inference: review look forward. Statistical Science : Review Journal Institute Mathematical Statistics, 25(1), 1–21. https://doi.org/10.1214/09-STS313 Stuart, E. . (2008). Developing practical recommendations use propensity scores: Discussion ‘critical appraisal propensity score matching medical literature 1996 2003’ Peter Austin, Statistics Medicine. Statistics Medicine, 27(12), 2062–2065. https://doi.org/10.1002/sim.3207 Textor, J. (2015). Drawing Analyzing Causal DAGs DAGitty. Thoemmes, F., & Ong, . D. (2016). Primer Inverse Probability Treatment Weighting Marginal Structural Models. https://doi.org/10.1177/2167696815621645 Woodward, J. (2005). Making Things Happen: Theory Causal Explanation. Oxford University Press, USA.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":null,"dir":"Reference","previous_headings":"","what":"Assesses confounder balancing — assessBalance","title":"Assesses confounder balancing — assessBalance","text":"Draws functions cobalt package quantify relations exposure confounders exposure time point according guidelines Jackson, 2016 assess balance time-varying exposures.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assesses confounder balancing — assessBalance","text":"","code":"assessBalance( data, obj, weights = NULL, balance_thresh = NULL, imp_conf = NULL, verbose = FALSE, save.out = FALSE ) # S3 method for class 'devMSM_bal_stats' print(x, i = NA, t = TRUE, save.out = FALSE, ...) # S3 method for class 'devMSM_bal_stats' summary(object, i = NA, save.out = FALSE, ...) # S3 method for class 'devMSM_bal_stats' plot(x, i = NA, t = TRUE, save.out = FALSE, ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assesses confounder balancing — assessBalance","text":"data data wide format : data frame, list imputed data frames, mids object mice package obj initialized MSM object initMSM() weights (optional) list IPTW weights output createWeights() balance_thresh (optional) one two numbers 0 1 indicating single balancing threshold thresholds less important confounders, respectively (default = 0.1) imp_conf (optional) list variable names reflecting important confounders, required two balance thresholds supplied verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. x devMSM_bal_stats object assessBalance multiply imputed datasets, selects imputation print results . Default = 1. = TRUE, imputed datasets looped . = NULL, average imputed datasets summarize . Ignored non-imputed data. t exposure variable use. Can either index 1 number exposures string containing exposure variable name (e.g. \".3\"). t = TRUE, exposure variables looped . ... ignored object devMSM_bal_stats object assessBalance()","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assesses confounder balancing — assessBalance","text":"list containing balance statistics dataframe. length number datasets (1 data.frame number imputed datasets)","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/assessBalance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assesses confounder balancing — assessBalance","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) # Prebalance b <- assessBalance(data = data, obj = obj) print(b) #> #> +----------+-----------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+===========+===============+============+==========+ #> | A.1 | C | 0.0928 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | C | 0.2457 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | B.1 | -0.0223 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | A.1 | 0.3289 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | C | 0.0321 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | B.1 | -0.0852 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | B.2 | 0.2001 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | A.1 | 0.0468 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | A.2 | -0.106 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points # returns ggplot of balance stats for all exposure variables plots <- plot(b, t = TRUE) # can plot only specific exposure time periods plot(b, t = \"A.3\") plot(b, t = 3) # Weighted f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) bw <- assessBalance(data = data, weights = w) print(bw) #> #> +----------+-----------+---------------+------------+----------+ #> | exposure | covariate | std_bal_stats | bal_thresh | balanced | #> +==========+===========+===============+============+==========+ #> | A.1 | C | -0.1136 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | C | -0.0279 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | B.1 | -0.0216 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.2 | A.1 | 0.1254 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | C | -0.0584 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | B.1 | -0.0606 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | B.2 | -0.0311 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | A.1 | -0.0195 | 0.1 | 1 | #> +----------+-----------+---------------+------------+----------+ #> | A.3 | A.2 | -0.1877 | 0.1 | 0 | #> +----------+-----------+---------------+------------+----------+ #> #> Table: Balance Stats for All Exposure Time Points plot(bw)"},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":null,"dir":"Reference","previous_headings":"","what":"Estimate, compare, and visualize exposure histories — compareHistories","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"Takes fitted model output created predicted values user-specified histories (pooling imputed data), conducting contrast comparisons (pooling imputed data), correcting multiple comparisons, plotting results.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"","code":"compareHistories( fit, hi_lo_cut, dose_level = \"h\", reference = NULL, comparison = NULL, mc_comp_method = \"BH\", verbose = FALSE, save.out = FALSE ) # S3 method for class 'devMSM_comparisons' print(x, save.out = FALSE, ...) # S3 method for class 'devMSM_comparisons' plot( x, colors = \"Dark2\", exp_lab = NULL, out_lab = NULL, save.out = FALSE, ... ) # S3 method for class 'devMSM_comparisons' summary(object, type = \"comps\", ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"fit list model outputs fitModel() hi_lo_cut list two numbers indicating quantile values reflect high low values, respectively, continuous exposure dose_level (optional) \"l\" \"h\" indicating whether low high doses tallied tables plots (default high \"h\") reference lists one strings \"-\"-separated \"l\" \"h\" values indicative reference exposure history compare comparison, required comparison supplied comparison (optional) list one strings \"-\"-separated \"l\" \"h\" values indicative comparison history/histories compare reference, required reference supplied mc_comp_method (optional) character abbreviation multiple comparison correction method stats::p.adjust, default Benjamini-Hochburg (\"BH\") verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. x devMSM_histories object compareHistories() ... ignored colors (optional) character specifying Brewer palette list colors (n(epochs)+1) plotting (default \"Dark2\" palette) exp_lab (optional) character label exposure variable plots (default variable name) out_lab (optional) character label outcome variable plots (default variable name) object devMSM_histories object compareHistories() type Either \"preds\" \"comps\" corresponding results marginaleffects::avg_predictions() low high dosages marginaleffects::avg_comparisons() respectively","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"list containing two dataframes: preds predictions marginaleffects::avg_predictions() containing average expected outcome different exposure histories comps contrasts marginaleffects::comparisons() comparing different exposure history","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/compareHistories.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Estimate, compare, and visualize exposure histories — compareHistories","text":"","code":"library(devMSMs) set.seed(123) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) fit <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m0\" ) comp <- compareHistories( fit = fit, hi_lo_cut = c(0.3, 0.6) ) print(comp) #> Summary of Exposure Main Effects: #> USER ALERT: Out of the total of 50 individuals in the sample, below is the distribution of the 50 (100%) individuals that fall into 24 user-selected exposure histories (out of the 24 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch A.1, A.2, A.3. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+---+ #> | epoch_history | n | #> +===============+===+ #> | NA-NA-h | 2 | #> +---------------+---+ #> | NA-NA-l | 1 | #> +---------------+---+ #> | NA-h-NA | 2 | #> +---------------+---+ #> | NA-h-h | 3 | #> +---------------+---+ #> | NA-h-l | 2 | #> +---------------+---+ #> | NA-l-NA | 1 | #> +---------------+---+ #> | NA-l-h | 2 | #> +---------------+---+ #> | NA-l-l | 2 | #> +---------------+---+ #> | h-NA-NA | 2 | #> +---------------+---+ #> | h-NA-h | 4 | #> +---------------+---+ #> | h-NA-l | 1 | #> +---------------+---+ #> | h-h-NA | 2 | #> +---------------+---+ #> | h-h-h | 3 | #> +---------------+---+ #> | h-h-l | 3 | #> +---------------+---+ #> | h-l-NA | 1 | #> +---------------+---+ #> | h-l-h | 2 | #> +---------------+---+ #> | h-l-l | 2 | #> +---------------+---+ #> | l-NA-NA | 3 | #> +---------------+---+ #> | l-NA-l | 2 | #> +---------------+---+ #> | l-h-NA | 2 | #> +---------------+---+ #> | l-h-h | 1 | #> +---------------+---+ #> | l-h-l | 2 | #> +---------------+---+ #> | l-l-NA | 2 | #> +---------------+---+ #> | l-l-h | 3 | #> +---------------+---+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects A.1, A.2, A.3: #> #> Below are the pooled average predictions by user-specified history: #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | term | A.1 | A.2 | A.3 | estimate | std.error | conf.low | conf.high | #> +=======+=======+=======+========+==========+===========+==========+===========+ #> | l-l-l | -0.47 | -0.3 | -0.804 | -0.15 | 0.2 | -0.54 | 0.239 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | l-l-h | -0.47 | -0.3 | -0.051 | -0.064 | 0.2 | -0.47 | 0.338 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | l-h-l | -0.47 | 0.31 | -0.804 | -0.093 | 0.18 | -0.44 | 0.25 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | l-h-h | -0.47 | 0.31 | -0.051 | -0.007 | 0.19 | -0.37 | 0.357 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-l-l | 0.24 | -0.3 | -0.804 | -0.235 | 0.15 | -0.53 | 0.059 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-l-h | 0.24 | -0.3 | -0.051 | -0.149 | 0.15 | -0.45 | 0.154 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-h-l | 0.24 | 0.31 | -0.804 | -0.179 | 0.13 | -0.43 | 0.07 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-h-h | 0.24 | 0.31 | -0.051 | -0.093 | 0.14 | -0.36 | 0.176 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+===============+============+===========+=============+============+==============+ #> | (l-l-l) - (l-l-h) | -0.0860245895 | 0.09323351 | 0.3561746 | -0.26875891 | 0.09670973 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (l-h-l) | -0.0567671468 | 0.06804542 | 0.4041380 | -0.19013372 | 0.07659943 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (l-h-h) | -0.1427917364 | 0.12113186 | 0.2384729 | -0.38020583 | 0.09462235 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (h-l-l) | 0.0855518211 | 0.09515347 | 0.3686031 | -0.10094556 | 0.27204920 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (h-l-h) | -0.0004727684 | 0.12853504 | 0.9970653 | -0.25239681 | 0.25145127 | 0.9970653 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (h-h-l) | 0.0287846743 | 0.12605827 | 0.8193787 | -0.21828499 | 0.27585434 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-l) - (h-h-h) | -0.0572399153 | 0.15718786 | 0.7157462 | -0.36532245 | 0.25084262 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (l-h-l) | 0.0292574427 | 0.10941845 | 0.7891686 | -0.18519878 | 0.24371366 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (l-h-h) | -0.0567671468 | 0.06804540 | 0.4041379 | -0.19013369 | 0.07659939 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (h-l-l) | 0.1715764106 | 0.13773921 | 0.2128887 | -0.09838748 | 0.44154030 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (h-l-h) | 0.0855518211 | 0.09515351 | 0.3686033 | -0.10094562 | 0.27204927 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (h-h-l) | 0.1148092638 | 0.15639156 | 0.4628791 | -0.19171256 | 0.42133108 | 0.6480308 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-l-h) - (h-h-h) | 0.0287846743 | 0.12605825 | 0.8193786 | -0.21828496 | 0.27585431 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (l-h-h) | -0.0860245895 | 0.09323348 | 0.3561744 | -0.26875886 | 0.09670968 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (h-l-l) | 0.1423189679 | 0.10713569 | 0.1840462 | -0.06766312 | 0.35230106 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (h-l-h) | 0.0562943784 | 0.13264560 | 0.6712764 | -0.20368622 | 0.31627498 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (h-h-l) | 0.0855518211 | 0.09515354 | 0.3686034 | -0.10094568 | 0.27204932 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-l) - (h-h-h) | -0.0004727684 | 0.12853506 | 0.9970653 | -0.25239686 | 0.25145133 | 0.9970653 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-h) - (h-l-l) | 0.2283435575 | 0.15081852 | 0.1300186 | -0.06725530 | 0.52394242 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-h) - (h-l-h) | 0.1423189679 | 0.10713569 | 0.1840463 | -0.06766313 | 0.35230107 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-h) - (h-h-l) | 0.1715764106 | 0.13773922 | 0.2128888 | -0.09838750 | 0.44154032 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (l-h-h) - (h-h-h) | 0.0855518211 | 0.09515352 | 0.3686034 | -0.10094565 | 0.27204929 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-l) - (h-l-h) | -0.0860245895 | 0.09323350 | 0.3561745 | -0.26875889 | 0.09670971 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-l) - (h-h-l) | -0.0567671468 | 0.06804546 | 0.4041383 | -0.19013380 | 0.07659951 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-l) - (h-h-h) | -0.1427917364 | 0.12113192 | 0.2384731 | -0.38020594 | 0.09462247 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-h) - (h-h-l) | 0.0292574427 | 0.10941843 | 0.7891686 | -0.18519874 | 0.24371362 | 0.8824078 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-l-h) - (h-h-h) | -0.0567671468 | 0.06804543 | 0.4041381 | -0.19013374 | 0.07659945 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ #> | (h-h-l) - (h-h-h) | -0.0860245895 | 0.09323350 | 0.3561745 | -0.26875888 | 0.09670970 | 0.5955722 | #> +-------------------+---------------+------------+-----------+-------------+------------+--------------+ plot(comp) summary(comp, \"preds\") #> term A.1 A.2 A.3 estimate std.error statistic #> 1 l-l-l -0.4684962 -0.2971206 -0.80434443 -0.149799589 0.1983536 -0.75521501 #> 2 l-l-h -0.4684962 -0.2971206 -0.05134827 -0.063774999 0.2048054 -0.31139320 #> 3 l-h-l -0.4684962 0.3148300 -0.80434443 -0.093032442 0.1750306 -0.53152099 #> 4 l-h-h -0.4684962 0.3148300 -0.05134827 -0.007007852 0.1859760 -0.03768148 #> 5 h-l-l 0.2359494 -0.2971206 -0.80434443 -0.235351410 0.1502513 -1.56638563 #> 6 h-l-h 0.2359494 -0.2971206 -0.05134827 -0.149326820 0.1547615 -0.96488363 #> 7 h-h-l 0.2359494 0.3148300 -0.80434443 -0.178584263 0.1267806 -1.40860879 #> 8 h-h-h 0.2359494 0.3148300 -0.05134827 -0.092559673 0.1371105 -0.67507375 #> p.value s.value conf.low conf.high dose #> 1 0.4501200 1.15161848 -0.5385654 0.23896625 0 #> 2 0.7555017 0.40449305 -0.4651861 0.33763614 1 #> 3 0.5950578 0.74889829 -0.4360861 0.25002124 1 #> 4 0.9699416 0.04403015 -0.3715142 0.35749845 2 #> 5 0.1172584 3.09223725 -0.5298385 0.05913564 1 #> 6 0.3346031 1.57947727 -0.4526538 0.15400011 2 #> 7 0.1589509 2.65334711 -0.4270697 0.06990114 2 #> 8 0.4996289 1.00107114 -0.3612912 0.17617189 3 summary(comp, \"comps\") #> term estimate std.error statistic p.value #> 1 (l-l-l) - (l-l-h) -0.0860245895 0.09323351 -0.922678895 0.3561746 #> 2 (l-l-l) - (l-h-l) -0.0567671468 0.06804542 -0.834253748 0.4041380 #> 3 (l-l-l) - (l-h-h) -0.1427917364 0.12113186 -1.178812343 0.2384729 #> 4 (l-l-l) - (h-l-l) 0.0855518211 0.09515347 0.899092985 0.3686031 #> 5 (l-l-l) - (h-l-h) -0.0004727684 0.12853504 -0.003678129 0.9970653 #> 6 (l-l-l) - (h-h-l) 0.0287846743 0.12605827 0.228344197 0.8193787 #> 7 (l-l-l) - (h-h-h) -0.0572399153 0.15718786 -0.364149728 0.7157462 #> 8 (l-l-h) - (l-h-l) 0.0292574427 0.10941845 0.267390396 0.7891686 #> 9 (l-l-h) - (l-h-h) -0.0567671468 0.06804540 -0.834253950 0.4041379 #> 10 (l-l-h) - (h-l-l) 0.1715764106 0.13773921 1.245661352 0.2128887 #> 11 (l-l-h) - (h-l-h) 0.0855518211 0.09515351 0.899092683 0.3686033 #> 12 (l-l-h) - (h-h-l) 0.1148092638 0.15639156 0.734114205 0.4628791 #> 13 (l-l-h) - (h-h-h) 0.0287846743 0.12605825 0.228344230 0.8193786 #> 14 (l-h-l) - (l-h-h) -0.0860245895 0.09323348 -0.922679121 0.3561744 #> 15 (l-h-l) - (h-l-l) 0.1423189679 0.10713569 1.328399262 0.1840462 #> 16 (l-h-l) - (h-l-h) 0.0562943784 0.13264560 0.424396874 0.6712764 #> 17 (l-h-l) - (h-h-l) 0.0855518211 0.09515354 0.899092410 0.3686034 #> 18 (l-h-l) - (h-h-h) -0.0004727684 0.12853506 -0.003678128 0.9970653 #> 19 (l-h-h) - (h-l-l) 0.2283435575 0.15081852 1.514028672 0.1300186 #> 20 (l-h-h) - (h-l-h) 0.1423189679 0.10713569 1.328399184 0.1840463 #> 21 (l-h-h) - (h-h-l) 0.1715764106 0.13773922 1.245661276 0.2128888 #> 22 (l-h-h) - (h-h-h) 0.0855518211 0.09515352 0.899092564 0.3686034 #> 23 (h-l-l) - (h-l-h) -0.0860245895 0.09323350 -0.922678981 0.3561745 #> 24 (h-l-l) - (h-h-l) -0.0567671468 0.06804546 -0.834253253 0.4041383 #> 25 (h-l-l) - (h-h-h) -0.1427917364 0.12113192 -1.178811770 0.2384731 #> 26 (h-l-h) - (h-h-l) 0.0292574427 0.10941843 0.267390449 0.7891686 #> 27 (h-l-h) - (h-h-h) -0.0567671468 0.06804543 -0.834253622 0.4041381 #> 28 (h-h-l) - (h-h-h) -0.0860245895 0.09323350 -0.922679011 0.3561745 #> s.value conf.low conf.high dose p.value_corr #> 1 1.489343589 -0.26875891 0.09670973 0 - 1 0.5955722 #> 2 1.307080051 -0.19013372 0.07659943 0 - 1 0.5955722 #> 3 2.068102717 -0.38020583 0.09462235 0 - 2 0.5955722 #> 4 1.439859757 -0.10094556 0.27204920 0 - 1 0.5955722 #> 5 0.004240125 -0.25239681 0.25145127 0 - 2 0.9970653 #> 6 0.287397761 -0.21828499 0.27585434 0 - 2 0.8824078 #> 7 0.482479980 -0.36532245 0.25084262 0 - 3 0.8824078 #> 8 0.341594553 -0.18519878 0.24371366 1 - 1 0.8824078 #> 9 1.307080457 -0.19013369 0.07659939 1 - 2 0.5955722 #> 10 2.231828396 -0.09838748 0.44154030 1 - 1 0.5955722 #> 11 1.439859126 -0.10094562 0.27204927 1 - 2 0.5955722 #> 12 1.111292558 -0.19171256 0.42133108 1 - 2 0.6480308 #> 13 0.287397807 -0.21828496 0.27585431 1 - 3 0.8824078 #> 14 1.489344066 -0.26875886 0.09670968 1 - 2 0.5955722 #> 15 2.441859794 -0.06766312 0.35230106 1 - 1 0.5955722 #> 16 0.575021172 -0.20368622 0.31627498 1 - 2 0.8824078 #> 17 1.439858557 -0.10094568 0.27204932 1 - 2 0.5955722 #> 18 0.004240124 -0.25239686 0.25145133 1 - 3 0.9970653 #> 19 2.943210429 -0.06725530 0.52394242 2 - 1 0.5955722 #> 20 2.441859592 -0.06766313 0.35230107 2 - 2 0.5955722 #> 21 2.231828206 -0.09838750 0.44154032 2 - 2 0.5955722 #> 22 1.439858879 -0.10094565 0.27204929 2 - 3 0.5955722 #> 23 1.489343772 -0.26875889 0.09670971 1 - 2 0.5955722 #> 24 1.307079055 -0.19013380 0.07659951 1 - 2 0.5955722 #> 25 2.068101336 -0.38020594 0.09462247 1 - 3 0.5955722 #> 26 0.341594628 -0.18519874 0.24371362 2 - 2 0.8824078 #> 27 1.307079797 -0.19013374 0.07659945 2 - 3 0.5955722 #> 28 1.489343836 -0.26875888 0.09670970 2 - 3 0.5955722 comp2 <- compareHistories( fit = fit, hi_lo_cut = c(0.3, 0.6), reference = \"l-l-l\", comparison = c(\"h-h-h\", \"h-h-l\") ) print(comp2) #> Summary of Exposure Main Effects: #> Warning: There are no participants in your sample in the following histories: l-l-l. #> Please revise your reference/comparison histories and/or the high/low cutoffs, if applicable. #> USER ALERT: Out of the total of 50 individuals in the sample, below is the distribution of the 6 (12%) individuals that fall into 2 user-selected exposure histories (out of the 24 total) created from 30th and 60th percentile values for low and high levels of exposure-epoch A.1, A.2, A.3. #> USER ALERT: Please inspect the distribution of the sample across the following exposure histories and ensure there is sufficient spread to avoid extrapolation and low precision: #> #> +---------------+---+ #> | epoch_history | n | #> +===============+===+ #> | h-h-h | 3 | #> +---------------+---+ #> | h-h-l | 3 | #> +---------------+---+ #> #> Table: Summary of user-selected exposure histories based on exposure main effects A.1, A.2, A.3: #> #> Below are the pooled average predictions by user-specified history: #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | term | A.1 | A.2 | A.3 | estimate | std.error | conf.low | conf.high | #> +=======+=======+=======+========+==========+===========+==========+===========+ #> | l-l-l | -0.47 | -0.3 | -0.804 | -0.15 | 0.2 | -0.54 | 0.24 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-h-l | 0.24 | 0.31 | -0.804 | -0.179 | 0.13 | -0.43 | 0.07 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> | h-h-h | 0.24 | 0.31 | -0.051 | -0.093 | 0.14 | -0.36 | 0.18 | #> +-------+-------+-------+--------+----------+-----------+----------+-----------+ #> #> Conducting multiple comparison correction for all pairings between comparison histories and each refernece history using the BH method. #> #> #> +-------------------+-------------+-----------+-----------+------------+-----------+--------------+ #> | term | estimate | std.error | p.value | conf.low | conf.high | p.value_corr | #> +===================+=============+===========+===========+============+===========+==============+ #> | (h-h-h) - (l-l-l) | 0.05723992 | 0.1571879 | 0.7157462 | -0.2508426 | 0.3653225 | 0.8193787 | #> +-------------------+-------------+-----------+-----------+------------+-----------+--------------+ #> | (h-h-l) - (l-l-l) | -0.02878467 | 0.1260583 | 0.8193787 | -0.2758543 | 0.2182850 | 0.8193787 | #> +-------------------+-------------+-----------+-----------+------------+-----------+--------------+ plot(comp2) summary(comp2, \"preds\") #> term A.1 A.2 A.3 estimate std.error statistic #> 1 l-l-l -0.4684962 -0.2971206 -0.80434443 -0.14979959 0.1983536 -0.7552150 #> 7 h-h-l 0.2359494 0.3148300 -0.80434443 -0.17858426 0.1267806 -1.4086088 #> 8 h-h-h 0.2359494 0.3148300 -0.05134827 -0.09255967 0.1371105 -0.6750738 #> p.value s.value conf.low conf.high dose #> 1 0.4501200 1.151618 -0.5385654 0.23896625 0 #> 7 0.1589509 2.653347 -0.4270697 0.06990114 2 #> 8 0.4996289 1.001071 -0.3612912 0.17617189 3 summary(comp2, \"comps\") #> term estimate std.error statistic p.value s.value #> 1 (h-h-h) - (l-l-l) 0.05723992 0.1571879 0.3641497 0.7157462 0.4824800 #> 2 (h-h-l) - (l-l-l) -0.02878467 0.1260583 -0.2283442 0.8193787 0.2873978 #> conf.low conf.high dose p.value_corr #> 1 -0.2508426 0.3653225 3 - 0 0.8193787 #> 2 -0.2758543 0.2182850 2 - 0 0.8193787"},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":null,"dir":"Reference","previous_headings":"","what":"Create balancing formulas — createFormulas","title":"Create balancing formulas — createFormulas","text":"Creates balancing formulas relating exposure relevant time-varying time invariant confounders exposure time point used create IPTW weights.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create balancing formulas — createFormulas","text":"","code":"createFormulas( obj, type = c(\"full\", \"short\", \"update\"), custom = NULL, keep_conf = NULL, bal_stats = NULL, verbose = FALSE, save.out = FALSE ) # S3 method for class 'devMSM_formulas' print(x, ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create balancing formulas — createFormulas","text":"obj initialized MSM object initMSM() type type formula create 'full' (includes lagged time-varying confounders), 'short' (includes time-varying confounders t-1 lag ), 'update' (adds 'short' formulas imbalanced time-varying confounders lags great t-1) custom (optional) custom list formulas exposure time point (default create automatically according type) keep_conf (optional) 'short' formulas , list variable names reflecting confounders included always. bal_stats list balance statistics assessBalance() verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. x devMSM_formulas object createFormulas() ... ignored","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create balancing formulas — createFormulas","text":"list containing balancing formulas. length number exposure variables.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createFormulas.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create balancing formulas — createFormulas","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) # Full Formulas f <- createFormulas(obj, type = \"full\") print(f) #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 1, the full formula for A.1 is: #> A.1 ~ C #> #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 2, the full formula for A.2 is: #> A.2 ~ C + B.1 + A.1 #> #> USER ALERT: Please manually inspect the full balancing formula below: #> At time point 3, the full formula for A.3 is: #> A.3 ~ C + B.1 + B.2 + A.1 + A.2 # Short Formulas f <- createFormulas(obj, type = \"short\") print(f) #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 1, the short formula for A.1 is: #> A.1 ~ C #> #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 2, the short formula for A.2 is: #> A.2 ~ C + B.1 + A.1 #> #> USER ALERT: Please manually inspect the short balancing formula below that includes time-varying confounders at t-1 only: #> At time point 3, the short formula for A.3 is: #> A.3 ~ C + B.2 + A.2 # Update Formulas w <- createWeights(data = data, formulas = f) b <- assessBalance(data = data, weights = w) f <- createFormulas(obj, type = \"update\", bal_stats = b) print(f) #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 1, the update formula for A.1 is: #> A.1 ~ C #> #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 2, the update formula for A.2 is: #> A.2 ~ C + B.1 + A.1 #> #> USER ALERT: Please manually inspect the updated balancing formula below that includes time-varying confounders at t-1 and those greater at further lags that remained imbalanced: #> At time point 3, the update formula for A.3 is: #> A.3 ~ C + B.2 + A.2 + A.1"},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":null,"dir":"Reference","previous_headings":"","what":"Creates IPTW balancing weights — createWeights","title":"Creates IPTW balancing weights — createWeights","text":"Creates IPTW balancing weights user-specified exposure time point using balancing formulas relate exposure time point relevant confounders.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Creates IPTW balancing weights — createWeights","text":"","code":"createWeights( data, formulas, method = \"glm\", verbose = FALSE, save.out = FALSE, ... ) # S3 method for class 'devMSM_weights' print(x, i = 1, ...) # S3 method for class 'devMSM_weights' plot(x, i = 1, save.out = FALSE, ...) # S3 method for class 'devMSM_weights' summary(object, i = 1, ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Creates IPTW balancing weights — createWeights","text":"data data wide format : data frame, list imputed data frames, mids object mice package formulas list balancing formulas time point output createFormulas() method character string weightitMSM() balancing method abbreviation (default generalized linear models propensity score weighting \"glm\") verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. ... arguments passed WeightIt::weightitMSM() summary.weightitMSM() x, object devMSM_weights object createWeights() multiply imputed datasets, selects imputation print results . Default = 1. = TRUE, imputed datasets looped . = NULL, average imputed datasets summarize . Ignored non-imputed data.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Creates IPTW balancing weights — createWeights","text":"list containing WeightIt::weightitMSM() output. length number datasets (1 data.frame number imputed datasets).","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/createWeights.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Creates IPTW balancing weights — createWeights","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) print(w) #> #> For the `glm` weighting method, the median weight value is 1.04 (SD = 0.41; range = 0.3-3). plot(w) # Methods from `WeightIt::weightitMSM` w <- createWeights(data = data, formulas = f, method = \"glm\") w <- createWeights(data = data, formulas = f, method = \"cbps\") w <- createWeights(data = data, formulas = f, method = \"gbm\") w <- createWeights(data = data, formulas = f, method = \"bart\") w <- createWeights(data = data, formulas = f, method = \"super\") #> Loading required package: nnls #> Warning: All algorithms have zero weight #> Warning: All metalearner coefficients are zero, predictions will all be equal to 0"},{"path":"https://istallworthy.github.io/devMSMs/reference/devMSMs-package.html","id":null,"dir":"Reference","previous_headings":"","what":"devMSMs: Implementing Marginal Structural Models with Longitudinal Data — devMSMs-package","title":"devMSMs: Implementing Marginal Structural Models with Longitudinal Data — devMSMs-package","text":"Functions implementing MSMS longitudinal data.","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/devMSMs-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"devMSMs: Implementing Marginal Structural Models with Longitudinal Data — devMSMs-package","text":"Maintainer: Isabella Stallworthy istall@seas.upenn.edu Authors: Noah Greifer noah.greifer@gmail.com (ORCID) [contributor] Meriah DeJoseph meriahd@stanford.edu Emily Padrutt padru004@umn.edu Daniel Berry dberry@umn.edu contributors: Kyle Butts buttskyle96@gmail.com [contributor]","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit outcome model — fitModel","title":"Fit outcome model — fitModel","text":"Fits weighted marginal outcome model generalized linear model user's choosing, relating exposure main effects outcome using IPTW weights.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit outcome model — fitModel","text":"","code":"fitModel( data, obj, weights = NULL, outcome, model = \"m0\", int_order = NA, covariates = NULL, family = gaussian(), link = \"identity\", verbose = FALSE, save.out = FALSE ) # S3 method for class 'devMSM_models' print(x, i = NA, save.out = FALSE, ...)"},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit outcome model — fitModel","text":"data data wide format : data frame, list imputed data frames, mids object mice package obj initialized MSM object initMSM() weights list IPTW weights output createWeights() outcome name outcome variable \".timepoint\" suffix. See initMSM() details suffix model character indicating one following outcome models: \"m0\" (exposure main effects) \"m1\" (exposure main effects & covariates) \"m2\" (exposure main effects & interactions) \"m3\" (exposure main effects, interactions, & covariates) int_order integer specification highest order exposure main effects interaction, required interaction models (\"m2\", \"m3\") covariates list characters reflecting variable names covariates, required covariate models (\"m1\", \"m3\") family (optional) family function specification WeightIt::glm_weightit() model. link (optional) link function specification WeightIt::glm_weightit() model. verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE. x devMSM_models object fitModel multiply imputed datasets, selects imputation print results . Default = 1. = TRUE, imputed datasets looped . = NULL, average imputed datasets summarize . Ignored non-imputed data. ... ignored","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit outcome model — fitModel","text":"list containing WeightIt::glm_weightit() model output. length number datasets (1 data.frame number imputed datasets)","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/fitModel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fit outcome model — fitModel","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) fit_m0 <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m0\" ) print(fit_m0) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> #> Wald test #> Variance: HC0 robust (adjusted for estimation of weights) #> #> Model 1: D.3 ~ A.1 + A.2 + A.3 #> Model 2: D.3 ~ 1 #> #> Res.Df Df Chisq Pr(>Chisq) #> 1 46 #> 2 49 3 17.511 0.0005548 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> #> The marginal model, m0, is summarized below: #> +-------------+--------+-----------------+-------+ #> | | (1) | #> +-------------+--------+-----------------+-------+ #> | | Est. | CI | p | #> +=============+========+=================+=======+ #> | (Intercept) | 0.224 | [-0.011, 0.460] | 0.062 | #> +-------------+--------+-----------------+-------+ #> | A.1 | 0.350 | [0.141, 0.560] | 0.001 | #> +-------------+--------+-----------------+-------+ #> | A.2 | -0.186 | [-0.432, 0.060] | 0.139 | #> +-------------+--------+-----------------+-------+ #> | A.3 | -0.284 | [-0.682, 0.114] | 0.163 | #> +-------------+--------+-----------------+-------+ #> | Num.Obs. | 50 | | | #> +-------------+--------+-----------------+-------+ fit_m1 <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m1\", covariates = c(\"C\") ) print(fit_m1) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> #> Wald test #> Variance: HC0 robust (adjusted for estimation of weights) #> #> Model 1: D.3 ~ A.1 + A.2 + A.3 + C #> Model 2: D.3 ~ C #> #> Res.Df Df Chisq Pr(>Chisq) #> 1 45 #> 2 48 3 17.633 0.0005236 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> #> The marginal model, m1, is summarized below: #> +-------------+--------+-----------------+--------+ #> | | (1) | #> +-------------+--------+-----------------+--------+ #> | | Est. | CI | p | #> +=============+========+=================+========+ #> | (Intercept) | 0.222 | [-0.013, 0.458] | 0.064 | #> +-------------+--------+-----------------+--------+ #> | A.1 | 0.352 | [0.143, 0.561] | <0.001 | #> +-------------+--------+-----------------+--------+ #> | A.2 | -0.185 | [-0.432, 0.062] | 0.142 | #> +-------------+--------+-----------------+--------+ #> | A.3 | -0.287 | [-0.689, 0.116] | 0.163 | #> +-------------+--------+-----------------+--------+ #> | C | -0.044 | [-0.277, 0.188] | 0.708 | #> +-------------+--------+-----------------+--------+ #> | Num.Obs. | 50 | | | #> +-------------+--------+-----------------+--------+ fit_m2 <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m2\", int_order = 2 ) print(fit_m2) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> #> Wald test #> Variance: HC0 robust (adjusted for estimation of weights) #> #> Model 1: D.3 ~ A.1 + A.2 + A.3 + A.1 + A.2 + A.3 + A.1:A.2 + A.1:A.3 + A.2:A.3 #> Model 2: D.3 ~ 1 #> #> Res.Df Df Chisq Pr(>Chisq) #> 1 43 #> 2 49 6 19.785 0.003024 ** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> #> The marginal model, m2, is summarized below: #> +-------------+--------+-----------------+-------+ #> | | (1) | #> +-------------+--------+-----------------+-------+ #> | | Est. | CI | p | #> +=============+========+=================+=======+ #> | (Intercept) | 0.207 | [-0.031, 0.446] | 0.089 | #> +-------------+--------+-----------------+-------+ #> | A.1 | 0.404 | [0.161, 0.647] | 0.001 | #> +-------------+--------+-----------------+-------+ #> | A.2 | -0.145 | [-0.420, 0.131] | 0.303 | #> +-------------+--------+-----------------+-------+ #> | A.3 | -0.318 | [-0.650, 0.013] | 0.060 | #> +-------------+--------+-----------------+-------+ #> | A.1 × A.2 | 0.234 | [-0.036, 0.505] | 0.089 | #> +-------------+--------+-----------------+-------+ #> | A.1 × A.3 | -0.018 | [-0.364, 0.328] | 0.918 | #> +-------------+--------+-----------------+-------+ #> | A.2 × A.3 | 0.247 | [-0.090, 0.584] | 0.152 | #> +-------------+--------+-----------------+-------+ #> | Num.Obs. | 50 | | | #> +-------------+--------+-----------------+-------+ fit_m3 <- fitModel( data = data, weights = w, outcome = \"D.3\", model = \"m3\", int_order = 2, covariates = c(\"C\") ) print(fit_m3) #> Please inspect the Wald test to determine if the exposures collectively predict significant variation in the outcome compared to a model without exposure terms. #> We strongly suggest only conducting history comparisons if the test is significant. #> #> Wald test #> Variance: HC0 robust (adjusted for estimation of weights) #> #> Model 1: D.3 ~ A.1 + A.2 + A.3 + A.1 + A.2 + A.3 + C + A.1:A.2 + A.1:A.3 + A.1:C + A.2:A.3 + A.2:C + A.3:C #> Model 2: D.3 ~ C #> #> Res.Df Df Chisq Pr(>Chisq) #> 1 39 #> 2 48 9 23.536 0.005098 ** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> #> The marginal model, m3, is summarized below: #> +-------------+--------+------------------+--------+ #> | | (1) | #> +-------------+--------+------------------+--------+ #> | | Est. | CI | p | #> +=============+========+==================+========+ #> | (Intercept) | 0.187 | [-0.058, 0.432] | 0.134 | #> +-------------+--------+------------------+--------+ #> | A.1 | 0.422 | [0.182, 0.662] | <0.001 | #> +-------------+--------+------------------+--------+ #> | A.2 | -0.126 | [-0.411, 0.159] | 0.387 | #> +-------------+--------+------------------+--------+ #> | A.3 | -0.353 | [-0.654, -0.053] | 0.021 | #> +-------------+--------+------------------+--------+ #> | C | -0.137 | [-0.360, 0.087] | 0.231 | #> +-------------+--------+------------------+--------+ #> | A.1 × A.2 | 0.238 | [-0.067, 0.542] | 0.126 | #> +-------------+--------+------------------+--------+ #> | A.1 × A.3 | 0.013 | [-0.352, 0.377] | 0.946 | #> +-------------+--------+------------------+--------+ #> | A.1 × C | 0.156 | [-0.102, 0.414] | 0.236 | #> +-------------+--------+------------------+--------+ #> | A.2 × A.3 | 0.281 | [-0.051, 0.614] | 0.097 | #> +-------------+--------+------------------+--------+ #> | A.2 × C | 0.199 | [-0.055, 0.454] | 0.124 | #> +-------------+--------+------------------+--------+ #> | A.3 × C | -0.080 | [-0.432, 0.271] | 0.655 | #> +-------------+--------+------------------+--------+ #> | Num.Obs. | 50 | | | #> +-------------+--------+------------------+--------+"},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":null,"dir":"Reference","previous_headings":"","what":"Initial step in devMSMs workflow — initMSM","title":"Initial step in devMSMs workflow — initMSM","text":"Initial step devMSMs workflow","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initial step in devMSMs workflow — initMSM","text":"","code":"initMSM( data, exposure, epoch = NULL, tv_conf, ti_conf = NULL, concur_conf = NULL, home_dir = NULL, sep = \"[\\\\._]\" )"},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initial step in devMSMs workflow — initMSM","text":"data data wide format : data frame, list imputed data frames, mids object mice package exposure names exposure variables \".timepoint\" suffix epoch (optional) group set exposure variables categories. Provide character vector corresponding category exposure tv_conf list time-varying confounders \".timepoint\" suffix, include exposure outcome variables (least time-varying exposure variables required ) ti_conf list time invariant confounders. Can left NULL none. concur_conf (optional) list variable names reflecting time-varying confounders retain formulas contemporaneously (default none) home_dir (optional) directory saving output. Either absolute path relative path respect getwd() sep (optional) seperator variable time period. variable names split last occurance sep second string containing time. uses regex notation, . must \\\\.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Initial step in devMSMs workflow — initMSM","text":"object class devMSM contains initialized information.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Initial step in devMSMs workflow — initMSM","text":".timepoint suffix, mean time-varying exposure variable names must end either .# _#. allows us extract time-period variable measured allow us properly create formulae (omitting future mediators)","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/initMSM.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initial step in devMSMs workflow — initMSM","text":"","code":"data <- data.frame( A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), D.3 = rnorm(n = 50), L.1 = sample(c(0, 1), size = 50, replace = TRUE), C = rnorm(n = 50) ) obj <- initMSM( data = data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\"), ti_conf = \"C\" ) obj #> Exposure (continuous): A.1, A.2, A.3 #> Variable and their encodings: #> var type time #> A.1 exposure 1 #> A.2 exposure 2 #> A.3 exposure 3 #> B.1 tv_conf 1 #> B.2 tv_conf 2 #> B.3 tv_conf 3 #> D.3 tv_conf 3 #> C ti_conf -1"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_imp_list.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","title":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package imputing mice package reading imputed dataset. data contain economic strain (ESEATA1) continuously distributed variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_imp_list.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","text":"","code":"sim_data_imp_list"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_imp_list.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_imp_list.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide data imputed and read in (continuous exposure) — sim_data_imp_list.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","title":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package. data contain economic strain (ESEATA1) continuously distributed variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","text":"","code":"sim_data_long_miss"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","text":"long data frame 6, 458 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"WAVE\" age (months) data collected \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Long data with missingness (continuous exposure) — sim_data_long_miss.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss_bin.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Long data with missingness (binary exposure) — sim_data_long_miss_bin.rda","title":"Long data with missingness (binary exposure) — sim_data_long_miss_bin.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package. data contain economic strain (ESEATA1) binary variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss_bin.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Long data with missingness (binary exposure) — sim_data_long_miss_bin.rda","text":"","code":"sim_data_long_miss_bin"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_long_miss_bin.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Long data with missingness (binary exposure) — sim_data_long_miss_bin.rda","text":"long data frame 6,458 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"WAVE\" age (months) data collected \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety #' @references DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_mice.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","title":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package prior imputation using mice via random forest. data contain economic strain (ESEATA1) continuously distributed variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_mice.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","text":"","code":"sim_data_mice"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_mice.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_mice.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide data imputed with mice (continuous exposure) — sim_data_mice.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","title":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","text":"Wide complete data (continuous exposure) data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). data contain economic strain (ESEATA1) continuously distributed variable missing data.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","text":"","code":"sim_data_wide"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide complete data (continuous exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a continuously distributed variable and have no missing data. — sim_data_wide.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_bin.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","title":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","text":"Wide complete data (binary exposure) data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). data contain economic strain (ESEATA1) binary variable, missing data.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_bin.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","text":"","code":"sim_data_wide_bin"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_bin.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_bin.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide complete data (binary exposure) These data are simulated based on data from the Family Life Project (FLP), a longitudinal study following 1,292 families representative of two geographic areas (three counties in North Carolina and three counties in Pennsylvania) with high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). These data contain economic strain (ESEATA1) as a binary variable, and have no missing data. — sim_data_wide_bin.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","title":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package. data contain economic strain (ESEATA1) continuously distributed variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","text":"","code":"sim_data_wide_miss"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide data with missingness (continuous exposure) — sim_data_wide_miss.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss_bin.rda.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","title":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","text":"data simulated based data Family Life Project (FLP), longitudinal study following 1,292 families representative two geographic areas (three counties North Carolina three counties Pennsylvania) high rural child poverty (Vernon-Feagans et al., 2013; Burchinal et al., 2008). MAR missingness added using missMethods package. data contain economic strain (ESEATA1) binary variable.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss_bin.rda.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","text":"","code":"sim_data_wide_miss_bin"},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss_bin.rda.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","text":"wide data frame 1,292 observations 36 measured variables collected one following time points: 6, 15, 24, 35, 58 months. \"ID\" subject id \"ESETA1\" continuous exposure economic strain \"StrDif_Tot.58\" continuous outcome behavioral problems \"InRatioCor\" continuous income--needs ratio \"PmEd2\" parent's education level (0-11 = less high school, 12 = GED, 13 = GED additional training, 14 = high school grad, 15 = high school additional training, 16 = college, 17 = associates degree, 18 = four year college degree, 19 = post college, 20 = masters degree, 21 = professional degree, 22 = PhD) \"state\" family's state residence (NC = North Carolina, PA = Pennslyvania) \"TcBlac2\" child's race (1 = Black, 0 = White) \"bioDadInHH2\" whether biological father lives family (1 = yes, 0 = ) \"HomeOwnd\" whether family owns home (1 = owned bought family, 2 = owned bought someone else, 3 = rented rent, 4 = occupied without payment rent) \"KFASTScr\" continuous score caregiver reading comprehension \"PmBlac2\" primary caregiver's race (1 = Black, 0 = White) \"PmAge2\" primary caregiver age years \"PmMrSt2\" caregiver marital status (1 = single, 2 = married living spouse, 3 = married living spouse, 4 = divorced, 5 = separated, 6 = widowed) \"RMomAgeU\" continuous age years biological mother caregiver born \"RHealth\" index general caregiver health (1 = excellent, 2 = good, 3 = good, 4 = fair, 5 = poor) \"RHasSO\" whether caregiver significant (1 = yes, 0 = ) \"SmokTotl\" total cigarettes biological mother smoked pregnant (1 = 21 cigarettes less, 2 = 2 - 99 cigarettes, 3 = 100 cigarettes) \"caregiv_health\" sum score caregiver health problems including emotional problems, ADHD, asthma, cancer, high blood pressure, limited mobility, learning disability, general subjective health, mental health, overwight, seizures, depression, diabetes \"peri_health\" sum score pregnancy/birth health including excessive vomitting, fetal distress, colic, alcohol, high blood pressure, heavy bleeding, infection, congenital issues, stay pediatric intensive care, labor induction, independent breathing birth, surgery, NICU, smoked pregnant, breach, excessive weight loss, incubation, water retention, c-section \"SWghtLB\" child birth weight pounds \"SurpPreg\" whether caregiver surprise pregnancy (1 = yes, 0 = ) \"DrnkFreq\" frequently caregiver drank pregnant (1 = never, 2 = twice, 3 = month, 4 = twice month, 5 = couple times/week, 6 = everyday) \"gov_assist\" sum score whether family received government benefits including early headstart, early intervention, food stamps, subsidized childcare, heating assistance, government housing, transportation, school free lunch, WIC, AFDC \"ALI_LE\" continuous child language expression \"B18Raw\" continuous caregiver total depression problems \"CORTB\" continuous child salivary cortisol rest \"EARS_TJo\" \"fscore\" continuous executive function factor score \"HOMEETA1\" continuous sociocognitive resources factor score \"IBRAttn\" continuous child total joint attention \"LESMnNeg\" continuous family negative life events \"LESMnPos\" continuous family positive life events \"MDI\" continuous child Bayely mental development index \"RHAsSO\" whether caregiver significant given time (1 = yes, 0 = ) \"SAAmylase\" continuous child salivary alpha amylase rest \"WndNbrhood\" continuous neighborhood safety","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/sim_data_wide_miss_bin.rda.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Wide data with missingness (binary exposure) — sim_data_wide_miss_bin.rda","text":"DeJoseph, M. L., Sifre, R. D., Raver, C. C., Blair, C. B., & Berry, D. (2021). Capturing Environmental Dimensions Adversity Resources Context Poverty Across Infancy Early Adolescence: Moderated Nonlinear Factor Model. Child Development, n/(n/). https://doi.org/10.1111/cdev.13504 Burchinal, M., Howes, C., Pianta, R., Bryant, D., Early, D., Clifford, R., & Barbarin, O. (2008). Predicting Child Outcomes End Kindergarten Quality Pre-Kindergarten Teacher–Child Interactions Instruction. Applied Developmental Science, 12(3), 140–153. https://doi.org/10.1080/10888690802199418 Vernon-Feagans, L., Cox, M., Willoughby, M., Burchinal, M., Garrett-Peters, P., Mills-Koonce, R., Garrett-Peiers, P., Conger, R. D., & Bauer, P. J. (2013). Family Life Project: Epidemiological Developmental Study Young Children Living Poor Rural Communities. Monographs Society Research Child Development, 78(5), –150. Willoughby, M. T., Blair, C. B., Wirth, R. J., & Greenberg, M. (2010). measurement executive function age 3 years: psychometric properties criterion validity new battery tasks. Psychological assessment, 22(2), 306.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":null,"dir":"Reference","previous_headings":"","what":"Trim IPTW balancing weights, if needed — trimWeights","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"Trims IPTW balancing weights heavy right tails populating weight values given quantile weight value quantile.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"","code":"trimWeights(weights, at = 0, lower = FALSE, verbose = FALSE, save.out = FALSE)"},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"weights list IPTW weights output createWeights() numeric; either quantile weights weights trimmed. single number .5 1, number weights trimmed (e.g., = 3 top 3 weights set 4th largest weight). lower logical; whether also trim lower quantile (e.g., = .9, trimming .1 .9, = 3, trimming top bottom 3 weights). Default FALSE trim higher weights. verbose (optional) TRUE FALSE indicator printing output console. default FALSE. save.(optional) Either logical character string. TRUE, output result default file name within home_dir set initMSM(). can load data x <- readRDS(file). use non-default file name, specify character string file name. save relative home_dir. might naming conflicts two objects get saved file. cases, users specify custom name. default FALSE.","code":""},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"list containing WeightIt::weightitMSM() output. length number datasets (1 data.frame number imputed datasets).","code":""},{"path":[]},{"path":"https://istallworthy.github.io/devMSMs/reference/trimWeights.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Trim IPTW balancing weights, if needed — trimWeights","text":"","code":"library(devMSMs) data <- data.frame( ID = 1:50, A.1 = rnorm(n = 50), A.2 = rnorm(n = 50), A.3 = rnorm(n = 50), B.1 = rnorm(n = 50), B.2 = rnorm(n = 50), B.3 = rnorm(n = 50), C = rnorm(n = 50), D.3 = rnorm(n = 50) ) obj <- initMSM( data, exposure = c(\"A.1\", \"A.2\", \"A.3\"), ti_conf = c(\"C\"), tv_conf = c(\"B.1\", \"B.2\", \"B.3\", \"D.3\") ) f <- createFormulas(obj, type = \"short\") w <- createWeights(data = data, formulas = f) tw <- trimWeights(w, at = 0.975) print(tw) #> #> For the `glm` weighting method, after trimming at 97.5th quantile, the median weight value is 0.97 (SD = 0.32; range = 0.43-2). plot(tw) trimWeights(w, at = 0.975, lower = TRUE) #> #> For the `glm` weighting method, after trimming between 2.5th and 97.5th quantiles, the median weight value is 0.97 (SD = 0.32; range = 0.43-2)."}]