y <- rnorm(50)
yrep <- matrix(rnorm(5000, 0, 2), ncol = 50)
color_scheme_set("brightblue")
ppc_intervals(y, yrep)
ppc_ribbon(y, yrep)
ppc_ribbon(y, yrep, y_draw = "points")
if (FALSE) {
ppc_ribbon(y, yrep, y_draw = "both")
}
ppc_intervals(y, yrep, size = 1.5, fatten = 0) # remove the yrep point estimates
color_scheme_set("teal")
year <- 1950:1999
ppc_intervals(y, yrep, x = year, fatten = 1) + ggplot2::xlab("Year")
ppc_ribbon(y, yrep, x = year) + ggplot2::xlab("Year")
color_scheme_set("pink")
year <- rep(2000:2009, each = 5)
group <- gl(5, 1, length = 50, labels = LETTERS[1:5])
ppc_ribbon_grouped(y, yrep, x = year, group, y_draw = "both") +
ggplot2::scale_x_continuous(breaks = pretty)
ppc_ribbon_grouped(y, yrep, x = year, group,
facet_args = list(scales = "fixed")) +
xaxis_text(FALSE) +
xaxis_ticks(FALSE) +
panel_bg(fill = "gray20")
# get the data frames used to make the ggplots
ppc_dat <- ppc_intervals_data(y, yrep, x = year, prob = 0.5)
ppc_group_dat <- ppc_intervals_data(y, yrep, x = year, group = group, prob = 0.5)
if (FALSE) {
library("rstanarm")
fit <- stan_glmer(mpg ~ wt + (1|cyl), data = mtcars, refresh = 0)
yrep <- posterior_predict(fit)
color_scheme_set("purple")
ppc_intervals(y = mtcars$mpg, yrep = yrep, x = mtcars$wt, prob = 0.8) +
panel_bg(fill="gray90", color = NA) +
grid_lines(color = "white")
ppc_ribbon(y = mtcars$mpg, yrep = yrep, x = mtcars$wt,
prob = 0.6, prob_outer = 0.8)
ppc_ribbon_grouped(y = mtcars$mpg, yrep = yrep, x = mtcars$wt,
group = mtcars$cyl)
color_scheme_set("gray")
ppc_intervals(mtcars$mpg, yrep, prob = 0.5) +
ggplot2::scale_x_continuous(
labels = rownames(mtcars),
breaks = 1:nrow(mtcars)
) +
xaxis_text(angle = -70, vjust = 1, hjust = 0) +
xaxis_title(FALSE)
}
Run the code above in your browser using DataLab