Search code examples
rplotregressionlinear-regressionlm

"plot.new" error when checking normality of residuals using qqline()


I would like to check if my model (standardized) residuals are normally distributed.

model <- lm(ratiopermonth ~ Greenspace, data = mydata)
qqline(rstandard(model))

But I got an error message:

plot.new has not been called yet

What is wrong?


Solution

  • qqline is to be used after qqnorm.

    r <- rstandard(model)
    qqnorm(r)
    qqline(r)