# A tibble: 200 x 7
DOSE CAVG ECOG RACE SEX BRNMETS DV
<int> <dbl> <fct> <fct> <fct> <fct> <int>
1 20 203. Active White Female Yes 0
2 20 202. Restricted White Female No 0
3 20 287. Restricted Others Female No 0
4 20 174. Restricted Others Male Yes 0
5 20 270. Active Others Male Yes 0
6 20 265. Active Others Female No 1
7 20 206. Restricted Others Female No 0
8 20 253. Active Others Male No 1
9 20 186. Active White Male No 0
10 20 186. Restricted Others Female No 1
# ... with 190 more rows
Family: bernoulli
Links: mu = logit
Formula: DV ~ CAVG + RACE
Data: hoData (Number of observations: 200)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept -1.81 0.37 -2.55 -1.10 1.00 1962 2405
CAVG 0.00 0.00 0.00 0.00 1.00 4324 3163
RACEOthers 1.33 0.33 0.67 2.02 1.00 1732 1299
Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
Plot The Probability of the Event vs Average Concentration
out %>%ggplot(aes(x = CAVG, y = pred_m, color =factor(RACE))) +geom_line() +geom_ribbon(aes(ymin = pred_low, ymax = pred_high, fill =factor(RACE)), alpha =0.2) +ylab("Predicted Probability of the Event\n") +xlab("\nAverage Concentration until the Event (mg/L)") +theme_bw() +scale_fill_discrete("") +scale_color_discrete("") +theme(legend.position ="top")
Generate Posterior Probabilities Using Helper Functions from brms and tidybayes
Generate posterior probability of the event using the estimates and their associated posterior distributions
Plot The Probability of the Event vs Average Concentration
out2 %>%ggplot() +stat_lineribbon(aes(x = CAVG, y = PRED, color = RACE, fill = RACE), .width =0.95, alpha =0.25) +ylab("Predicted Probability of the Event\n") +xlab("\nAverage Concentration until the Event (mg/L)") +theme_bw() +scale_fill_discrete("") +scale_color_discrete("") +theme(legend.position ="top") +ylim(c(0, 1))