Data Analysis – Linear Regression:: Examine the residuals graphically

Examine the residuals graphically:

	par(oma=c(0,0,5,0))
	par(mfrow=c(1,3))
	hist(resid(aov2.pat1), main = "Histrogram",
+	       xlab ="Residuals", ylab = "Frequency")
	qqnorm(resid(aov2.pat1))
	plot(fitted(aov2.pat1), resid(aov2.pat1),
+	       xlab = "fitted", ylab = "Residuals",
+	       main = "Fitted Values")
	mtext("Residuals - First Patient Trial", side=3,
+	           outer=TRUE, cex=1.5)

Plots of the residuals

Plot of the residuals
Plots of the residuals

Transcript

Now, once we get the ANOVA, one of the important things in dealing with linear regression is to examine the residuals. If the residuals are okay, then you know that your ANOVA has been successful - that it's giving you the right answers.  Now, to do that, we used a histogram plot a qqnormal, and what is called a fitted plot.

And you can see them plotted here. You can see the histograms of the residuals are very closely grouped around zero.  You can see from the Q-Q plot that it is a fairly straight line, that there are not many outliers. (But) And the fitted values you can see if they are well scattered.  So there shouldn't be any dependence between the different measurements.