View source: R/plot.decomposition.R
plot.decomposition | R Documentation |
decomposition
object. Sets custom plot margins and uses the graphical parameters xlim
, horiz
, las
and xlab
which therefore cannot be customizedPlots a barplot of the contribution percentages in a decomposition
object. Sets custom plot margins and uses the graphical parameters xlim
, horiz
, las
and xlab
which therefore cannot be customized
## S3 method for class 'decomposition'
plot(x, decreasing = TRUE, horiz = FALSE, ...)
x |
Object returned from decomposition function |
decreasing |
Whether to sort contributions decreasing or not |
horiz |
If the barplots should be printed horizontally or vertically |
... |
Graphical parameter passed on to |
Invisibly returns x
as the function is called for side effects (plotting).
data(housing)
# Linear regression & decompose
fit.lm <- lm(bmi ~ sex + tenure + place + age,data = housing)
contrib.lm <- contribution(fit.lm, housing$income)
# plot horizontally, in increasing order
plot(contrib.lm, decreasing = FALSE, horiz = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.