Dotplot for coefficients
# S3 method for default
coefplot(model, title = "Coefficient Plot",
xlab = "Value", ylab = "Coefficient", innerCI = 1, outerCI = 2,
lwdInner = 1, lwdOuter = 0, pointSize = 3, color = "blue",
shape = 16, cex = 0.8, textAngle = 0, numberAngle = 0,
zeroColor = "grey", zeroLWD = 1, zeroType = 2, facet = FALSE,
scales = "free", sort = c("natural", "magnitude", "alphabetical"),
decreasing = FALSE, numeric = FALSE, fillColor = "grey", alpha = 1/2,
horizontal = FALSE, factors = NULL, only = NULL, shorten = TRUE,
intercept = TRUE, interceptName = "(Intercept)", coefficients = NULL,
predictors = NULL, strict = FALSE, trans = identity, newNames = NULL,
plot = TRUE, ...)
The model to plot.
The name of the plot, if NULL then no name is given
The x label
The y label
How wide the inner confidence interval should be, normally 1 standard deviation. If 0, then there will be no inner confidence interval.
How wide the outer confidence interval should be, normally 2 standard deviations. If 0, then there will be no outer confidence interval.
The thickness of the inner confidence interval
The thickness of the outer confidence interval
Size of coefficient point
The color of the points and lines
The shape of the points
The text size multiplier, currently not used
The angle for the coefficient labels, 0 is horizontal
The angle for the value labels, 0 is horizontal
The color of the line indicating 0
The thickness of the 0 line
The type of 0 line, 0 will mean no line
logical; If the coefficients should be faceted by the variables, numeric coefficients (including the intercept) will be one facet. Currently not available.
The way the axes should be treated in a faceted plot. Can be c("fixed", "free", "free_x", "free_y"). Currently not available.
Determines the sort order of the coefficients. Possible values are c("natural", "normal", "magnitude", "size", "alphabetical")
logical; Whether the coefficients should be ascending or descending
logical; If true and factors has exactly one value, then it is displayed in a horizontal graph with continuous confidence bounds. Currently not available.
The color of the confidence bounds for a numeric factor. Currently not available.
The transparency level of the numeric factor's confidence bound. Currently not available.
logical; If the plot should be displayed horizontally. Currently not available.
Vector of factor variables that will be the only ones shown
logical; If factors has a value this determines how interactions are treated. True means just that variable will be shown and not its interactions. False means interactions will be included.
logical or character; If FALSE
then coefficients for factor levels will include their variable name. If TRUE
coefficients for factor levels will be stripped of their variable names. If a character vector of variables only coefficients for factor levels associated with those variables will the variable names stripped. Currently not available.
logical; Whether the Intercept coefficient should be plotted
Specifies name of intercept it case it is not the default of "(Intercept").
A character vector specifying which factor coefficients to keep. It will keep all levels and any interactions, even if those are not listed.
A character vector specifying which coefficients to keep. Each individual coefficient can be specified. Use predictors to specify entire factors.
If TRUE then predictors will only be matched to its own coefficients, not its interactions
A transformation function to apply to the values and confidence intervals. identity
by default. Use invlogit
for binary regression.
Named character vector of new names for coefficients
logical; If the plot should be drawn, if false then a data.frame of the values will be returned
Arguments passed on to other functions
If plot
is TRUE
then a ggplot
object is returned. Otherwise a data.frame
listing coefficients and confidence bands is returned.
A graphical display of the coefficients and standard errors from a fitted model
coefplot
is the S3 generic method for plotting the coefficients from a fitted model.
This method also plots coefficients from glm (using coefplot.lm) and rxLinMod models (through a redirection from coefplot.rxLinMod)
# NOT RUN {
data(diamonds)
head(diamonds)
model1 <- lm(price ~ carat + cut*color, data=diamonds)
model2 <- lm(price ~ carat*color, data=diamonds)
coefplot(model1)
coefplot(model2)
coefplot(model1, predictors="color")
coefplot(model1, predictors="color", strict=TRUE)
coefplot(model1, coefficients=c("(Intercept)", "color.Q"))
# }
Run the code above in your browser using DataLab