one of the best gtsummary (broom.helpers) features for me is "add_pairwise_contrasts = T" via the integration with emmeans package, and amazingly it even by default uses the "weights = "prop". Special thanks for that! Hier is a code for non-0.5 quantile in a quantile regression which works perfectly:
Thanks Joseph & Daniel,
one of the best gtsummary (broom.helpers) features for me is "add_pairwise_contrasts = T" via the integration with emmeans package, and amazingly it even by default uses the "weights = "prop". Special thanks for that! Hier is a code for non-0.5 quantile in a quantile regression which works perfectly:
library(ISLR) library(quantreg) qm90 <- rq(wage ~ jobclass * health_ins, Wage, tau = 0.9)
emmeans(qm90, pairwise ~ jobclass|health_ins, type = "response", tau = 0.9)
emmip(qm90, jobclass ~ health_ins, tau = 0.9, CIs = T)
library(ISLR) qm90 <- rq(wage ~ jobclass + education + health_ins, Wage, tau = 0.9)
wrong, because only the first levels of categorical confounders are taken
emmip(qm90, ~ education, tau = 0.9, CIs = T)+ theme_bw()
correct: because estimates are averaged over all categories of categorical confounders
emmip(qm90, ~ education, tau = 0.9, CIs = T, weights = "prop")+ theme_bw()
emmeans(qm90, pairwise ~ education, weights = "prop")
tbl_regression( qm90, add_pairwise_contrasts = T, emmeans_args = list(tau = .9, weights = "prop"))
The "weights = "prop" is actually not necessary, which is cool!
Happy Christmal Holidays! Yury