# NOT RUN {
data(mtcars)
x <- lm(mpg ~ cyl + hp, data = mtcars)
predictions <- get_predicted(x)
predictions
# Options and methods ---------------------
get_predicted(x, predict = "prediction")
# Get CI
as.data.frame(predictions)
# Bootstrapped
as.data.frame(get_predicted(x, iterations = 4))
summary(get_predicted(x, iterations = 4)) # Same as as.data.frame(..., keep_iterations = F)
# Different predicttion types ------------------------
data(iris)
data <- droplevels(iris[1:100, ])
# Fit a logistic model
x <- glm(Species ~ Sepal.Length, data = data, family = "binomial")
# Expectation (default): response scale + CI
pred <- get_predicted(x, predict = "expectation")
head(as.data.frame(pred))
# Prediction: response scale + PI
pred <- get_predicted(x, predict = "prediction")
head(as.data.frame(pred))
# Link: link scale + CI
pred <- get_predicted(x, predict = "link")
head(as.data.frame(pred))
# Classification: classification "type" + PI
pred <- get_predicted(x, predict = "classification")
head(as.data.frame(pred))
# }
Run the code above in your browser using DataLab