vcov: Calculate Posterior Variance-Covariance Matrix for a Bayesian...

vcovR Documentation

Calculate Posterior Variance-Covariance Matrix for a Bayesian Fitted Model Object

Description

Returns the posterior covariance matrix of the main parameters of a fitted bayesics object

Usage

## S3 method for class 'aov_b'
vcov(object, ...)

## S3 method for class 'lm_b'
vcov(object, ...)

## S3 method for class 'glm_b'
vcov(object, ...)

## S3 method for class 'np_glm_b'
vcov(object, ...)

Arguments

object

a fitted model object from bayesics.

...

Passed to methods.

Value

A matrix of the covariance matrix for the regression coefficients. If the posterior is a multivariate t distribution (or consists of independent t's in the case of heteroscedastic 1-way ANOVA), the degrees of freedom are returned as the df attribute of the matrix. Note that for lm_b and aov_b objects, this function already takes into account the uncertainty around the residual variance.

Examples


set.seed(2025)
N = 500
test_data <-
  data.frame(x1 = rnorm(N),
             x2 = rnorm(N),
             x3 = letters[1:5])
test_data$outcome <-
  rnorm(N,-1 + test_data$x1 + 2 * (test_data$x3 %in% c("d","e")) )
fit1 <-
  lm_b(outcome ~ x1 + x2 + x3,
       data = test_data)
vcov(fit1)



bayesics documentation built on March 11, 2026, 5:07 p.m.

Related to vcov in bayesics...