View source: R/coefficient_forestplot.R
| coefficient_forestplot | R Documentation | 
Create a ggplot forest plot of model coefficients with confidence intervals.
coefficient_forestplot( model_list, model_names = NULL, varlabs = NULL, conflevel = 0.95, horiz = TRUE )
model_list | 
 A list of regression models.  | 
model_names | 
 A list of names for the regression models.  | 
varlabs | 
 A vector of labels for model variables.  | 
conflevel | 
 Confidence level for intervals.  | 
horiz | 
 Toggle whether confidence intervals are displayed horizontally or
vertically. Default is set to   | 
The forest plot groups variables along the axis determined by the horiz
parameter and colors the data by model. If model_names = NULL, the
default, models are numbered sequentially in the order they appear in
model_list (Model 1, Model 2, Model 3, etc.).
A ggplot object to compare model coefficient estimates with their corresponding confidence interval(s), grouped by coefficient.
 states = as.data.frame(state.x77)
 m1 = lm(`Life Exp` ~ Income + Illiteracy, data=states,
         subset=state.region=='Northeast')
 m2 = lm(`Life Exp` ~ Income + Illiteracy, data=states,
         subset=state.region=='South')
 m3 = lm(`Life Exp` ~ Income + Illiteracy, data=states,
         subset=state.region=='North Central')
 m4 = lm(`Life Exp` ~ Income + Illiteracy, data=states,
         subset=state.region=='West')
 mList = list(m1, m2, m3, m4)
 coefficient_forestplot(model_list = mList,
                        model_names =c('Northeast', 'South',
                                       'North Central', 'West'),
                        horiz = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.