bayesMargCompareF {bayesMeanScale} | R Documentation |
Comparison of Bayesian marginal effects
Description
Tests the differences between all marginal effects in the "bayes_mean_scale_marg" object that is passed to it. This is particularly useful for testing non-linear interaction effects.
Usage
bayesMargCompareF(marg_list,
ci = 0.95,
hdi_interval = TRUE,
centrality = 'mean',
digits = 4)
Arguments
marg_list |
An object of class "bayes_mean_scale_marg." |
ci |
The level of the credible interval. |
hdi_interval |
If TRUE, the default, computes the highest density credible interval. If FALSE, computes the equal-tailed interval. |
centrality |
Centrality measure for the posterior distribution. Options are "mean" or "median". |
digits |
The number of digits to report in the summary table. |
Details
All possible differences of marginal effects contained in the "bayes_mean_scale_marg" object are computed.
Value
A list of class "bayes_mean_scale_marg_compare" with the following components:
diffTable |
summary table of the differences of the marginal effects |
diffDraws |
posterior draws of the differences of the marginal effects |
Author(s)
David Dalenberg
References
Mize, Trenton D. 2019. "Best Practices for Estimating, Interpreting, and Presenting Non-linear Interaction Effects." Sociological Science 6: 81-117.
Examples
## Logit model ##
if(require(rstanarm)){
m1 <- stan_glm(switch ~ dist + educ + arsenic + assoc,
data = rstanarm::wells,
family = binomial,
refresh = 0,
iter = 500)
m1Marg <- bayesMargEffF(m1,
marginal_effect = 'arsenic',
start_value = 2.2,
end_value = .82,
at = list(educ=c(0, 5)),
n_draws = 500)
bayesMargCompareF(m1Marg)
}