Falco tinnunculus
2008-Feb-07 10:56 UTC
[R] How to calculate normality of the residuals from a test in R?
En innebygd og tegnsett-uspesifisert tekst ble skilt ut... Navn: ikke tilgjengelig Nettadresse: https://stat.ethz.ch/pipermail/r-help/attachments/20080207/891f1e80/attachment.pl
Henrique Dallazuanna
2008-Feb-07 11:06 UTC
[R] How to calculate normality of the residuals from a test in R?
You can use shapiro.test shapiro.test(mod1$res) Also you can plot the value: plot(mod1, 2) text(par("usr")[1]+1, par("usr")[4]-.5, labels=paste("p-value", round(shapiro.test(mod1$res)$p.value, 4), sep="=")) On 07/02/2008, Falco tinnunculus <kestrel78 at gmail.com> 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, > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
Gavin Simpson
2008-Feb-07 12:05 UTC
[R] How to calculate normality of the residuals from a test in R?
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 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Possibly Parallel Threads
- How to make reference to R in the method section in a scientific article?
- Checking for linearity by ploting residuals against predicted values (lme)?
- Is it possible with two random effects in lme()?
- How to run interaction between to categoric variables in lme()?
- How to run one-way anova R?