library(modelbased)
# Linear Models
model <- lm(mpg ~ wt, data = mtcars)
# Get predicted and prediction interval (see insight::get_predicted)
estimate_response(model)
# Get expected values with confidence interval
pred <- estimate_relation(model)
pred
# Visualisation (see visualisation_recipe())
if (require("see")) {
plot(pred)
}
# Standardize predictions
pred <- estimate_relation(lm(mpg ~ wt + am, data = mtcars))
z <- standardize(pred, include_response = FALSE)
z
unstandardize(z, include_response = FALSE)
# Logistic Models
model <- glm(vs ~ wt, data = mtcars, family = "binomial")
estimate_response(model)
estimate_relation(model)
# Mixed models
if (require("lme4")) {
model <- lmer(mpg ~ wt + (1 | gear), data = mtcars)
estimate_response(model)
estimate_relation(model)
}
# Bayesian models
# \donttest{
if (require("rstanarm")) {
model <- suppressWarnings(rstanarm::stan_glm(
mpg ~ wt,
data = mtcars, refresh = 0, iter = 200
))
estimate_response(model)
estimate_relation(model)
}
# }
Run the code above in your browser using DataLab