% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/aedl.R
\name{aedl}
\alias{aedl}
\title{Almost-exact inference for the DerSimonian-Laird test statistic}
\usage{
aedl(
  yi,
  vi,
  alpha = 0.05,
  method = c("plugin", "i2c"),
  side = 2,
  a = 0,
  b = 1,
  t_grid = seq(-20, 20, by = 0.01),
  nsim = 10000,
  nsim_chi = 1e+05,
  n_tau = 1000,
  I2_grid = seq(0, 0.99, by = 0.01),
  normalize_cdf = TRUE,
  seed = NULL,
  ...
)
}
\arguments{
\item{yi}{Numeric vector of study-level effect estimates.}

\item{vi}{Numeric vector of known within-study variances.}

\item{alpha}{Significance level. The confidence level is \code{1 - alpha}.}

\item{method}{Method used to choose the heterogeneity value for constructing
the almost-exact distribution. \code{"plugin"} corresponds to \code{exactDL} in the
supplemental program of Hanada and Sugimoto (2023) and uses the DerSimonian-Laird
estimate \eqn{\hat{\tau}_{DL}^2}. \code{"i2c"} uses a corrected heterogeneity
measure \eqn{I_c^2}.}

\item{side}{Test side, either \code{1} or \code{2}.}

\item{a, b}{Lower and upper bounds of the uniform prior on \code{I^2} used when
\code{method = "i2c"}.}

\item{t_grid}{Grid for the DerSimonian-Laird test statistic.}

\item{nsim}{Number of Monte Carlo samples for conditional quantities.}

\item{nsim_chi}{Number of Monte Carlo samples for the chi-square mixture.}

\item{n_tau}{Number of grid intervals for the untruncated DL estimator.}

\item{I2_grid}{Grid for \code{I^2} calculations.}

\item{normalize_cdf}{Logical; if \code{TRUE}, normalize the CDF constructed on
the finite numerical grid so that its maximum is one.}

\item{seed}{Optional random seed. If supplied, it is set for this call.}

\item{...}{Reserved for future extensions.}
}
\value{
An object of class \code{"aedl"} with elements \code{estimate}, \code{se},
\code{ci.lb}, \code{ci.ub}, \code{pval}, \code{tau2}, \code{tau2_for_dist}, \code{I2hat}, \code{I2c},
\code{tau2c}, \code{crit}, \code{method}, and \code{call}.
}
\description{
\code{aedl()} computes a DerSimonian-Laird point estimate and performs
almost-exact inference for the DerSimonian-Laird test statistic in the
normal-normal random-effects meta-analysis model.
}
\details{
For \code{method = "plugin"}, the distribution of the DL test statistic is
constructed using \eqn{\hat{\tau}_{DL}^2} as the value of \eqn{\tau^2}.

For \code{method = "i2c"}, the implementation evaluates
\eqn{p(\hat I^2_{\mathrm{obs}} \mid I^2)} on \code{I2_grid} by taking the row of
the simulated conditional distribution corresponding to the observed
\eqn{\hat I^2}. It then computes \eqn{I_c^2} under a uniform prior on
\verb{[a, b]} and uses the corresponding \eqn{\tau_c^2} to construct the
almost-exact distribution.

The numerical implementation is a streamlined version of the computational
procedure shown in the supplemental material of Hanada and Sugimoto (2023). It has been
checked against the original supplemental program in development scripts.
}
\examples{
yi <- c(0.10, 0.25, 0.05, 0.30)
vi <- c(0.04, 0.05, 0.03, 0.06)
res <- aedl(
  yi, vi,
  t_grid = seq(-6, 6, by = 0.2),
  nsim = 100,
  nsim_chi = 500,
  n_tau = 50,
  seed = 1
)
res
confint(res)
}
