anova.glm               package:stats               R Documentation

_A_n_a_l_y_s_i_s _o_f _D_e_v_i_a_n_c_e _f_o_r _G_e_n_e_r_a_l_i_z_e_d _L_i_n_e_a_r _M_o_d_e_l _F_i_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Compute an analysis of deviance table for one or more generalized
     linear model fits.

_U_s_a_g_e:

     ## S3 method for class 'glm':
     anova(object, ..., dispersion = NULL, test = NULL)

_A_r_g_u_m_e_n_t_s:

object, ...: objects of class 'glm', typically the result of a call to
          'glm', or a list of 'objects' for the '"glmlist"' method.

dispersion: the dispersion parameter for the fitting family. By default
          it is obtained from the object(s).

    test: a character string, (partially) matching one of '"Chisq"',
          '"F"' or '"Cp"'. See 'stat.anova'.

_D_e_t_a_i_l_s:

     Specifying a single object gives a sequential analysis of deviance
     table for that fit.  That is, the reductions in the residual
     deviance as each term of the formula is added in turn are given in
     as the rows of a table, plus the residual deviances themselves.

     If more than one object is specified, the table has a row for the
     residual degrees of freedom and deviance for each model. For all
     but the first model, the change in degrees of freedom and deviance
     is also given. (This only makes statistical sense if the models
     are nested.)  It is conventional to list the models from smallest
     to largest, but this is up to the user.

     The table will optionally contain test statistics (and P values)
     comparing the reduction in deviance for the row to the residuals.
     For models with known dispersion (e.g., binomial and Poisson fits)
     the chi-squared test is most appropriate, and for those with
     dispersion estimated by moments (e.g., 'gaussian', 'quasibinomial'
     and 'quasipoisson' fits) the F test is most appropriate.  Mallows'
     Cp statistic is the residual deviance plus twice the estimate of
     sigma^2 times the residual degrees of freedom, which is closely
     related to AIC (and a multiple of it if the dispersion is known).

     The dispersion estimate will be taken from the largest model,
     using the value returned by 'summary.glm'.  As this will in most
     cases use a Chisquared-based estimate, the F tests are not based
     on the residual deviance in the analysis of deviance table shown.

_V_a_l_u_e:

     An object of class '"anova"' inheriting from class '"data.frame"'.

_W_a_r_n_i_n_g:

     The comparison between two or more models by 'anova' or
     'anova.glmlist' will only be valid if they are fitted to the same
     dataset. This may be a problem if there are missing values and R's
     default of 'na.action = na.omit' is used, and 'anova.glmlist' will
     detect this with an error.

_R_e_f_e_r_e_n_c_e_s:

     Hastie, T. J. and Pregibon, D. (1992) _Generalized linear models._
     Chapter 6 of _Statistical Models in S_ eds J. M. Chambers and T.
     J. Hastie, Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'glm', 'anova'.

     'drop1' for so-called 'type II' anova where each term is dropped
     one at a time respecting their hierarchy.

_E_x_a_m_p_l_e_s:

     ## --- Continuing the Example from  '?glm':

     anova(glm.D93)
     anova(glm.D93, test = "Cp")
     anova(glm.D93, test = "Chisq")

