plot_glm | R Documentation |
plot_glm
is designed to plot the results of fitting Bayesian GLMs,
with QL model parameters as the response variables, via the parameter_glm()
function. It plots both a box-and-whisker plot (defaulting to 95% HDIs for
the box, and 99% HDIs for the lines), plus the posterior distribution of
coefficients (half-violin plots made up of the individual posterior draws).
plot_glm(
par_df,
plot_var,
id.col = "parameter",
test = FALSE,
grp = id.col,
fclr = id.col,
axis_fixed = FALSE,
grp_labs = NULL,
plot_together = TRUE,
ovrll_title = NULL,
title_font_size = 16,
title_rel_ht = NULL,
plt_rows = 1,
plt_rel_widths = 1,
cred = c(0.95, 0.99),
coord_flip = TRUE,
box_alpha = 0.6,
box_width = 0.125,
box_nudge = 0.1,
pal = NULL,
font_size = 11,
font = "",
...
)
par_df |
A |
plot_var |
The variable of interest to plot (e.g., distanced vs non-distanced). |
id.col |
The column that contains the QL model parameter names. |
test |
Boolean indicating whether summaries are from the test phase. |
grp |
Optional group to plot separately on each plot, which should be
the interaction variable specified in |
fclr |
To what variable should the colour scheme be applied? Defaults to
|
axis_fixed |
Logical indicating whether the y-axis should be fixed
across all plots. Defaults to |
grp_labs |
Optional labels for the groups defined by |
plot_together |
If |
ovrll_title |
Title to set for the whole plot. Ignored if
|
title_font_size , title_rel_ht |
Font size, and relative height of the
title compared to the main plot, given as a 2 element vector. Defaults to
|
plt_rows , plt_rel_widths |
Number of rows, and relative widths for the
plotted grid (passed to |
cred |
Vector, length 2, which defines the % HDI covered by the boxplot boxes and lines respectively. |
coord_flip |
Plot horizontal ( |
box_alpha , box_width , box_nudge |
Control the transparency, size, and position of the summary boxplot. |
pal , font_size , font |
Same as |
... |
Additional arguments such as |
Either a list of ggplots or a cowplot::plot_grid()
if
plot_together == TRUE
.
## Not run:
Comparing parameters across groups
data(example_data)
fit_nd <- fit_learning_model(
example_data$nd,
model = "2a",
vb = FALSE,
exp_part = "training"
)
fit_dis <- fit_learning_model(
example_data$dis,
model = "2a",
vb = FALSE,
exp_part = "training"
)
distanced <- parameter_glm(
summary_df = list(fit_nd$summary, fit_dis$summary),
raw_df = list(fit_nd$raw_df, fit_dis$raw_df),
var_of_interest = "distanced",
covariates = c("age", "sex", "digit_span"),
iter_warmup = 1000, iter_sampling = 1000
)
plot_glm(distanced, plot_var = "distanced")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.