fit_add <- lm(Sepal.Length ~ ., data = iris)
fl_add <- flashlight(model = fit_add, label = "additive", data = iris)
plot(light_ice(fl_add, v = "Sepal.Width", n_max = 200), alpha = 0.2)
plot(light_ice(fl_add, v = "Sepal.Width", n_max = 200, center = "first"))
# Second model with interactions
fit_nonadd <- lm(Sepal.Length ~ . + Sepal.Width:Species, data = iris)
fl_nonadd <- flashlight(model = fit_nonadd, label = "nonadditive", data = iris)
fls <- multiflashlight(list(fl_add, fl_nonadd))
plot(light_ice(fls, v = "Sepal.Width", by = "Species", n_max = 200), alpha = 0.2)
plot(light_ice(fls, v = "Sepal.Width", by = "Species", n_max = 200, center = "mid"))
Run the code above in your browser using DataLab