R/glm.vc.R

Defines functions glm.vc

Documented in glm.vc

#' Compute variance-covariance matrix.
#'
#' Calculate the (unscaled) variance-covariance matrix from a generalized linear model regression output. Used in `GLMpack` within the function `glm.summary()`.
#'
#' @param obj The regression output from glm().
#' @return The output is a matrix.
#' @examples
#' data(campaign)
#' attach(campaign)
#' cmpgn.out <- glm(TOTCONTR ~ CANDGENDER + PARTY + INCUMCHALL + HISPPCT,
#'               family=Gamma(link = 'log'), data=campaign)
#' glm.vc(cmpgn.out)
#'
#' @export
glm.vc <- function(obj){
  summary(obj)$dispersion * summary(obj)$cov.unscaled
}

Try the GLMpack package in your browser

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

GLMpack documentation built on July 19, 2019, 5:05 p.m.