What is the Q-Q plot in linear regression model?

4.6K    Asked by tomEllison in Data Science , Asked on Jun 1, 2020
Answered by tom Ellison

As it is clear with name, the Q-Q plot is a graphical plotting of the quantiles of two distributions with respect to each other. In other words we can say plot quantiles against quantiles. Whenever we are interpreting a Q-Q plot, we shall concentrate on the ‘y = x’ line. We also call it the 45-degree line in statistics. It entails that each of our distributions has the same quantiles. In case if we witness a deviation from this line, one of the distributions could be skewed when compared to the other.

Here is an example, where we are generating data x from a Gamma distribution with shape = 2 and rate = 1 parameter.

# Set seed for reproducibility

set.seed(2017);

# Generate some Gamma distributed data

x <- rgamma(100, shape = 2, rate = 1);

# Sort x values

x <- sort(x);

# Theoretical distribution

x0 <- qgamma(ppoints(length(x)), shape = 2, rate = 1);

plot(x = x0, y = x, xlab = "Theoretical quantiles", ylab = "Observed quantiles");

abline(a = 0, b = 1, col = "red");


Above code will output like this:



Your Answer

Interviews

Parent Categories