coefficient_forestplot {paramhetero} | R Documentation |
Create forest plot of model coefficients with confidence intervals
Description
Create a ggplot forest plot of model coefficients with confidence intervals.
Usage
coefficient_forestplot(
model_list,
model_names = NULL,
conflevel = 0.95,
horiz = TRUE
)
Arguments
model_list |
A list of regression models. |
model_names |
A list of names for the regression models. |
conflevel |
Confidence level for intervals. |
horiz |
Toggle whether confidence intervals are displayed horizontally or
vertically. Default is set to |
Details
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.).
Value
A ggplot object to compare model coefficient estimates with their corresponding confidence interval(s), grouped by coefficient.
Examples
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)
[Package paramhetero version 1.0.0 Index]