Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
quantile quantile plot
qqplot <- function(y, distribution=qnorm) {
x <- distribution(ppoints(y))
plot(x, sort(y),
xlab="Theoretical Quantiles",
ylab="Sample Quantiles",
main="Normal Q-Q Plot"
qqplot2 <- function(y, distribution=qnorm) {
x <- distribution(ppoints(y))
d <- data.frame(x=x, y=sort(y))
p <- ggplot(d, aes(x=x, y=y)) +
geom_point() +
geom_line(aes(x=x, y=x)) +
opts(title="Normal Q-Q Plot") +
xlab("Theoretical Quantiles") +
ylab("Sample Quantiles")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.