#> #> #> | | 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":"P.4 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":"P.4 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":"P.4 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":"P.4 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":"P.4 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/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--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, 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. (2023). 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 Greifer N (2023). cobalt: Covariate Balance Tables Plots. R package version 4.5.2, https://github.com/ngreifer/cobalt, https://ngreifer.github.io/cobalt/ Greifer N (2023). 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 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 Robins, J. M., Hernán, M. Á., & Brumback, B. (2000). Marginal Structural Models Causal Inference Epidemiology. Epidemiology, 11(5), 550–560. Thoemmes, F., & Ong, . D. (2016). Primer Inverse Probability Treatment Weighting Marginal Structural Models. https://doi.org/10.1177/2167696815621645","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)."}]
diff --git a/sitemap.xml b/sitemap.xml
index c165c06a..b4379c21 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -2,6 +2,7 @@
https://istallworthy.github.io/devMSMs/404.html
https://istallworthy.github.io/devMSMs/articles/Assessing_Balance_Tv.html
https://istallworthy.github.io/devMSMs/articles/Customize_Balancing_Formulas.html
+https://istallworthy.github.io/devMSMs/articles/Data_Requirements.html
https://istallworthy.github.io/devMSMs/articles/index.html
https://istallworthy.github.io/devMSMs/authors.html
https://istallworthy.github.io/devMSMs/index.html
From 072d03f6a32faa62265d2ab4bf802e141aee091c Mon Sep 17 00:00:00 2001
From: "Isabella Stallworthy, PhD"
Date: Tue, 8 Oct 2024 13:38:29 -0400
Subject: [PATCH 2/2] core inputs vig
---
_pkgdown.yml | 2 +
vignettes/Customize_Balancing_Formulas.qmd | 12 +-
vignettes/Specify_Core_Inputs.qmd | 205 +++++++++++++++++++++
3 files changed, 213 insertions(+), 6 deletions(-)
create mode 100644 vignettes/Specify_Core_Inputs.qmd
diff --git a/_pkgdown.yml b/_pkgdown.yml
index d7f3b497..5cbb7f2d 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -17,6 +17,8 @@ navbar:
articles:
text: Articles
menu:
+ - text: Specify Core Inputs
+ href: articles/Specify_Core_Inputs.html
- text: Data Requirements & Preparation
href: articles/Data_Requirements.html
- text: Assessing Balance for Time-Varying Exposures
diff --git a/vignettes/Customize_Balancing_Formulas.qmd b/vignettes/Customize_Balancing_Formulas.qmd
index 0b19995d..ac514158 100644
--- a/vignettes/Customize_Balancing_Formulas.qmd
+++ b/vignettes/Customize_Balancing_Formulas.qmd
@@ -39,7 +39,7 @@ require(devMSMs, quietly = TRUE)
```
-## Core Inputs
+# Core Inputs
We specify core inputs to the *devMSMs* functions.
@@ -88,11 +88,11 @@ Below, we illustrate the customization options for each of the three modes of th
-## Customize Full Weights Formulas (Steps 1 & 4)
+# Customize Full Weights Formulas (Steps 1 & 4)
The default use of `createFormulas()` with `type` = "full" creates weights formulas at each exposure time point. Each formula contains all time invariant confounders as well as all time-varying confounders measured at time points prior to that exposure time point. For example, for the 24-month weights formula, we would have time-varying confounders only at 6 and 15 months.
-### Time-Varying Confounders Measured Contemporaneously With Exposure Time Point
+## Time-Varying Confounders Measured Contemporaneously With Exposure Time Point
However, if users wish to also include any time-varying confounders measured contemporaneously with the exposure time point (e.g., also include 24-month time-varying confounders in the 24-month weights formula), they can specify those time-varying confounders in the optional argument to `initMSM()`, `concur_conf`.
@@ -121,7 +121,7 @@ print(full_formulas)
Now `B18Raw.24` is included in the 24-month weights formula in addition to the 35-and 58-month formulas.
-### Fully Custom Formulas
+# Fully Custom Formulas
Alternatively, a user could completely customize the full formulas by manually creating formulas for each exposure time point using the optional `custom` argument.
@@ -152,7 +152,7 @@ print(full_formulas)
-## Customize Short Weights Formulas (Step 2)
+# Customize Short Weights Formulas (Step 2)
The default use of `createFormulas()` with `type` = "short" creates shortened weights formulas at each exposure time point. Each formula contains all time invariant confounders as well as only those time-varying confounders measured at the time point directly prior (*t*-1 lag) to that exposure time point. For example, for the 24-month weights formula, we would only include time-varying confounders at 15 months. Please see the *Workflows* vignettes and accompanying manuscript for more detail.
@@ -173,7 +173,7 @@ print(short_formulas)
-### Customize Updated Weights Formulas (Step 3)
+# Customize Updated Weights Formulas (Step 3)
The default use of `createFormulas()` with `type` = "update" creates updated weights formulas at each exposure time point. Each formula contains all time invariant confounders; time-varying confounders measured at the time point directly prior (*t*-1 lag) to that exposure time point; as well as any time-varying confounders at greater lags that were not successfully balanced using the short weights formulas.
diff --git a/vignettes/Specify_Core_Inputs.qmd b/vignettes/Specify_Core_Inputs.qmd
new file mode 100644
index 00000000..63001b5c
--- /dev/null
+++ b/vignettes/Specify_Core_Inputs.qmd
@@ -0,0 +1,205 @@
+---
+title: "Specify Core Inputs"
+author: "Isabella Stallworthy"
+date: today
+format:
+ html:
+ df_print: kable
+ toc: true
+vignette: >
+ %\VignetteIndexEntry{Specify_Core_Inputs}
+ %\VignetteEncoding{UTF-8}s
+ %\VignetteEngine{quarto::html}
+---
+
+```{r, include = FALSE}
+knitr::opts_chunk$set(
+ collapse = TRUE,
+ comment = "#>"
+)
+options(repos = c(CRAN = "https://cloud.r-project.org/"))
+
+```
+
+
+
+This vignette guides users through the specification of the core inputs required by the *deMSMs* functions (and helper functions). Users should first view the Terminology and Data Requirements vignettes. This vignette helps users specify core inputs (e.g., home directory, exposure, time-varying confounders, time invariant confounders, outcome, reference, comparison, high/low cutoff for continuous exposure, and balance threshold) that are used by multiple functions in the *devMSMs* package (see *Workflows* vignettes). Their use and values should be kept consistent throughout the package. Additionally, all functions have two optional inputs allowing the user to override defaults to suppress all messaging to the console (`verbose` = FALSE) and elect not to save out locally any intermediate and final output (`save.out` = FALSE).
+
+Following completion of this vignette, the user should complete a *Workflow* vignette to implement *devMSMs* with their longitudinal data. Many of these core inputs will be specified at the beginning of the workflow in the MSM object.
+
+The code contained in this vignette is also available, integrated code from the other vignettes, in the ExampleWorkflow.rmd file.
+
+
+
+# P3.1 Recommended: Home Directory
+Users are required to specify home directory, or in quotations, a path to a designated folder for all output from the package (without the final forward slash), if they plan to save out intermediary and final outputs in the package (default) by setting `save.out` = TRUE for any of the functions. All sub directories will be created within this home directory by the *devMSMs* functions automatically when `save.out` = TRUE.
+
+```{r}
+home_dir <- NA
+# home_dir <- '/Users/isabella/Library/CloudStorage/Box-Box/BSL General/MSMs/testing/isa'
+```
+
+
+
+# P3.2 Recommended: Time Point Delimiter
+
+Users are required to use a consistent delimiter for parsing the names of their time-varying variables (i.e., exposure, time-varying confounders, outcome) into the name of the construct and the time point at which it was measured. The default is a period but the user can specify any delimiter. *devMSMs* will assume the integer after the final instance of the delimiter wihin the variable name corresponds to the time point at which it was measured. The same delimiter shoudl be used for all time-varying variables.
+
+Users can specify a different delimiter as a character string in regular expression (regex) form.
+
+Below, we use the default period as a time delimiter.
+
+```{r}
+sep <- "\\."
+```
+
+
+
+# P3.3 Required: Exposure Variable
+
+The exposure refers to the developmental construct that is hypothesized to cause the outcome. Users are required to specify an exposure variable for use in all functions in *devMSMs*. The exposure can be either continuously distributed or binary, which the package automatically detects. The user must specify exposure, or a list of character strings corresponding to the exposure variable in wide format, as it appears in your dataset. The time at which the exposure was measured should appear as a suffix with a delimiter of the user's choosing (that should be the same for time-varying confounders).
+
+The user has two options when specifying the exposure variablee, and should select the option that best serves their theory regarding developmental timing and the practical constraints of their data and the modeling process.
+
+First, they may specify exposure at all time points at which the exposure was measured in their data. This means that balancing formulas will be created (Steps 1a, 2a, 3b in the *Workflows* vignettes) and IPTW weights will be created (Steps 2b, 3c in the *Workflows* vignettes) and assessed (Steps 2c, 3a, 4 in the *Workflows* vignettes) for all time points. In this case, if no epochs are specified, all time points will be included as exposure main effects in the final substantive model and history comparison (Step 5 in the *Workflows* vignettes).
+
+Second, they may specify a subset of theoretically important time points at which the exposure was measured in their data. This means that balancing formulas will be created and IPTW weights will be created and assessed for only those time points. Further, if no epochs are specified, only those subsetted time points will be included as exposure main effects in the final substantive models. Importantly, exposure variables at time point not included in `exposure` should be included as time-varying confounders, to be used for balancing purposes only.
+
+The specification of exposure epochs should be kept consistent throughout the use of the *devMSMs* package. If the user intends to specify exposure epochs, the user should include all time points encompassed in the epochs in. If the user does not intend to specify exposure epochs, the `exposure` will constitute the exposure main effects in the final outcome model and form the basis of the histories used for history comparison. In this case, if the user specifies more than 4 exposure time points, they will be required to conduct only a subset of history comparisons (Step 5b in the *Workflows* vignettes), given that the base code (see the `hypotheses()` function from the *marginaleffects* package) cannot accommodate all pairwise history comparisons for more than 5 time points.
+
+For this example, we elected to create epochs of infancy (6 and 15 months), toddlerhood (24 and 35 months), and early childhood (58 months) so we include all exposure time points.
+
+```{r}
+exposure <- c("ESETA1.6", "ESETA1.15", "ESETA1.24", "ESETA1.35", "ESETA1.58")
+```
+
+
+
+# P3.4 Required for Continuous Exposure: High and Low Cutoff Values
+
+If your exposure variable is continuously distributed (e.g., economic strain), there is not inherent demarcation of what is considered high versus low levels of exposure. Given that part of the MSM process involved examining how different exposure histories --that vary in dose and timing -- over development result in different outcome levels, we need to specify what is considered high versus low levels of exposure. For continuous exposures, this is required for the recommended preliminary step from *Workflows* vignette and the `compareHistories()` *devMSMs* function (see *Workflows* vignettes).
+
+We specify to `hi_lo_cut`, a list of two quantile values (0-1): the first represents the value above which is considered high levels exposure and the second represents the followed below which is considered low levels of exposure. These values may have to be revised following inspection of the sample distribution across the resulting exposure histories in the recommended preliminary steps of the *Workflows* vignettes. These final values will be used in creating and modeling the effects of exposure histories in Step 5 of the *Workflows* vignettes.
+
+Below, we specify the 60th and 30th percentiles to demarcate high and low levels of economic strain exposure, respectively.
+
+```{r}
+hi_lo_cut <- c(0.6, 0.3)
+```
+
+
+
+# P3.5 Optional: Exposure Epochs
+
+When modeling the effect of exposure on outcome in the MSM process, the user has the option to specify epochs of exposure, grouping the time points at which the exposure into more meaningful categories. This may be useful in cases when the user wishes to establish balance using all time points at which exposure was measured, but has substantive hypotheses at coarser timescales (e.g., infancy). If no epochs are specified, the time points at which exposure was measured will be used in the creation of exposure histories in the final step of the process. Each specified epoch must have a corresponding value (but the values can differ in number of entries as shown below).
+
+To specify epochs, users utilize the optional `epoch` argument by providing, as a character string, a list of user-created epoch labels, one for each exposure time point in the order in which they are listed in `exposure`. If the user specifies exposure epochs, exposure main effects are created for each epoch, and exposure levels are averaged for any epochs that consist of two or more time point values.
+
+The exposure epochs will be arguments in the `fitModel()` and `compareHistories()` *devMSMs* functions (see *Workflows* vignettes) and their specification should be kept consistent throughout use of the package and its vignettes. They will constitute the main effects variables when modeling the relation between exposure and outcome (*Workflows* vignettes Step 5a) and form the basis for estimating and comparing exposure histories (*Workflows* vignettes Step 5b). If no epochs are specified, the exposure time points from the `exposure` field will be used at the aforementioned steps.
+
+Below, we specify 'infancy' ("ESETA1.6", "ESETA1.15), 'toddlerhood' ("ESETA1.24", "ESETA1.35"), and 'childhood' ("ESETA1.58").
+
+```{r}
+epoch <- c("Infancy", "Infancy", "Toddlerhood", "Toddlerhood", "Childhood")
+```
+
+
+
+# P3.6 Recommended: Hypotheses-Relevant Exposure Histories
+
+We strongly recommend users be selective about which histories, or developmental sequences of high and low exposure (at exposure time points or epochs), are vital for testing their hypotheses. We recommend that the user estimates and compares only a subset of all possible exposure histories using the `reference` and `comparison` fields (rather than comparing all possible exposure histories). The user can specify a custom subset of exposure histories using the `reference` and `comparison` fields as optional inputs to the `compareHistories()` *devMSMs* function (see *Workflows* vignettes). To conduct these customized comparisons, users must provide at least one unique valid history (e.g., “l-l-l”) as a reference by providing a character string (or a list of strings) of lowercase l’s and h’s (each separated by -), each corresponding to each exposure epoch (or exposure time point), that signify the sequence of exposure levels (“low” or “high”, respectively).
+
+If you supply a reference history, in comparisons provide at least one unique and valid history for comparison by, in quotations, providing a string (or list of strings) of l’s and h’s (each separated by “-”), with each corresponding to each exposure epoch, that signify the sequence of exposure levels (“low” or “high”, respectively) that constitutes the comparison exposure history/histories to be compared to the reference in Step 5b of the *Workflows* vignettes. If you supply one or more comparisons, at least one reference must be specified. Each reference exposure history will be compared to each comparison history and all comparisons will be supplied for multiple comparison correction. If no reference or comparison is specified, all histories will be compared to each other in Step 5b of the *Workflows* vignettes. However, if there are more than 4 exposure main effects (either as epochs or exposure time points), the user is required to select a subset of history comparisons (Step 5b of the *Workflows* vignettes), given that the base code (see the `hypotheses()` function from the *marginaleffects* package) cannot accommodate all pairwise history comparisons for more than 5 time points).
+
+These final reference and comparison values established at this step should be used for estimating and comparing exposure histories in Step 5b of the *Workflows* vignettes.
+
+Below, we specify low economic strain at all epochs ("l-l-l") as our reference event in comparison to high levels at all epochs ("h-h-h") as well as all histories that contain 1 dose of exposure to high economic strain at different epochs.
+
+```{r}
+reference <- c("l-l-l")
+
+comparison <- c("h-h-h",
+ "l-l-h",
+ "h-l-l",
+ "l-h-l")
+```
+
+
+
+# P3.7 Required: Outcome Variable
+
+The outcome refers to the developmental construct that is hypothesized to be caused by the exposure. Users are also required to specify an outcome variable at a designated final time point, as required input to the `fitModel()` and `compareHistories()` functions in the *devMSMs* package. This final time point should be equal to (or, ideally greater than) the final exposure time point. Note that instances of the outcome variable measured at any prior time points should be included as time-varying confounders for balancing purposes. Users must specify an outcome, as a character string with a suffix of time point at which it was collected, corresponding to the variable name in the wide data. Any outcome variables measured at prior time points should be included as time-varying confounders.
+
+For this example, we specify behavior problems measured at 58 months as the outcome.
+
+```{r}
+outcome <- "StrDif_Tot.58"
+```
+
+
+
+# P3.8 Recommended: Confounders
+
+Specifying confounders is critical to the successful implmentation of MSMs. Confounders refer to variables that could cause either or both exposure and outcome, and thus could cause a spurious relation between exposure and outcome. MSMs assume that all possible confounders are measured.
+
+## P3.8a Recommended: Time Invariant Confounders
+
+Time invariant confounders are those that are considered to be stable across the developmental period you are studying. Specifying time invariant confounders in `ti_conf` is recommended in the use of this package as input for the `createFormulas()` function in *devMSMS*. Time invariant confounders could include core demographic or birth characteristics (e.g., sex, racial group membership, birth complications) that might cause either the exposure or outcome, either directly or as a proxy, as suggested by theory and/or evidenced by strong associations in the existing literature.
+
+If the user wishes to specify any interactions, they need to manually create them in the data before listing them here. Here, the user can also include any interaction terms between time invariant variables (e.g., “variable:variable”) for inclusion in the balancing formula. Keep in mind that any interactions that include factor variables will be decomposed into interactions at each factor level.
+
+For `ti_conf`, as a list of character strings, provide the names of all confounders in your dataset that are time invariant. These should not have a time suffix. Below, we specify 18 time invariant confounders that were measured at the baseline study visit, prior to the first exposure time point.
+
+```{r}
+ti_conf <- c( "state", "BioDadInHH2", "PmAge2", "PmBlac2", "TcBlac2", "PmMrSt2", "PmEd2", "KFASTScr",
+ "RMomAgeU", "RHealth", "HomeOwnd", "SWghtLB", "SurpPreg", "SmokTotl", "DrnkFreq",
+ "peri_health", "caregiv_health", "gov_assist")
+```
+
+
+
+## P3.8b Recommended: Time-varying Confounders
+
+Time-varying confounders are those that are considered to vary over development, regardless of how many times they are measured in your dataset. Specifying time-varying confounders is recommended for the use of this package as input for the `createFormulas()` *devMSMs* function (see *Workflows* vignettes). In `tv_conf`, as a list of character strings, provide the names of all variables in wide format (e.g., “variable.t”) in your dataset that are time-varying, including any exposure and outcome variables not specified in their respective fields (see above). They should have a time suffix following a delimiter.
+
+Note that time-varying confounders should also include any confounders measured repeatedly at all time points (e.g., InRatioCor) or any collected only at one or several specific time points, and missing at other time points, but are not time invariant. Additionally, note that the user does not specify exposure time points to `tv_conf`, as lagged values of exposure will be automatically included as time-varying confounders in the creation of formulas.
+
+If the user wishes to specify any interactions, they need to manually create them in the data before listing them here. Here, the user can also include any interaction terms between time invariant variables (e.g., “variable:variable”) for inclusion in the balancing formula. Keep in mind that any interactions that include factor variables will be decomposed into interactions at each factor level.
+
+```{r}
+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")
+```
+
+
+## P3.8c Optional: Concurrent Confounders
+
+When creating balancing formula at each exposure time point, the default of *devMSMs* is to only include time-varying confounders measured before the exposure time point. This is because it is often difficult to differentiate confounders measured contemporaneously from mediators, and balancing on a mediator is ill-advised. However, sometimes a user may have good evidence to know that a given time-varying confounder is not a mediator of exposure even when measured contemporaneously. If this is the case, they may specify to override the package default an retain a given variable/set of time-varying confoudners in the formulas of the exposure measured contemporaneously.
+
+For `concur_conf`: as a list of character strings, provide the names of any time-varying confounders (in wide format) that you wish to be included contemporaneously in the balancing formulas (overriding the default which is to only include lagged confounders).
+
+```{r}
+concur_conf <- "B18Raw.6"
+```
+
+
+
+The user can now proceed to the *Data Requirements* or *Workflows* vignettes.
+
+
+
+# References
+
+Arel-Bundock, Vincent. 2024. marginaleffects: Predictions, Comparisons, Slopes, Marginal Means, and Hypothesis Tests. https://CRAN.R-project.org/package=marginaleffects.
| | |