Skip to content

Instantly share code, notes, and snippets.

@t-student
Created October 20, 2015 00:19
Show Gist options
  • Save t-student/02bd13e70206720e03e5 to your computer and use it in GitHub Desktop.
Save t-student/02bd13e70206720e03e5 to your computer and use it in GitHub Desktop.
# For plotting qq
qqplot.data <- function(vec){
y <- quantile(vec[!is.na(vec)], c(0.25, 0.75))
x <- qnorm(c(0.25, 0.75))
slope <- diff(y)/diff(x)
int <- y[1L] - slope * x[1L]
d <- data.frame(resids = vec)
ggplot(d, aes(sample = resids)) +
stat_qq() +
geom_abline(slope = slope, intercept = int)
}
rstd.1.1 <- rstandard(model.1.1)
p <- qqplot.data(df$rstd.1.1)
print(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment