Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/residualsAnscombe.R
Evaluate the Anscombe residuals for a given type of family
in GLM.
1 | residualsAnscombe(y, mu, family, ...)
|
y |
vector of the response variable |
mu |
vector of the same length as |
family |
an object of class |
... |
not used yet. |
The function performs the Anscombe transformation to obtain residuals that are asymptotically normal distributed. For the Binomial family (see Con and Snell 1968) the transformation is
beta(2/3,2/3)*(pbeta(y/m, 2/3, 2/3) - pbeta(mu-(1-2*mu)/(6*m), 2/3, 2/3))/((mu^(1/6)*(1-mu)^(1/6))/sqrt(m))
where m
is the number of trial and y
the number of successes.
For the Poisson family (see Con and Snell 1968) the transformation is
(3/2*(y^(2/3) - (mu-1/6)^(2/3)))/(mu^(1/6))
while for the Gamma family (see McCullagh and Nelder 1989) the transformation is
3*(y^(1/3) - mu^(1/3))/(mu^(1/3))
and for the Inverse Gaussian family (see McCullagh and Nelder 1989) the transformation is
(\ln(y)-\ln(mu))/√(mu)
It return a vector with the Anscombe residuals.
Claudio Agostinelli and Fatemah Al-quallaf
Agostinelli, C. and Al-quallaf, F. (2009) Robust inference in Generalized Linear Models. Manuscript in preparation.
D. R. Cox and E. J. Snell. A general definition of residuals. Journal of the Royal Statistical Society. Series B (Methodological), 30(2):248-275, 1968.
R. M. Loynes. On cox and snell's general definition of residuals. Journal of the Royal Statistical Society. Series B (Methodological), 31(1):103-106, 1969.
D. A. Pierce and D. W. Schafer. Residuals in generalized linear models. Journal of the American Statistical Association, 81(396):977-986, 1986.
Rollin Brant. Residual components in generalized linear models. The Canadian Journal of Statistics, 15(2):115-126, 1987.
1 2 3 4 5 6 7 8 9 | ## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
print(d.AD <- data.frame(treatment, outcome, counts))
wle.glm.D93 <- wle.glm(counts ~ outcome + treatment, family=poisson())
res <- residualsAnscombe(counts, mu=wle.glm.D93$root1$fitted.values, family=poisson())
qqnorm(res)
qqline(res)
|
Loading required package: circular
Attaching package: 'circular'
The following objects are masked from 'package:stats':
sd, var
treatment outcome counts
1 1 1 18
2 1 2 17
3 1 3 15
4 2 1 20
5 2 2 10
6 2 3 20
7 3 1 25
8 3 2 13
9 3 3 12
Warning message:
In predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == :
calling predict.lm(<fake-lm-object>) ...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.