This vignette demonstrates the implementation of heterogeneous treed distributed lag mixture model (HDLMM).
Load data
Simulated data is available on GitHub. It can be loaded with the following code.
sbd_dlmtree <- get_sbd_dlmtree()
Data preparation
# Response and covariates
sbd_cov <- sbd_dlmtree %>%
select(bwgaz, ChildSex, MomAge, GestAge, MomPriorBMI, Race,
Hispanic, MomEdu, SmkAny, Marital, Income,
EstDateConcept, EstMonthConcept, EstYearConcept)
# Exposure data
sbd_exp <- list(PM25 = sbd_dlmtree %>% select(starts_with("pm25_")),
TEMP = sbd_dlmtree %>% select(starts_with("temp_")),
SO2 = sbd_dlmtree %>% select(starts_with("so2_")),
CO = sbd_dlmtree %>% select(starts_with("co_")),
NO2 = sbd_dlmtree %>% select(starts_with("no2_")))
sbd_exp <- sbd_exp %>% lapply(as.matrix)
Fitting the model
# Gaussian
hdlmm.fit <- dlmtree(formula = bwgaz ~ ChildSex + MomAge + MomPriorBMI +
Race + Hispanic + SmkAny + EstMonthConcept,
data = sbd_cov,
exposure.data = sbd_exp,
family = "gaussian",
dlm.type = "linear",
mixture = TRUE,
het = TRUE,
control.het = list(
modifiers = c("ChildSex", "MomAge", "MomPriorBMI", "SmkAny"),
modifier.splits = 10),
control.mcmc = list(n.burn = 2500, n.iter = 10000, n.thin = 5))
#> Preparing data...
#>
#> Running HDLMM:
#> Burn-in % complete
#> [0--------25--------50--------75--------100]
#> ''''''''''''''''''''''''''''''''''''''''''
#> MCMC iterations (est time: 11 minutes)
#> [0--------25--------50--------75--------100]
#> ''''''''''''''''''''''''''''''''''''''''''
#> Compiling results...
Model fit summary
#> ---
#> HDLMM summary
#>
#> Model run info:
#> - bwgaz ~ ChildSex + MomAge + MomPriorBMI + Race + Hispanic + SmkAny + EstMonthConcept
#> - family: gaussian
#> - 20 trees
#> - 2500 burn-in iterations
#> - 10000 post-burn iterations
#> - 5 thinning factor
#> - 5 exposures measured at 37 time points
#> - 10 two-way interactions (no-self interactions)
#> - 0.5 modifier sparsity prior
#> - 1 exposure sparsity prior
#> - 0.95 confidence level
#>
#> Fixed effects:
#> Mean Lower Upper
#> *(Intercept) 1.548 1.079 2.292
#> ChildSexM -0.390 -0.946 0.186
#> MomAge 0.000 -0.002 0.003
#> *MomPriorBMI -0.021 -0.023 -0.018
#> RaceAsianPI 0.027 -0.097 0.152
#> RaceBlack 0.035 -0.092 0.157
#> Racewhite 0.017 -0.106 0.135
#> *HispanicNonHispanic 0.254 0.232 0.276
#> *SmkAnyY -0.388 -0.447 -0.154
#> EstMonthConcept2 0.035 -0.073 0.171
#> EstMonthConcept3 0.059 -0.113 0.298
#> EstMonthConcept4 0.082 -0.148 0.423
#> EstMonthConcept5 0.135 -0.125 0.539
#> EstMonthConcept6 0.127 -0.124 0.527
#> EstMonthConcept7 0.198 -0.015 0.530
#> *EstMonthConcept8 0.256 0.092 0.500
#> *EstMonthConcept9 0.397 0.276 0.555
#> *EstMonthConcept10 0.320 0.208 0.433
#> *EstMonthConcept11 0.240 0.130 0.337
#> EstMonthConcept12 0.073 -0.012 0.143
#> ---
#> * = CI does not contain zero
#>
#> Modifiers:
#> PIP
#> ChildSex 1.0000
#> MomAge 0.9730
#> MomPriorBMI 0.9875
#> SmkAny 0.2970
#> ---
#> PIP = Posterior inclusion probability
#>
#> residual standard errors: 0.007
#> ---
#> To obtain exposure effect estimates, use the 'shiny(fit)' function.