residuals2 | R Documentation |
Computes residuals for a fitted linear or generalized linear model.
residuals2(object, type, standardized = FALSE, plot.it = FALSE, identify, ...)
object |
a object of the class lm or glm. |
type |
an (optional) character string giving the type of residuals which should be returned. The available options for LMs are: (1) externally studentized ("external"); (2) internally studentized ("internal") (default). The available options for GLMs are: (1) "pearson"; (2) "deviance" (default); (3) "quantile". |
standardized |
an (optional) logical switch indicating if the residuals should be standardized by dividing by the square root of |
plot.it |
an (optional) logical switch indicating if a plot of the residuals versus the fitted values is required. As default, |
identify |
an (optional) integer value indicating the number of individuals to identify on the plot of residuals. This is only appropriate when |
... |
further arguments passed to or from other methods |
A vector with the observed residuals type type
.
Atkinson A.C. (1985) Plots, Transformations and Regression. Oxford University Press, Oxford.
Davison A.C., Gigli A. (1989) Deviance Residuals and Normal Scores Plots. Biometrika 76, 211-221.
Dunn P.K., Smyth G.K. (1996) Randomized Quantile Residuals. Journal of Computational and Graphical Statistics 5, 236-244.
Pierce D.A., Schafer D.W. (1986) Residuals in Generalized Linear Models. Journal of the American Statistical Association 81, 977-986.
###### Example 1: Species richness in plots
data(richness)
fit1 <- lm(Species ~ Biomass + pH, data=richness)
residuals2(fit1, type="external", plot.it=TRUE, col="red", pch=20, col.lab="blue",
col.axis="blue", col.main="black", family="mono", cex=0.8)
###### Example 2: Lesions of Aucuba mosaic virus
data(aucuba)
fit2 <- glm(lesions ~ time, family=poisson, data=aucuba)
residuals2(fit2, type="quantile", plot.it=TRUE, col="red", pch=20, col.lab="blue",
col.axis="blue",col.main="black",family="mono",cex=0.8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.