R/getcoef.R

Defines functions getcoef

Documented in getcoef

###
### R routines for the R package dlnm (c)
#
getcoef <-
  function(model, class) {
    #
    ################################################################################
    #
    # EXTRACT COEF
    # NB: gam, gee AND geeglm HAVE CLASS glm AS WELL
    coef <- if(any(class%in%c("glm","gam","coxph"))) coef(model) else
      if(any(class%in%c("lme","lmerMod","glmerMod","lmerModLmerTest"))) fixef(model) else
        tryCatch(coef(model),error=function(w) "error")
    if(identical(coef,"error")) stop("methods for coef() and vcov() must ",
      "exist for the class of object 'model'. If not, extract them manually and ",
      "use the arguments 'coef' and 'vcov'")
    #
    return(coef)
  }

Try the dlnm package in your browser

Any scripts or data that you put into this service are public.

dlnm documentation built on Oct. 7, 2021, 5:09 p.m.