forestplotUVMV {reportRmd}R Documentation

Combine an univariable and multivariable forest plot using ggplot2

Description

This function will take log or logistic regression fit forest plot output from forestplotUV and forestplotMV functions and display the combined adjusted and unadjusted OR or RR for each variable on the appropriate log scale. Please note that total N and reference-level N is taken from unadjusted model.

Usage

forestplotUVMV(
  UVmodel,
  MVmodel,
  model = "glm",
  family = NULL,
  digits = getOption("reportRmd.digits", 2),
  orderByRisk = TRUE,
  colours = "default",
  showEst = TRUE,
  rmRef = FALSE,
  logScale = FALSE,
  nxTicks = 5,
  showN = TRUE,
  showEvent = TRUE
)

Arguments

UVmodel

an UV model object output from the forestplotUV function

MVmodel

a MV model object output from the forestplotMV function

model

fitted model object

family

description of the error distribution and link function to be used in the model. Only used for geeglm

digits

number of digits to round to

orderByRisk

logical, should the plot be ordered by risk

colours

can specify colours for risks less than, 1 and greater than 1.0. Default is red, black, green

showEst

logical, should the risks be displayed on the plot in text

rmRef

logical, should the reference levels be removed for the plot?

logScale

logical, should OR/RR be shown on log scale, defaults to TRUE. See https://doi.org/10.1093/aje/kwr156 for why you may prefer a linear scale.

nxTicks

Number of tick marks supplied to the log_breaks function to produce

showN

Show number of observations per variable and category

showEvent

Show number of events per variable and category

Value

a plot object

Examples

data("pembrolizumab")
UVp = forestplotUV(response="orr", covs=c("change_ctdna_group", "sex", "age",
"l_size"), data=pembrolizumab, family='binomial')
MVp = forestplotMV(glm(orr~change_ctdna_group+sex+age+l_size,
data=pembrolizumab,family = 'binomial'))
forestplotUVMV(UVp, MVp)

[Package reportRmd version 0.1.0 Index]