% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dfbetas.R
\name{dfbetas.brma}
\alias{dfbetas.brma}
\title{DFBETAS for brma Objects}
\usage{
\method{dfbetas}{brma}(
  model,
  type = "mods",
  standardized_coefficients = FALSE,
  transform_factors = TRUE,
  return_loo_estimates = FALSE,
  ...
)
}
\arguments{
\item{model}{a fitted brma object.}

\item{type}{type of parameters to be summarized. Defaults to \code{"mods"}
(for the effect size and meta-regression coefficients). The other options are
\code{"scale"} (for the heterogeneity and scale-regression coefficients) and
\code{"bias"} (for omega, PET, and PEESE publication-bias parameters).}

\item{standardized_coefficients}{whether to show standardized meta-regression coefficients.
Defaults to \code{FALSE}. When set to \code{TRUE}, standardized meta-regression
coefficients are returned for the intercept and continuous predictors. These coefficients
correspond to the standardized scale on which prior distributions are specified by default
(i.e., \code{standardize_continuous_predictors = TRUE}).}

\item{transform_factors}{whether to transform factors to their original names.
Defaults to \code{TRUE}.}

\item{return_loo_estimates}{whether to return the leave-one-out coefficient
estimates used to compute DFBETAS instead of standardized DFBETAS values.
Defaults to \code{FALSE}.}

\item{...}{additional arguments (currently ignored).}
}
\value{
If \code{return_loo_estimates = FALSE}, a data frame with \eqn{K} rows
(observations) and \eqn{P} columns (parameters), containing DFBETAS values.
If \code{return_loo_estimates = TRUE}, returns the corresponding leave-one-out
coefficient estimates. Row names correspond to study labels (if available)
or indices.
}
\description{
Computes DFBETAS (Difference in BETAS, standardized) for a
fitted brma object. DFBETAS measures the influence of each observation on
the estimated model coefficients. Positive values indicate that deleting the
observation yields a smaller estimate, negative values indicate that deleting
the observation yields a larger estimate.
}
\details{
This function computes DFBETAS values using the Leave-One-Out (LOO)
approximation based on Pareto Smoothed Importance Sampling (PSIS) weights.
Ideally, DFBETAS is defined as:
\deqn{DFBETAS_{ij} = \frac{\hat{\beta}_j - \hat{\beta}_{j(-i)}}{SE(\hat{\beta}_{j(-i)})}}
where \eqn{\hat{\beta}_j} is the estimate of the \eqn{j}-th coefficient using
the full data, \eqn{\hat{\beta}_{j(-i)}} is the estimate when observation \eqn{i}
is omitted, and \eqn{SE(\hat{\beta}_{j(-i)})} is the standard error of the
coefficient when observation \eqn{i} is omitted.

In the Bayesian context using LOO approximation:
\itemize{
\item \eqn{\hat{\beta}_{j(-i)}} is estimated as the importance sampling
weighted mean of the posterior samples, using PSIS weights \eqn{w_{is}}.
\item \eqn{SE(\hat{\beta}_{j(-i)})} is estimated as the importance sampling
weighted standard deviation of the posterior samples.
}

This approximation allows computing influence statistics without refitting
the model \eqn{K} times, making it computationally efficient.
For \code{type = "bias"}, fixed identification parameters (e.g., the reference
\eqn{\omega = 1} interval) can have zero LOO posterior standard deviation.
These parameters are retained in the output, but their DFBETAS values are
reported as \code{NaN} because the standardized diagnostic is undefined.

Note: This function requires that LOO-CV has been computed for the model
using \code{\link{add_loo}}.
}
\examples{
\dontrun{
if (requireNamespace("metadat", quietly = TRUE)) {
  data(dat.lehmann2018, package = "metadat")
  fit <- bPET(yi = yi, vi = vi, data = dat.lehmann2018, measure = "SMD")
  fit <- add_loo(fit)

  inf <- dfbetas(fit)
  plot(inf[, 1], type = "h")
}
}

}
\seealso{
\code{\link{add_loo}}, \code{\link{loo_weights.brma}}
}
