Skip to content

Instantly share code, notes, and snippets.

@timcdlucas
Created July 15, 2020 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timcdlucas/aaab0e8eb34a26ca061ad6ef9d4ff09b to your computer and use it in GitHub Desktop.
Save timcdlucas/aaab0e8eb34a26ca061ad6ef9d4ff09b to your computer and use it in GitHub Desktop.
library(MASS)
N <- 60
x <- rep(c('a', 'b'), N)
x_dummy <- as.numeric(x == 'a')
y <- x_dummy + rt(N, 2)
data <- data.frame(x = x, y = y)
boxplot(y ~ x, data)
m1 <- lm(y ~ x, data = data)
plot(m1)
m2 <- rlm(y ~ x, data = data)
plot(m2) # residual vs leverage plot looks ok.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment