% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/residuals.R
\name{rstandard.brma}
\alias{rstandard.brma}
\title{Internally Standardized Residuals for brma Objects}
\usage{
\method{rstandard}{brma}(model, unit = "estimate", conditioning_depth = "marginal", ...)
}
\arguments{
\item{model}{a fitted brma object.}

\item{unit}{output unit. Only \code{"estimate"} is implemented currently.}

\item{conditioning_depth}{conditioning depth. Options are:
\itemize{
\item \code{"marginal"} (default): Residuals from fixed effects predictions
(\eqn{observed - X\beta}).
\item \code{"cluster"}: Residuals from cluster-level predictions (observed -
(\eqn{X\beta + gamma})). Only available for multilevel (3-level) models.
\item \code{"estimate"}: Residuals from BLUPs,
i.e., deviations of the observed effect sizes from the best linear
unbiased predictions of the estimate-specific true effects (observed - theta).
}}

\item{...}{additional arguments (currently ignored)}
}
\value{
A data frame with columns:
\itemize{
\item \code{resid}: Raw residuals
\item \code{se}: Standard errors of the residuals
\item \code{z}: Standardized residuals
}
}
\description{
Computes internally standardized residuals from a fitted brma
object using the hat matrix. Returns a data frame with raw residuals,
standard errors, and standardized residuals (z-values). Available for normal
outcome models only.
}
\details{
This function returns a data frame with three columns matching the output
of \code{metafor::rstandard}:
\itemize{
\item \code{resid}: Raw residuals (observed - fitted values)
\item \code{se}: Standard errors of the residuals
\item \code{z}: Standardized residuals (resid / se)
}

Internally standardized residuals divide the observed residuals by their
corresponding standard errors computed using the hat matrix. For a correctly
specified model, these residuals should approximately follow a standard
normal distribution.

This function is only available for normal outcome models without selection
(weightfunction) bias adjustment. For other model types, use
\code{\link{rstudent.brma}} which uses LOO-PIT.
}
\examples{
\dontrun{
if (requireNamespace("metadat", quietly = TRUE)) {
  data(dat.lehmann2018, package = "metadat")
  fit <- brma(yi = yi, vi = vi, data = dat.lehmann2018, measure = "SMD")

  # marginal internally standardized residuals (default)
  rstandard(fit)

  # estimate-level (BLUP-based) residuals
  rstandard(fit, conditioning_depth = "estimate")
}
}

}
\seealso{
\code{\link[=rstudent.brma]{rstudent.brma()}}, \code{\link[=residuals.brma]{residuals.brma()}}, \code{\link[=blup.brma]{blup.brma()}}, \code{\link[=predict.brma]{predict.brma()}}
}
