View source: R/rp_coefficients.R
| rp.coefficients | R Documentation |
The effects of the coefficients of a linear or generalised linear model are displayed in graphical form. The effects are made comparable by viewing the change in the mean value of the response as each predictor variable changes across its range.
rp.coefficients(model, style = 'density', ci = TRUE, point.estimate = !ci,
se.scale = FALSE, marks, cols, ngrid)
model |
a linear or generalised linear model produced by the |
style |
a character variables controlling whether effect uncertainties are
displayed as densities ( |
ci |
a logical value controlling whether uncertainty is placed around the estimated effect in confidence interval style or around 0 in the format of a hypothesis test. |
point.estimate |
a logical value controlling whether the estimated effect is displayed as a point estimate. |
se.scale |
a logical value controlling whether a standard error scale is superimposed on the uncertainty display. |
marks |
a vector of reference values to be highlighted on the standard error scale. If this is not supplied then the upper and lower 2.5% quantiles of a t-distribution will be used in the case of linear models and +/-1.96 for generalised linear models. |
cols |
a named character vector of colours to be used in the display. If this is
not specified then the colours defined by the rpanel package function |
ngrid |
the number of grid points used in the construction of the uncertainty display. If not supplied, this will be set to 200. |
The covariate range information is added to the labels by the function.
When coefficient labels are lengthy, or there are many coefficients in the model, some overlapping may occur. Options to deal with this are shown in the examples below.
A ggplot object is returned. This allows further annotation of the display.
## Not run:
model <- lm(Giving ~ Employ + Elect + Attend + 1, data = CofE)
rp.coefficients(model)
# Change colours
# Options for labelling
plt <- rp.coefficients(model)
plt + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90))
plt + ggplot2::scale_x_discrete(labels = scales::label_wrap(5))
plt + ggplot2::coord_flip()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.