plotEst {geeasy} | R Documentation |
Plot parameter estimates with 95 pct confidence intervals.
Description
Parameter estimates are plotted along with error bars indicating 95 pct confidence intervals.
Usage
plotEst(..., intercept = TRUE, par = NULL, colors = NULL)
Arguments
... |
One or more models. Currently, |
intercept |
Logical indicating whether the intercept should be plotted (defaults
to |
par |
Which model parameters to plot estimates for, given as character strings.
Default is |
colors |
Color scale to use if several models are plotted. Defaults to a color blind friendly scale. If there are more models than there are colors, the color values are repeated. |
Details
One or more models can be supplied, and if the parameters have the same names across models, they will be grouped together allowing for easy comparison.
Note that models can be given with or without names. If names are supplied (see example below), these are printed in the plot legend. Otherwise, the name of the model object is printed there instead.
Implementation details: As a default, the estimates are extracted
from the $coefficients
slot from the model object and
confidence intervals are computed by calling confint()
. This
means that plotEst
supports all models that have a
coefficents
slot and a confint
method.
Value
No return values; called for side effects.
Author(s)
Anne Helby Petersen
Examples
# Fit example models
data(iris)
m1 <- lm(Sepal.Length ~ Petal.Length, iris)
m2 <- lm(Sepal.Length ~ Petal.Length + Petal.Width, iris)
# Plot one model
plotEst(m2)
# Plot two models with default model labels
plotEst(m1, m2)
# Plot two models with custom model labels (simple)
plotEst(model1 = m1, model2 = m2)
# Plot two models with custom model labels (with spacing)
plotEst(`Simple model` = m1, `Full petal model` = m2)
# Plot two models without intercept
plotEst(m1, m2, intercept = FALSE)
# Plot two models with custom parameter subset
plotEst(m1, m2, par = c("Petal.Length"))
# Plot two models with custom color scale given by color names
plotEst(m1, m2, colors = c("red", "blue"))
# Plot two models with custom color scale given by color hex codes
# note: only the first colors are used as there are more
# colors than models
plotEst(m1, m2, colors = c("#CC6666", "#9999CC", "#66CC99"))