Anova                  package:car                  R Documentation

_A_n_o_v_a _T_a_b_l_e_s _f_o_r _L_i_n_e_a_r _a_n_d _G_e_n_e_r_a_l_i_z_e_d _L_i_n_e_a_r _M_o_d_e_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     Calculates type-II or type-III analysis-of-variance tables for
     model objects produced by 'lm' and 'glm'. For linear models,
     F-tests are calculated; for generalized linear models, 
     likelihood-ratio chisquare, Wald chisquare, or F-tests are
     calculated.

_U_s_a_g_e:

     Anova(mod, ...)

     ## S3 method for class 'lm':
     Anova(mod, error, type=c("II", "III"), ...)

     ## S3 method for class 'aov':
     Anova(mod, ...)

     ## S3 method for class 'glm':
     Anova(mod, type=c("II", "III"), test.statistic=c("LR", "Wald", "F"), 
         error, error.estimate=c("pearson", "dispersion", "deviance"), ...)

_A_r_g_u_m_e_n_t_s:

     mod: 'lm' or 'glm' model object.

   error: for a linear model, an 'lm' model object from which the error
          sum of squares and degrees of freedom are to be calculated.
          For  F-tests for a generalized linear model, a 'glm' object
          from which the dispersion is to be estimated. If not
          specified, 'mod' is used.

    type: type of test, '"II"' or '"III"'.

test.statistic: for a generalized linear model, whether to calculate 
          '"LR"' (likelihood-ratio), '"Wald"', or '"F"' tests.

error.estimate: for F-tests for a generalized linear model, base the
          dispersion estimate on the Pearson residuals ('pearson', the
          default); use the dispersion estimate in the model object
          ('dispersion'), which, e.g., is fixed to 1 for binomial and
          Poisson models; or base the dispersion estimate on the
          residual deviance ('deviance').

     ...: arguments to be passed to 'linear.hypothesis'; only use
          'white.adjust' for a linear model.

_D_e_t_a_i_l_s:

     The designations "type-II" and "type-III" are borrowed from SAS,
     but the definitions used here do not correspond precisely to those
     employed by SAS.  Type-II tests are calculated according to the
     principle of marginality, testing each term after all others,
     except ignoring the term's higher-order relatives; so-called
     type-III tests violate marginality, testing  each term in the
     model after all of the others. This definition of Type-II tests 
     corresponds to the tests produced by SAS for analysis-of-variance
     models, where all of the predictors are factors, but not more
     generally (i.e., when there are quantitative predictors). Be very
     careful in formulating the model for type-III tests, or the
     hypotheses tested will not make sense. 

     As implemented here, type-II Wald tests for generalized linear
     models are actually _differences_ of Wald statistics.

     For all but type-II likelihood-ratio and _F_ tests for generalized
     linear models,  'Anova' finds the test statistics without
     refitting the model.

     The standard R 'anova' function calculates sequential ("type-I")
     tests. These rarely test interesting hypotheses.

_V_a_l_u_e:

     An object of class 'anova', usually printed.

_W_a_r_n_i_n_g:

     Be careful of type-III tests.

_A_u_t_h_o_r(_s):

     John Fox jfox@mcmaster.ca

_R_e_f_e_r_e_n_c_e_s:

     Fox, J. (1997) _Applied Regression, Linear Models, and Related
     Methods._ Sage.

_S_e_e _A_l_s_o:

     'linear.hypothesis', 'anova'

_E_x_a_m_p_l_e_s:

     data(Moore)
     mod<-lm(conformity~fcategory*partner.status, data=Moore, 
       contrasts=list(fcategory=contr.sum, partner.status=contr.sum))
     Anova(mod)
     ## Anova Table (Type II tests)
     ##
     ## Response: conformity
     ##                         Sum Sq Df F value   Pr(>F)
     ## fcategory                 11.61  2  0.2770 0.759564
     ## partner.status           212.21  1 10.1207 0.002874
     ## fcategory:partner.status 175.49  2  4.1846 0.022572
     ## Residuals                817.76 39                 
     Anova(mod, type="III")
     ## Anova Table (Type III tests)
     ##
     ## Response: conformity
     ##                          Sum Sq Df  F value    Pr(>F)
     ## (Intercept)              5752.8  1 274.3592 < 2.2e-16
     ## fcategory                  36.0  2   0.8589  0.431492
     ## partner.status            239.6  1  11.4250  0.001657
     ## fcategory:partner.status  175.5  2   4.1846  0.022572
     ## Residuals                 817.8 39                   

