data(efc)
fit <- lm(barthtot ~ c160age + c12hour + c161sex + c172code, data = efc)
outliers(fit)
heteroskedastic(fit)
autocorrelation(fit)
normality(fit)
check_assumptions(fit)
fit <- lm(barthtot ~ c160age + c12hour + c161sex + c172code + neg_c_7,
data = efc)
outliers(fit)
check_assumptions(fit, as.logical = TRUE)
# apply function to multiple models in list-variable
library(dplyr)
tmp <- efc %>%
bootstrap(50) %>%
mutate(models = lapply(.$strap, function(x) {
lm(neg_c_7 ~ e42dep + c12hour + c161sex, data = x)
}))
# for list-variables, argument 'model.column' is the
# quoted name of the list-variable with fitted models
tmp %>% heteroskedastic("models")
# Durbin-Watson-Test from package 'car' takes a little bit longer due
# to simulation of p-values...
## Not run:
# tmp %>% check_assumptions("models", as.logical = TRUE, reps = 100)## End(Not run)
Run the code above in your browser using DataLab