View source: R/methods_post_estimation.R
| conditional_effects | R Documentation |
Calculate and visualize the predicted values (marginal effects) of a variable, potentially conditional on the levels of another variable (interaction).
conditional_effects(
fit,
effect,
prob = 0.95,
sd_multiplier = 1,
sd_slice = NULL,
...
)
fit |
Model fit object (e.g., 'mcmc_fit', 'map_fit'). |
effect |
Name of the variable to visualize (e.g., "X1" or "X1:X2"). |
prob |
Probability for the credible/confidence interval (default is 0.95). |
sd_multiplier |
Numeric. Multiplier for standard deviation when splitting continuous moderators (default is 1). |
sd_slice |
Logical or NULL. If TRUE, continuous moderators are evaluated at mean - SD, mean, and mean + SD. If FALSE, all observed moderator values are used. If NULL (default), sd slicing is used automatically when the moderator has 6 or more unique values. |
... |
Additional arguments. |
An object of class 'ce_rtmb' containing the predicted values and their credible intervals.
data(debate, package = "BayesRTMB")
fit <- rtmb_lm(sat ~ talk * perf, data = debate)
map_fit <- fit$optimize()
ce <- conditional_effects(map_fit, effect = "talk:perf")
plot(ce)
summary(ce)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.