1\name{anova.glmrob}
2\alias{anova.glmrob}
3\title{Analysis of Robust Quasi-Deviance for "glmrob" Objects}
4\description{
5  Compute an analysis of robust quasi-deviance table for one or more
6  generalized linear models fitted by \code{\link{glmrob}}.
7}
8\usage{
9\method{anova}{glmrob}(object, ..., test = c("Wald", "QD", "QDapprox"))
10}
11\arguments{
12  \item{object, \dots}{objects of class \code{glmrob}, typically
13    the result of a call to \code{\link{glmrob}}.}
14  \item{test}{a character string specifying the test statistic to be
15    used.  (Partially) matching one of \code{"Wald"}, \code{"QD"} or
16    \code{"QDapprox"}. See Details.}
17}
18\details{
19  Specifying a single object gives a sequential analysis of robust
20  quasi-deviance table for that fit.  That is, the reductions in the
21  robust residual quasi-deviance as each term of the formula is added in
22  turn are given in as the rows of a table. \emph{(Currently not yet
23  implemented.)}
24
25  If more than one object is specified, the table has a row for the
26  residual quasi-degrees of freedom (However, this information is never used in
27  the asymptotic tests).  For all but the first model, the
28  change in degrees of freedom and robust quasi-deviance is also
29  given.  (This only makes statistical sense if the models are nested.)
30  It is conventional to list the models from smallest to largest, but
31  this is up to the user.
32
33  In addition, the table will contain test statistics and P values
34  comparing the reduction in robust quasi-deviance for the model on the
35  row to that on top of it.  For all robust fitting methods, the
36  \dQuote{Wald}-type test between two models can be applied (\code{test
37    = "Wald"}).
38
39  When using Mallows or Huber type robust estimators
40  (\code{method="Mqle"} in \code{\link{glmrob}}), then there are
41  additional test methods.  One is the robust quasi-deviance test
42  (\code{test = "QD"}), as described by Cantoni and Ronchetti (2001).
43  The asymptotic distribution is approximated by a chi-square
44  distibution.  Another test (\code{test = "QDapprox"}) is based on a
45  quadratic approximation of the robust quasi-deviance test
46  statistic.  Its asymptotic distribution is chi-square (see the reference).
47
48  The comparison between two or more models by \code{anova.glmrob}
49  will only be valid if they are fitted to the same dataset and by the same
50  robust fitting method using the same tuning constant \eqn{c} (\code{tcc} in
51  \code{\link{glmrob}}).
52}
53\value{
54  Basically, an object of class \code{\link{anova}} inheriting from class
55  \code{\link{data.frame}}.
56}
57\references{
58  E. Cantoni and E. Ronchetti (2001)
59  Robust Inference for Generalized Linear Models.
60  \emph{JASA} \bold{96} (455), 1022--1030.
61
62  E.Cantoni (2004)
63  Analysis of Robust Quasi-deviances for Generalized Linear Models.
64  \emph{Journal of Statistical Software} \bold{10},
65  \url{https://www.jstatsoft.org/article/view/v010i04}
66}
67
68\author{ Andreas Ruckstuhl }
69
70\seealso{ \code{\link{glmrob}}, \code{\link{anova}}.
71%%
72%%   \code{\link{drop1}} for
73%%   so-called \sQuote{type II} anova where each term is dropped one at a
74%%   time respecting their hierarchy.
75}
76\examples{
77## Binomial response -----------
78data(carrots)
79Cfit2 <- glmrob(cbind(success, total-success) ~ logdose + block,
80                family=binomial, data=carrots, method="Mqle",
81                control=glmrobMqle.control(tcc=1.2))
82summary(Cfit2)
83
84Cfit4 <- glmrob(cbind(success, total-success) ~ logdose * block,
85                family=binomial, data=carrots, method="Mqle",
86                control=glmrobMqle.control(tcc=1.2))
87
88anova(Cfit2, Cfit4, test="Wald")
89
90anova(Cfit2, Cfit4, test="QD")
91
92anova(Cfit2, Cfit4, test="QDapprox")
93
94## Poisson response ------------
95data(epilepsy)
96
97Efit2 <- glmrob(Ysum ~ Age10 + Base4*Trt, family=poisson, data=epilepsy,
98               method="Mqle", control=glmrobMqle.control(tcc=1.2,maxit=100))
99summary(Efit2)
100
101Efit3 <- glmrob(Ysum ~ Age10 + Base4 + Trt, family=poisson, data=epilepsy,
102               method="Mqle", control=glmrobMqle.control(tcc=1.2,maxit=100))
103
104anova(Efit3, Efit2, test = "Wald")
105
106anova(Efit3, Efit2, test = "QD")
107
108## trivial intercept-only-model:
109E0 <- update(Efit3, . ~ 1)
110anova(E0, Efit3, Efit2, test = "QDapprox")
111%% failed in robustbase <= 2013-11-27
112}
113\keyword{robust}
114\keyword{models}
115\keyword{regression}
116