> On 02 Feb 2015, at 23:42 , Mikael Olai Milhøj <mikaelmil...@gmail.com> wrote: > > 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
I'd try curve(dnorm(x), add=TRUE) Some diddling of ylim= is usually required. I'd usually prefer qqnorm() for normality checks, though; it is pretty hard to assess the tails of density plots. Also notice rstandard(), rstudent(). -pd > > > /Mikael > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.