06.09.2021 Views

Learning Statistics with R - A tutorial for psychology students and other beginners, 2018a

Learning Statistics with R - A tutorial for psychology students and other beginners, 2018a

Learning Statistics with R - A tutorial for psychology students and other beginners, 2018a

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Observed Values<br />

40 50 60 70 80 90<br />

50 60 70 80<br />

Fitted Values<br />

Figure 15.12: Plot of the fitted values against the observed values of the outcome variable. A straight<br />

line is what we’re hoping to see here. This looks pretty good, suggesting that there’s nothing grossly<br />

wrong, but there could be hidden subtle issues.<br />

.......................................................................................................<br />

15.9.4 Checking the linearity of the relationship<br />

The third thing we might want to test is the linearity of the relationships between the predictors <strong>and</strong><br />

the outcomes. There’s a few different things that you might want to do in order to check this. Firstly, it<br />

never hurts to just plot the relationship between the fitted values Ŷi <strong>and</strong> the observed values Y i <strong>for</strong> the<br />

outcome variable, as illustrated in Figure 15.12. Todrawthiswecouldusethefitted.values() function<br />

to extract the Ŷi values in much the same way that we used the residuals() function to extract the ɛ i<br />

values. So the comm<strong>and</strong>s to draw this figure might look like this:<br />

> yhat.2 plot( x = yhat.2,<br />

+ y = parenthood$dan.grump,<br />

+ xlab = "Fitted Values",<br />

+ ylab = "Observed Values"<br />

+ )<br />

One of the reasons I like to draw these plots is that they give you a kind of “big picture view”. If this plot<br />

looks approximately linear, then we’re probably not doing too badly (though that’s not to say that there<br />

aren’t problems). However, if you can see big departures from linearity here, then it strongly suggests<br />

that you need to make some changes.<br />

In any case, in order to get a more detailed picture it’s often more in<strong>for</strong>mative to look at the relationship<br />

between the fitted values <strong>and</strong> the residuals themselves. Again, we could draw this plot using low<br />

- 484 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!