Forest plot of multiple regression models — plot_models (2024)

Table of Contents
Arguments Value Examples References

Plot and compare regression coefficients with confidence intervals of multiple regression models in one plot.

plot_models(..., transform, std.est = NULL, rm.terms = NULL, title = NULL, m.labels = NULL, legend.title = "Dependent Variables", legend.pval.title = "p-level", axis.labels = NULL, axis.title = NULL, axis.lim = NULL, wrap.title = 50, wrap.labels = 25, wrap.legend.title = 20, grid.breaks = NULL, dot.size = 3, spacing = 0.4, colors = "Set1", show.values = FALSE, show.legend = TRUE, show.intercept = FALSE, show.p = TRUE, p.shape = FALSE, ci.lvl = 0.95, vline.color = NULL, digits = 2, grid = FALSE, auto.label = TRUE, prefix.labels = c("none", "varname", "label"))

Arguments

...

One or more regression models, including glm's or mixed models.May also be a list with fitted models. See 'Examples'.

transform

A character vector, naming a function that will be appliedon estimates and confidence intervals. By default, transform willautomatically use "exp" as transformation for applicable classes ofmodel (e.g. logistic or poisson regression). Estimates of linearmodels remain untransformed. Use NULL if you want the raw,non-transformed estimates.

std.est

For linear models, choose whether standardized coefficients shouldbe used for plotting. Default is no standardization.

NULL

(default) no standardization, returns original estimates.

"std"

standardized beta values.

"std2"

standardized beta values, however, standardization is done by rescaling estimates by dividing them by two sd (see std_beta).

rm.terms

Character vector with names that indicate which terms shouldbe removed from the plot. Counterpart to terms. rm.terms ="t_name" would remove the term t_name. Default is NULL, i.e.all terms are used. Note that this argument does not apply toMarginal Effects plots.

title

Character vector, used as plot title. By default,get_dv_labels is called to retrieve the label ofthe dependent variable, which will be used as title. Use title = ""to remove title.

m.labels

Character vector, used to indicate the different modelsin the plot's legend. If not specified, the labels of the dependentvariables for each model are used.

legend.title

Character vector, used as title for the plot legend. Note thatonly some plot types have legends (e.g. type = "pred" or whengrouping estimates with group.estimates).

legend.pval.title

Character vector, used as title of the plot legend thatindicates the p-values. Default is "p-level". Only applies ifp.shape = TRUE.

axis.labels

Character vector with labels for the model terms, used asaxis labels. By default, get_term_labels iscalled to retrieve the labels of the coefficients, which will be used asaxis labels. Use axis.labels = "" or auto.label = FALSE touse the variable names as labels instead. If axis.labels is a namedvector, axis labels (by default, the names of the model's coefficients)will be matched with the names of axis.label. This ensures thatlabels always match the related axis value, no matter in which wayaxis labels are sorted.

axis.title

Character vector of length one or two (depending on theplot function and type), used as title(s) for the x and y axis. If notspecified, a default labelling is chosen. Note: Some plot typesmay not support this argument sufficiently. In such cases, use the returnedggplot-object and add axis titles manually withlabs. Use axis.title = "" to remove axistitles.

axis.lim

Numeric vector of length 2, defining the range of the plotaxis. Depending on plot-type, may effect either x- or y-axis. ForMarginal Effects plots, axis.lim may also be a list of twovectors of length 2, defining axis limits for both the x and y axis.

wrap.title

Numeric, determines how many chars of the plot title aredisplayed in one line and when a line break is inserted.

wrap.labels

Numeric, determines how many chars of the value, variableor axis labels are displayed in one line and when a line break is inserted.

wrap.legend.title

numeric, determines how many chars of the legend's titleare displayed in one line and when a line break is inserted.

grid.breaks

Numeric value or vector; if grid.breaks is asingle value, sets the distance between breaks for the axis at everygrid.breaks'th position, where a major grid line is plotted. Ifgrid.breaks is a vector, values will be used to define theaxis positions of the major grid lines.

dot.size

Numeric, size of the dots that indicate the point estimates.

spacing

Numeric, spacing between the dots and error bars of theplotted fitted models. Default is 0.3.

colors

May be a character vector of color values in hex-format, validcolor value names (see demo("colors")) or a name of a pre-definedcolor palette. Following options are valid for the colors argument:

  • If not specified, a default color brewer palette will be used, which is suitable for the plot style.

  • If "gs", a greyscale will be used.

  • If "bw", and plot-type is a line-plot, the plot is black/white and uses different line types to distinguish groups (see this package-vignette).

  • If colors is any valid color brewer palette name, the related palette will be used. Use display.brewer.all to view all available palette names.

  • If wesanderson is installed, you may also specify a name of a palette from that package.

  • If viridis is installed, use colors = "v" to get the viridis color palette.

  • There are some pre-defined color palettes in this package, see sjPlot-themes for details.

  • Else specify own color values or names as vector (e.g. colors = "#00ff00" or colors = c("firebrick", "blue")).

show.values

Logical, whether values should be plotted or not.

show.legend

For Marginal Effects plots, shows or hides thelegend.

show.intercept

Logical, if TRUE, the intercept of the fittedmodel is also plotted. Default is FALSE. If transform ="exp", please note that due to exponential transformation of estimates,the intercept in some cases is non-finite and the plot can not be created.

show.p

Logical, adds asterisks that indicate the significance level ofestimates to the value labels.

p.shape

Logical, if TRUE, significant levels are distinguished bydifferent point shapes and a related legend is plotted. Defaultis FALSE.

ci.lvl

Numeric, the level of the confidence intervals (error bars).Use ci.lvl = NA to remove error bars. For stanreg-models,ci.lvl defines the (outer) probability for thehdi (High Density Interval) that is plotted. Bydefault, stanreg-models are printed with two intervals: the "inner"interval, which defaults to the 50%-HDI; and the "outer" interval, whichdefaults to the 89%-HDI. ci.lvl affects only the outer interval insuch cases. See prob.inner and prob.outer under the...-argument for more details.

vline.color

Color of the vertical "zero effect" line. Default color isinherited from the current theme.

digits

Numeric, amount of digits after decimal point when roundingestimates or values.

grid

Logical, if TRUE, multiple plots are plotted as gridlayout.

auto.label

Logical, if TRUE (the default), plot-labels arebased on value and variable labels, if the data is labelled. Seeget_label andget_term_labels for details. If FALSE,original variable names and value labels (factor levels) are used.

prefix.labels

Indicates whether the value labels of categorical variablesshould be prefixed, e.g. with the variable name or variable label. Seeargument prefix in get_term_labels fordetails.

Value

A ggplot-object.

Examples

data(efc)# fit three modelsfit1 <- lm(barthtot ~ c160age + c12hour + c161sex + c172code, data = efc)fit2 <- lm(neg_c_7 ~ c160age + c12hour + c161sex + c172code, data = efc)fit3 <- lm(tot_sc_e ~ c160age + c12hour + c161sex + c172code, data = efc)# plot multiple modelsplot_models(fit1, fit2, fit3, grid = TRUE)

Forest plot of multiple regression models — plot_models (1)

# plot multiple models with legend labels and# point shapes instead of value labelsplot_models( fit1, fit2, fit3, axis.labels = c( "Carer's Age", "Hours of Care", "Carer's Sex", "Educational Status" ), m.labels = c("Barthel Index", "Negative Impact", "Services used"), show.values = FALSE, show.p = FALSE, p.shape = TRUE)

Forest plot of multiple regression models — plot_models (2)

# plot multiple models from nested lists argumentall.models <- list()all.models[[1]] <- fit1all.models[[2]] <- fit2all.models[[3]] <- fit3plot_models(all.models)

Forest plot of multiple regression models — plot_models (3)

# plot multiple models with different predictors (stepwise inclusion),# standardized estimatesfit1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars)fit2 <- update(fit1, . ~ . + hp)fit3 <- update(fit2, . ~ . + am)plot_models(fit1, fit2, fit3, std.est = "std2")

Forest plot of multiple regression models — plot_models (4)

Forest plot of multiple regression models — plot_models (2024)

References

Top Articles
Casa 103RAV / Vallribera Arquitectes
Así es la espectacular casa de Marisa Martín Blázquez: En plena naturaleza y con una increíble piscina
Randolf Spellshine
[Re-Usable] - SSNSonicHD - Expanded & Enhanced
Benchmark Physical Therapy Jobs
Yale College Confidential 2027
Markz Blog
Miramar Water Utility
Basic Setup – OpenXR & Pimax HMDs...
London (Greater London) weather
Lsn Nashville Tn
Pga Us Open Leaderboard Espn
Hydro Quebec Power Outage Map
Seafood Restaurants Open Late Near Me
โลโก้โภชนาการที่ดีที่สุด: สัญลักษณ์แห่งความเป็นเลิศ
Roadwarden Thais
Haunted Mansion Showtimes Near Roxy Lebanon
Teenbeautyfitness
Walmart Listings Near Me
'Kendall Jenner of Bodybuilding' Vladislava Galagan Shares Her Best Fitness Advice For Women – Fitness Volt
Browse | Obituaries | Enid News and Eagle
My Sagu Blackboard
COUNTRY VOL 1 EICHBAUM COLLECTION (2024) WEB [FLAC] 16BITS 44 1KHZ
Receive Sms Verification
Aldi Sign In Careers
Daggett Funeral Home Barryton Michigan
Best Auto Upholstery Shops Near Me
Everything to know on series 3 of ITV's The Tower starring Gemma Whelan
Highplainsobserverperryton
Meritas Health Patient Portal
No hard feelings: cómo decir "no" en inglés educadamente y sin herir sensibilidades
Gwcc Salvage
A Closer Look at Ot Megan Age: From TikTok Star to Media Sensation
Calculating R-Value: How To Calculate R-Value? (Formula + Units)
David Mayries
The Ultimate Guide To Kaitlyn Krems Of
Dumb Money Showtimes Near Maya Cinemas Salinas
Pat's Atchafalaya Club Schedule
Sdn Ohio State 2023
Donald Vacanti Obituary
Sherwin Williams Buttercream
Paychex Mobile Apps - Easy Access to Payroll, HR, & Other Services
Rachaelrayshow Com Recipes
Travelvids October 2022
Alle Eurovision Song Contest Videos
Craigslist Antelope Valley General For Sale
Busted Newspaper Zapata Tx
Florida-Texas A&M: What You Need to Know - Florida Gators
Mi Game Time
2006 Ford E350 Startrans RV Conversion for sale by owner - Medford, OR - craigslist
Love In Orbit Manga Buddy
Opsahl Kostel Funeral Home & Crematory Yankton
Latest Posts
Article information

Author: Greg O'Connell

Last Updated:

Views: 5946

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Greg O'Connell

Birthday: 1992-01-10

Address: Suite 517 2436 Jefferey Pass, Shanitaside, UT 27519

Phone: +2614651609714

Job: Education Developer

Hobby: Cooking, Gambling, Pottery, Shooting, Baseball, Singing, Snowboarding

Introduction: My name is Greg O'Connell, I am a delightful, colorful, talented, kind, lively, modern, tender person who loves writing and wants to share my knowledge and understanding with you.