coeftest               package:lmtest               R Documentation

_T_e_s_t_i_n_g _E_s_t_i_m_a_t_e_d _C_o_e_f_f_i_c_i_e_n_t_s

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

     'coeftest' is a generic function for performing  z and (quasi-)t
     tests of estimated coefficients.

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

     coeftest(x, vcov. = NULL, df = NULL, ...)

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

       x: an object (for details see below).

   vcov.: a specification of the covariance matrix of the estimated
          coefficients. This can be specified as a matrix or as a
          function yielding a matrix when applied to 'x'.

      df: the degrees of freedom to be used. If this is a finite
          positive number a t test with 'df' degrees of freedom is
          performed. In all other cases, a z test (using a normal
          approximation) is performed. By default it tries to use
          'x$df.residual' and performs a z test if this is 'NULL'.

     ...: further arguments passed to the methods.

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

     The generic function 'coeftest' currently has a default method
     (which works in particular for '"lm"' and '"glm"' objects) and a
     method for objects of class '"breakpointsfull"' (as computed by
     'breakpointsfull').

     The default method assumes that a 'coef' methods exists, such that
     'coef(x)' yields the estimated coefficients.

     To specify a covariance matrix 'vcov.' to be used, there are three
     possibilities: 1. It is pre-computed and supplied in argument
     'vcov.'. 2. A function for extracting the covariance matrix from 
     'x' is supplied, e.g., 'vcovHC' or 'vcovHAC' from package
     'sandwich'. 3. 'vcov.' is set to 'NULL', then it is assumed that a
     'vcov' method exists, such that 'vcov(x)' yields a covariance
     matrix. For illustrations see below.

     The degrees of freedom 'df' determine whether a normal
     approximation is used or a t distribution with 'df' degrees of
     freedoms is used. The default method uses 'df.residual(x)' and if
     this is 'NULL' a z test is performed.

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

     An object of class '"coeftest"' which is essentially a coefficient
     matrix with columns containing the estimates, associated standard
     errors, test statistics and p values.

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

     'lm', 'waldtest'

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

     ## load data and fit model
     data(Mandible)
     fm <- lm(length ~ age, data=Mandible, subset=(age <= 28))

     ## the following commands lead to the same tests:
     summary(fm)
     coeftest(fm)

     ## a z test (instead of a t test) can be performed by
     coeftest(fm, df = Inf)

     if(require(sandwich)) {
     ## a different covariance matrix can be also used:
     ## either supplied as a function
     coeftest(fm, df = Inf, vcov = vcovHC)
     ## or as a matrix
     coeftest(fm, df = Inf, vcov = vcovHC(fm, type = "HC0"))
     }

