Skip to contents

Plot predicted versus observed counts

Usage

plot_counts_pred_obs(
  pred.df = NULL,
  data = NULL,
  byplant = FALSE,
  width = 0.95,
  ...
)

Arguments

pred.df

A data frame containing the predicted counts, as generated by predict_counts()

data

Data list (from prepare_data())

byplant

Logical. If TRUE, show predicted and observed counts per plant (using ggplot2::facet_wrap()). If FALSE, show all interactions in the same plot.

width

width of the credible interval (default = 0.95).

...

Further arguments to be passed to ggplot2::facet_wrap() if byplant = TRUE, or to tidybayes::geom_pointinterval() if byplant = FALSE.

Value

A ggplot object

Examples

if (FALSE) { # interactive()
data(web)
dt <- prepare_data(mat = web, sampl.eff = rep(20, nrow(web)))
fit <- fit_model(dt, refresh = 0)
pred.df <- predict_counts(fit, dt)
plot_counts_pred_obs(pred.df, dt)
plot_counts_pred_obs(pred.df, dt, fatten_point = 3)
plot_counts_pred_obs(pred.df, dt, byplant = TRUE)
plot_counts_pred_obs(pred.df, dt, byplant = TRUE, scale = "free")
}