logLik.lm                package:base                R Documentation

_E_x_t_r_a_c_t _L_o_g-_L_i_k_e_l_i_h_o_o_d _f_r_o_m _a_n _l_m _O_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     If 'REML = FALSE', returns the log-likelihood value of the linear
     model represented by 'object' evaluated at the estimated
     coefficients; else, the restricted log-likelihood evaluated at the
     estimated coefficients is returned.

_U_s_a_g_e:

     ## S3 method for class 'lm':
     logLik(object, REML = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

  object: an object inheriting from class '"lm"'.

    REML: an optional logical value.  If 'TRUE' the restricted
          log-likelihood is returned, else, if 'FALSE', the
          log-likelihood is returned.  Defaults to 'FALSE'.

     ...: further arguments to be passed to or from methods.

_V_a_l_u_e:

     an object of class 'logLik', the (restricted) log-likelihood of
     the linear model represented by 'object' evaluated at the
     estimated coefficients.  Note that error variance sigma^2 is
     estimated in 'lm()' and hence counted as well.

_A_u_t_h_o_r(_s):

     Jose Pinheiro and Douglas Bates

_R_e_f_e_r_e_n_c_e_s:

     Harville, D.A. (1974). Bayesian inference for variance components
     using only error contrasts. _Biometrika_, *61*, 383-385.

_S_e_e _A_l_s_o:

     'lm'

_E_x_a_m_p_l_e_s:

     data(attitude)
     (fm1 <- lm(rating ~ ., data = attitude))
     logLik(fm1)
     logLik(fm1, REML = TRUE)

     res <- try(data(Orthodont, package="nlme"))
     if(!inherits(res, "try-error")) {
       fm1 <- lm(distance ~ Sex * age, Orthodont)
       print(logLik(fm1))
       print(logLik(fm1, REML = TRUE))
     }

