Description Usage Arguments Value Examples
Breaking Down of Model Predictions for lm models
1 2 3 4 5 6 7 8 | ## S3 method for class 'lm'
broken(
model,
new_observation,
...,
baseline = 0,
predict.function = stats::predict.lm
)
|
model |
a lm model |
new_observation |
a new observation with columns that corresponds to variables used in the model |
... |
other parameters |
baseline |
the orgin/baseline for the breakDown plots, where the rectangles start. It may be a number or a character "Intercept". In the latter case the orgin will be set to model intercept. |
predict.function |
function that will calculate predictions out of model (typically |
an object of the broken class
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | model <- lm(Sepal.Length~., data=iris)
new_observation <- iris[1,]
br <- broken(model, new_observation)
plot(br)
# works for interactions as well
model <- lm(Sepal.Length ~ Petal.Width*Species, data = iris)
summary(model)
new_observation <- iris[1,]
br <- broken(model, new_observation)
br
plot(br)
br2 <- broken(model, new_observation, predict.function = betas)
br2
plot(br2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.