plot_predictions: Plot model predictions for 'pffr' models

Description Usage Arguments

View source: R/effect_plots.R

Description

Plots the model predictions for a function-on-scalar model fitted with pffr.

Usage

1
2
3
4
5
6
7
plot_predictions(model, newdata, yvar, ci_type = "none",
  ci_alpha = 0.05, labels = NULL, legend_title = "group",
  col_palette = "Set1", col_vector = NULL, rev_cols = FALSE,
  base_size = 11, legend_symbol_size = 2, type = "response",
  log10 = FALSE, plot.margin = unit(rep(5.5, 4), "points"), hline,
  ybreaks = waiver(), ylabels = waiver(), xlab = "yindex",
  ylab = "prediction", main, ylim = NULL, lwd = 1, ...)

Arguments

model

Function-on-scalar model fitted with pffr

newdata

See predict.pffr

yvar

name of the response variable in model

ci_type

One of "none" (default; no confidence bands), "ci" (pointwise confidence intervals for the predicted mean) or "pi_norm"/"pi_gamma" (pointwise prediction intervals), specifying which type of uncertainty bands should be plotted. Prediction intervals are either calculated summing the predicted mean variance and the residual variance ("pi_norm") or using 'posterior simulation' of the parameter vector ("pi_gamma") as outlined here: https://stat.ethz.ch/pipermail/r-help/2011-April/275632.html. Note that the "pi_norm" PIs are not generally applicable for generalized models. The posterior simulation approach is more generally applicable, but is currently only implemented for Gamma regression.

ci_alpha

Alpha to be used for confidence or prediction intervals. Defaults to 0.05, i.e. 95% intervals.

labels

Labels vector with length equal to nrow(newdata). Used for the legend.

legend_title

Title of legend

col_palette

Color palette to use in plot, see scale_color_brewer. Only used if nrow(newdata)>1 and if is.null(col_vector).

col_vector

Vector of colors to use

rev_cols

If TRUE, the color palette is turned around.

base_size

Base size of plot elements, see theme_bw. Defaults to 11.

legend_symbol_size

Size of symbols in legend. Default to 2

type

type argument for predict.pffr

log10

If TRUE the predictions are shown on a log10 scale

plot.margin

Margin of the ggplot

hline

Vector of geom_hline

ybreaks

Numeric vector of breaks for the y axis

ylabels

Character vector of labels for the y axis. Only used if ybreaks is specified

xlab, ylab, main, ylim, lwd

Further arguments for the plot function

...

Additional arguments passed to pi_gamma


bauer-alex/FoSIntro documentation built on Feb. 11, 2022, 8:33 a.m.