pred_plot: make prediction plots for lm and glm objects using ggformula.

View source: R/pred_plot.R

pred_plotR Documentation

make prediction plots for lm and glm objects using ggformula.

Description

make prediction plots for lm and glm objects using ggformula.

Usage

pred_plot(
  model,
  predictor,
  data = NULL,
  xlab = NULL,
  ylab = NULL,
  conf_level = 0.95,
  conf_int = TRUE,
  boot = FALSE,
  nboot = 1000,
  new_data_out = FALSE,
  ...
)

Arguments

model

a fitted model object created by lm() or glm() or geeglm() or glmmTMB() or model.avg()

predictor

the covariate for which to make predictions. other predictors in the model will be held constant at their median value, or the most commonly observed value in the dataset.

data

The dataset to which the model was fitted. Only required (and only used) if the model input is an "averaging" object from model.avg().

xlab

X axis label for plot (defaults to name of predictor variable)

ylab

Y axis label for plot (defaults to "Predictions from Fitted Model")

conf_level

confidence level as a proportion, default is 0.95 for 95 percent confidence

conf_int

logical: should confidence intervals be shown (as error bars or confidence band)?

boot

logical: should CIs be derived via a parametric bootstrap? Defaults to FALSE except if the model is a GEE, then defaults to TRUE.

nboot

number of bootstrap iterations. Defaults to 1000. Ignored if boot is FALSE.

new_data_out

logical: should data set used for predictions be output? If TRUE, result is a list including the plot object and the data frame.

...

Additional arguments to be passed to plotting function

Value

A ggplot2 plot created using ggformul::gf_line() or gf_point()


stacyderuiter/s245 documentation built on July 31, 2023, 11:04 p.m.