forestplotMV {reportRmd} | R Documentation |
Create a multivariable forest plot using ggplot2
Description
This function will send and take log or logistic regression fit from glm or geeglm from mvsum function, and display the OR or RR for each variable on the appropriate log scale.
Usage
forestplotMV(
model,
data,
conf.level = 0.95,
orderByRisk = TRUE,
colours = "default",
showEst = TRUE,
rmRef = FALSE,
digits = getOption("reportRmd.digits", 2),
logScale = getOption("reportRmd.logScale", TRUE),
nxTicks = 5,
showN = TRUE,
showEvent = TRUE
)
Arguments
model |
an object output from the glm or geeglm function, must be from a logistic regression |
data |
dataframe containing your data |
conf.level |
controls the width of the confidence interval |
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? |
digits |
number of digits to use displaying estimates |
logScale |
logical, should OR/RR be shown on log scale, defaults to TRUE, or reportRmd.logScale if set. 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")
glm_fit = glm(orr~change_ctdna_group+sex+age+l_size,
data=pembrolizumab,family = 'binomial')
forestplotMV(glm_fit)