Description Usage Arguments Value Examples
Explain difference between predictions from a model
1 2 3 4 5 6 7 8 9 10 11 | epdiff1(
mod,
x1,
x2,
d,
predictfunc,
predictfuncwithmod,
name1,
name2,
namesfromcol
)
|
mod |
Model |
x1 |
Input 1. Single row data frame or matrix. |
x2 |
Input 2. Single row data frame or matrix. |
d |
Max number of input dimensions to use. |
predictfunc |
Func to use to predict. Defaults to 'predict'. Takes in model and data. |
predictfuncwithmod |
Func to use to predict. Only takes in data. |
name1 |
Name x1 |
name2 |
Name for x2 |
namesfromcol |
Column of x1/x2 to get name from |
ggplot object showing effect
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # gbm
m1 <- gbm::gbm(Petal.Width ~ Sepal.Length + Sepal.Width, data=iris, distribution='gaussian')
x1 <- iris[1,]
x2 <- iris[2,]
epdiff1(m1, x1, x2)
epdiff1(m1, iris[12,], iris[20,])
epdiff1(m1, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),])
epdiff1(m1, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),], predictfunc=predict)
epdiff1(m1, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),],
predictfuncwithmod=function(xx){suppressMessages(predict(m1, xx))})
epdiff1(NA, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),],
predictfuncwithmod=function(xx){suppressMessages(predict(m1, xx))})
epdiff1(m1, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),], name1='aa', name2='bb')
epdiff1(m1, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),], namesfromcol="Species")
# Linear model
mod_lm <- lm(Petal.Width ~ Sepal.Length + Sepal.Width, data=iris)
epdiff1(mod_lm, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),])
epdiff1(mod_lm, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),], d=3)
mod_lm2 <- lm(Petal.Width ~ Petal.Length + Sepal.Width, data=iris)
epdiff1(mod_lm2, iris[sample(1:nrow(iris), 1),], iris[sample(1:nrow(iris), 1),])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.