Now, let's draw a picture to look at these standardized residuals.

So ours got some really nice graphics capabilities in

their packages that extend those, the gg plot package is an excellent one.

This is just basic R graphics.

So I'm setting up a 1 by 2 plotting matrix with

this par(mfrow) specification.

And then I want to plot in the two pieces of the plotting matrix.

First I plot on the x axis, a variable called apistrat$cnum.

cnum is county number.

And then on the y axis I plot my standardized residuals.

Just to see if there's some relationship between county and

how big the residual is.

Conceivably that could be true.

You get urban counties, rural counties, they could act differently.

I put some labels on my plot so I could understand it better.

And I draw a horizontal line at 0.

That's where the residuals should be centered if all is going well.

And then a thing that I especially like is to put

a non parametric smoother through the plot.

So if the model's specified correctly your residuals

ought to be up and down around 0, centered on 0.

So this particular non-parametric smoother which is called

lowess ought to be wiggling through above the horizontal 0 line.

So we'll take a look at that.

And I've colored it red just so you can see it and made it twice as big or

wide as the standard selection for the line width.

Now, in the second panel, I'm going to plot the standardized residuals versus

school enrollment, apistrat$enroll, and I label the axes again.

And I fit a non-parametric smoother through there again.