# NOT RUN {
data(efc)
fit <- lm(neg_c_7 ~ barthtot + c161sex, data = efc)
# accuracy for linear model, with crossvalidation
pred_accuracy(efc, fit)
# accuracy for linear model, with bootstrapping
pred_accuracy(efc, fit, method = "boot", n = 100)
# accuracy for logistic regression, with crossvalidation
efc$services <- sjmisc::dicho(efc$tot_sc_e, dich.by = 0, as.num = TRUE)
fit <- glm(services ~ neg_c_7 + c161sex + e42dep,
data = efc, family = binomial(link = "logit"))
pred_accuracy(efc, fit)
# }
Run the code above in your browser using DataLab