% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vif.R
\name{vif.brma}
\alias{vif.brma}
\title{Variance Inflation Factors for brma Objects}
\usage{
\method{vif}{brma}(object, posterior_correlation = TRUE, ...)
}
\arguments{
\item{object}{a fitted brma object with moderators}

\item{posterior_correlation}{logical; whether to also compute and return
the posterior correlation matrix of regression coefficients. Defaults
to \code{TRUE}.}

\item{...}{additional arguments (currently ignored)}
}
\value{
An object of class \code{vif.brma} containing:
\item{vif}{A data frame with columns \code{term}, \code{df}, \code{GVIF},
and \code{GVIF^(1/(2*df))} (= \eqn{GVIF^{1/(2 \cdot df)}}). For single-df
terms, GVIF equals the standard VIF.}
\item{posterior_correlation}{A correlation matrix of posterior regression
coefficient samples when requested and available; otherwise \code{NULL}.}
}
\description{
Computes variance inflation factors (VIF) and generalized
VIF (GVIF) for a fitted brma meta-regression model. Also optionally
returns the posterior correlation matrix of regression coefficients.
}
\details{
VIF is computed from the correlation matrix derived from the
coefficient variance-covariance matrix \eqn{(X'WX)^{-1}}. For standard
meta-regression models, \eqn{W = \mathrm{diag}(w_i/(v_i + \hat\tau^2))}
with \eqn{\hat\tau} equal to the posterior mean heterogeneity. For scale
and multilevel models, the coefficient covariance is averaged across
posterior heterogeneity draws, using observation-specific \eqn{\tau_i}
and block-structured multilevel covariance where applicable.

A VIF of 1 indicates no collinearity; values above 5 or 10 are
commonly considered problematic.

For multi-column terms, such as factor contrasts,
the Generalized VIF (GVIF) of \insertCite{fox1992generalized;textual}{RoBMA}
is reported. GVIF captures the joint inflation for all coefficients
belonging to the same term. To enable comparison across terms with different
degrees of freedom, \eqn{GVIF^{1/(2 \cdot df)}} is also reported; this
value can be compared against the usual VIF thresholds (after squaring).

When \code{posterior_correlation = TRUE}, the function also returns the
posterior correlation matrix of the regression coefficients. This
Bayesian diagnostic complements VIF: while VIF diagnoses the
\emph{potential} for collinearity problems (a data property), the
posterior correlation shows the \emph{realized} identification
given the data and priors. Informative priors can mitigate
collinearity, reducing posterior correlations even when VIF is high.
}
\examples{
\dontrun{
if (requireNamespace("metadat", quietly = TRUE) &&
    requireNamespace("metafor", quietly = TRUE)) {
  data(dat.bcg, package = "metadat")
  dat <- metafor::escalc(
    measure = "RR",
    ai      = tpos,
    bi      = tneg,
    ci      = cpos,
    di      = cneg,
    data    = dat.bcg
  )
  fit <- brma(
    yi      = yi,
    vi      = vi,
    mods    = ~ ablat + year,
    data    = dat,
    measure = "RR",
    seed    = 1,
    silent  = TRUE
  )

  vif(fit)
}
}

}
\references{
\insertAllCited{}
}
\seealso{
\code{\link[=regplot]{regplot()}}, \code{\link[=summary.brma]{summary.brma()}}
}
