[R] Plot residuals against standard normal distribution

Mikael Olai Milhøj mikaelmilhoj at gmail.com
Mon Feb 2 23:42:40 CET 2015


Hi,

I'm having trouble trying to plot the density of the residuals against the
standard normal distribution N(0,1). (I'm trying to see if my residuals are
well-behaved).

I know hwo to calculate the standardized residuals (I guess that there may
be a simple way using a R function) and then plot this by using the density
function

y<-(model$residuals-mean(model$residuals))/sd(model$residuals)
plot(density(y))

But I don't know how to add the N(0,1) curve. Any suggestions? Thanks in
advance


/Mikael

	[[alternative HTML version deleted]]



More information about the R-help mailing list