set.seed(123)
y <- salary$hourly_earnings_log
x <- cbind(1, salary$age, salary$educational_attainment, salary$children_number)
test_salary <- devianlm_stats(y, x, n_sims = 100, quant = 0.95)
plot(test_salary$reg_residuals,
pch = 16, cex = .8,
ylim = c(-1 * max(abs(test_salary$reg_residuals)), max(abs(test_salary$reg_residuals))),
xlab = "", ylab = "Studentized residuals",
col = ifelse(test_salary$is_outliers, "red", "black"))
# Add the thresholds lines:
abline(h = c(-test_salary$threshold, test_salary$threshold), col = "chartreuse2", lwd = 2)
Run the code above in your browser using DataLab