George Harrison
George Harrison

Reputation: 13

When graphing residual error in R, how do I only show 1 graph on my R Markdown?

Basically, I want to graph my residual error.

I have my linear regression line, say it's called "regline".

When I plot regline to get a graph of my residual error, I type:

plot(regline)

The problem is, I get 4 different graphs. Residuals vs. fitted, normal Q-Q, Scale-Location, Residuals vs. Leverage, but I only want the first one. I only want residuals vs. fitted. WHen I create an R Markdown, it shows all 4. How can I make it so that wehen i create an R markdown, I only get Residuals vs. fitted, rather than all 4.

Thanks

Upvotes: 1

Views: 656

Answers (1)

neilfws
neilfws

Reputation: 33782

See ?plot.lm.

which
if a subset of the plots is required, specify a subset of the numbers 1:6, see caption below (and the ‘Details’) for the different kinds.

So you want:

plot(regline, which = 1)

Upvotes: 2

Related Questions