Re: [R] How to calculate normality of the residuals from a test in R?

From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>
Date: Thu, 07 Feb 2008 12:05:44 +0000

hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO

On Thu, 2008-02-07 at 11:56 +0100, Falco tinnunculus wrote:
> Hi,
>
> How do I calculate normality distribution of the residuals from a test in R?
>
> I have tried plot(mod1), and I get a nice plot, but no p-value... is there
> some other ways to calculate this?
>
> Regards Kes,

You could use a QQ-plot to judge normality of residuals.

x <- runif(100)
y <- 3 + (0.8 * x) + rnorm(100, mean = 0, sd = 0.5) mod <- lm(y ~ x)

mod.resi <- resid(mod)
qqnorm(mod.resi)
qqline(mod.resi)

Systematic deviations from the line, indicate departures from normality (in this case), such as heavy tails, skewness. If the residuals were normally distributed they should be scattered around the line.

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
R-help_at_r-project.org mailing list
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.
Received on Thu 07 Feb 2008 - 12:09:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 07 Feb 2008 - 12:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive