plot.mcpfit | R Documentation |
Plot prior or posterior model draws on top of data. Use plot_pars
to
plot individual parameter estimates.
## S3 method for class 'mcpfit'
plot(
x,
facet_by = NULL,
lines = 25,
geom_data = "point",
cp_dens = TRUE,
q_fit = FALSE,
q_predict = FALSE,
rate = TRUE,
prior = FALSE,
which_y = "ct",
arma = TRUE,
nsamples = 2000,
scale = "response",
...
)
x |
An |
facet_by |
String. Name of a varying group. |
lines |
Positive integer or |
geom_data |
String. One of "point", "line" (good for time-series), or FALSE (don not plot). |
cp_dens |
TRUE/FALSE. Plot posterior densities of the change point(s)?
Currently does not respect |
q_fit |
Whether to plot quantiles of the posterior (fitted value).
|
q_predict |
Same as |
rate |
Boolean. For binomial models, plot on raw data ( |
prior |
TRUE/FALSE. Plot using prior samples? Useful for |
which_y |
What to plot on the y-axis. One of
|
arma |
Whether to include autoregressive effects.
|
nsamples |
Integer or |
scale |
One of
|
... |
Currently ignored. |
plot()
uses fit$simulate()
on posterior samples. These represent the
(joint) posterior distribution.
A ggplot2 object.
Jonas Kristoffer Lindeløv jonas@lindeloev.dk
# Typical usage. demo_fit is an mcpfit object.
plot(demo_fit)
plot(demo_fit, prior = TRUE) # The prior
plot(demo_fit, lines = 0, q_fit = TRUE) # 95% HDI without lines
plot(demo_fit, q_predict = c(0.1, 0.9)) # 80% prediction interval
plot(demo_fit, which_y = "sigma", lines = 100) # The variance parameter on y
# Show a panel for each varying effect
# plot(fit, facet_by = "my_column")
# Customize plots using regular ggplot2
library(ggplot2)
plot(demo_fit) + theme_bw(15) + ggtitle("Great plot!")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.