lrtest                package:lmtest                R Documentation

_L_i_k_e_l_i_h_o_o_d _R_a_t_i_o _T_e_s_t _o_f _N_e_s_t_e_d _M_o_d_e_l_s

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

     'lrtest' is a generic function for carrying out likelihood ratio
     tests. The default method can be employed for comparing nested
     (generalized) linear models (see details below).

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

      lrtest(object, ...)

      ## Default S3 method:
      lrtest(object, ..., name = NULL) 

      ## S3 method for class 'formula':
      lrtest(object, ..., data = list())

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

  object: an object. See below for details.

     ...: further object specifications passed to methods. See below
          for details.

    name: a function for extracting a suitable name/description from a
          fitted model object. By default the name is queried by
          calling 'formula'.

    data: a data frame containing the variables in the model.

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

     'lrtest' is intended to be a generic function for comparisons of
     models via asympotic likelihood ratio tests. The default method
     consecutively compares the fitted model object 'object' with the
     models passed in '...'. Instead of passing the fitted model
     objects in '...', several other specifications are possible. The
     updating mechanism is the same as for 'waldtest': the models in
     '...' can be specified as integers, characters (both for terms
     that should be eliminated from the previous model), update
     formulas or fitted model objects. Except for the last case, the
     existence of an 'update' method is assumed. See 'waldtest' for
     details.

     Subsequently, an asymptotic likelihood ratio test for each two
     consecutive models is carried out: Twice the difference in
     log-likelihoods (as derived by the 'logLik' methods) is compared
     with a Chi-squared distribution.

     The '"formula"' method fits a 'lm' first and then calls the
     default  method.

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

     An object of class '"anova"' which contains the log-likelihood,
     degrees of freedom, the difference in degrees of freedom,
     likelihood ratio Chi-squared statistic and corresponding p value.

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

     'waldtest'

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

     ## with data from Greene (1993):
     ## load data and compute lags
     data("USDistLag")
     usdl <- na.contiguous(cbind(USDistLag, lag(USDistLag, k = -1)))
     colnames(usdl) <- c("con", "gnp", "con1", "gnp1")

     fm1 <- lm(con ~ gnp + gnp1, data = usdl)
     fm2 <- lm(con ~ gnp + con1 + gnp1, data = usdl)

     ## various equivalent specifications of the LR test
     lrtest(fm2, fm1)
     lrtest(fm2, 2)
     lrtest(fm2, "con1")
     lrtest(fm2, . ~ . - con1)

