forestplot | R Documentation |
Create a forest plot and table of coefficients and stats from one or more regression models.
forestplot(
...,
modelnames = NULL,
varnames = NULL,
stats = NULL,
odds.ratio = F,
breaks = NULL,
intercept = T,
facet = T,
dodgewidth = 0.3,
linewidth = 1,
size = 1,
draw = T,
sig = 3,
ddf = NULL
)
... |
One or more model objects. |
modelnames |
A character vector of names to label each plot and table column. |
varnames |
A named character vector. Each element is a human friendly version of the variable name, and each name is the original variable name. |
odds.ratio |
If TRUE, apply exponential transform to coefficients and omit intercept. |
breaks |
An optional vector of breaks for the plot x-axis. |
intercept |
If TRUE, include the intercept in the table and plot; otherwise omit. |
facet |
If TRUE, display models in different facets. Otherwise, distinguish by color. |
dodgewidth |
For position_dodge(). Default = 0.3. |
draw |
If TRUE draw the plot; otherwise return the data. Default TRUE |
sig |
The number of significant digits for the table. |
A ggplot object.
data(mtcars)
m1 <- lm(mpg ~ hp, mtcars)
m2 <- lm(mpg ~ wt, mtcars)
mnms <- c('MPG vs HP', 'MPG vs Weight')
vnms <- c(mpg='Miles per gallon', hp='Horsepower', wt='Weight')
forestplot(m1, m2, modelnames=mnms, varnames=vnms)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.