Package {aedl}


Type: Package
Title: Almost-Exact Inference for the DerSimonian-Laird Test Statistic
Version: 0.1.0
Description: Implements almost-exact inference for the DerSimonian-Laird test statistic in the normal-normal random-effects meta-analysis model, as described in Hanada and Sugimoto (2023) <doi:10.1007/s10463-022-00844-4>. The method approximates the distribution of the DerSimonian-Laird test statistic by combining the distribution of the untruncated DerSimonian-Laird estimator of the between-study variance with a conditional normal approximation. Methods based on a plug-in between-study variance and a corrected heterogeneity measure are provided.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Imports: stats, withr
Suggests: testthat (≥ 3.0.0), metadat
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-05-19 00:07:18 UTC; keisu
Author: Keisuke Hanada ORCID iD [aut, cre]
Maintainer: Keisuke Hanada <keisuke.hanada.87@gmail.com>
Repository: CRAN
Date/Publication: 2026-05-27 08:40:02 UTC

aedl: Almost-exact inference for the DerSimonian-Laird test statistic

Description

The package implements almost-exact inference for the DerSimonian-Laird test statistic in the normal-normal random-effects meta-analysis model.

Author(s)

Maintainer: Keisuke Hanada keisuke.hanada.87@gmail.com (ORCID)


Almost-exact inference for the DerSimonian-Laird test statistic

Description

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.

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

yi

Numeric vector of study-level effect estimates.

vi

Numeric vector of known within-study variances.

alpha

Significance level. The confidence level is 1 - alpha.

method

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

side

Test side, either 1 or 2.

a, b

Lower and upper bounds of the uniform prior on I^2 used when method = "i2c".

t_grid

Grid for the DerSimonian-Laird test statistic.

nsim

Number of Monte Carlo samples for conditional quantities.

nsim_chi

Number of Monte Carlo samples for the chi-square mixture.

n_tau

Number of grid intervals for the untruncated DL estimator.

I2_grid

Grid for I^2 calculations.

normalize_cdf

Logical; if TRUE, normalize the CDF constructed on the finite numerical grid so that its maximum is one.

seed

Optional random seed. If supplied, it is set for this call.

...

Reserved for future extensions.

Details

For method = "plugin", the distribution of the DL test statistic is constructed using \hat{\tau}_{DL}^2 as the value of \tau^2.

For method = "i2c", the implementation evaluates p(\hat I^2_{\mathrm{obs}} \mid I^2) on I2_grid by taking the row of the simulated conditional distribution corresponding to the observed \hat I^2. It then computes I_c^2 under a uniform prior on ⁠[a, b]⁠ and uses the corresponding \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.

Value

An object of class "aedl" with elements estimate, se, ci.lb, ci.ub, pval, tau2, tau2_for_dist, I2hat, I2c, tau2c, crit, method, and call.

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)

Conditional Monte Carlo quantities for the DL statistic

Description

Conditional Monte Carlo quantities for the DL statistic

Usage

aedl_conditional_moments(zi, x, K, sig2i, tau2)

Density approximation for the untruncated DL tau-squared estimator

Description

Internal helper. This file will contain the chi-square-mixture approximation currently represented by pdf_tau2dl_fast() in the prototype code.

Usage

aedl_density_tau2dl(K, sig2i, tau2, nsim_chi = 1e+05, n_tau = 1000)

Density approximation for the DL test statistic

Description

Internal helper. This file will contain the almost-exact mixture density for the DerSimonian-Laird test statistic.

Usage

aedl_density_tdl(
  t_grid,
  K,
  sig2i,
  tau2,
  theta = 0,
  nsim = 10000,
  nsim_chi = 1e+05,
  n_tau = 1000
)

Corrected heterogeneity measure

Description

Internal helper for method = "i2c". The intended implementation uses the row of pI2sim corresponding to the observed I2hat.

Usage

aedl_i2c(
  I2hat,
  vi,
  sig2t,
  I2_grid = seq(0, 0.99, by = 0.01),
  a = 0,
  b = 1,
  nsim = 10000
)

Simulate p(I2hat | I2)

Description

Simulate p(I2hat | I2)

Usage

aedl_pI2_given_I2(I2, vi, sig2t, I2_grid, nsim = 10000)

Approximate density of the DL test statistic

Description

aedl_stat_density() evaluates the almost-exact density approximation of the DerSimonian-Laird test statistic on a user-supplied grid.

Usage

aedl_stat_density(
  t_grid,
  vi,
  tau2,
  theta = 0,
  nsim = 10000,
  nsim_chi = 1e+05,
  n_tau = 1000
)

Arguments

t_grid

Numeric grid for the DerSimonian-Laird test statistic.

vi

Numeric vector of known within-study variances.

tau2

Non-negative value of the between-study variance.

theta

Mean parameter used in the conditional normal approximation.

nsim

Number of Monte Carlo samples for conditional quantities.

nsim_chi

Number of Monte Carlo samples for the chi-square mixture.

n_tau

Number of grid intervals for the untruncated DL estimator.

Value

A list with grid values x, density values y, and auxiliary quantities used in the approximation.

Examples

vi <- c(0.04, 0.05, 0.03, 0.06)
d_stat <- aedl_stat_density(
  t_grid = seq(-4, 4, by = 0.5),
  vi = vi,
  tau2 = 0.01,
  nsim = 100,
  nsim_chi = 500,
  n_tau = 50
)
str(d_stat[c("x", "y")])

Approximate density of the untruncated DL tau-squared estimator

Description

aedl_tau2_density() evaluates the chi-square-mixture approximation used internally for the untruncated DerSimonian-Laird estimator of the between-study variance.

Usage

aedl_tau2_density(vi, tau2, nsim_chi = 1e+05, n_tau = 1000)

Arguments

vi

Numeric vector of known within-study variances.

tau2

Non-negative value of the between-study variance.

nsim_chi

Number of Monte Carlo samples for the chi-square mixture.

n_tau

Number of grid intervals for the untruncated DL estimator.

Value

A list with grid values x, density values y, and auxiliary quantities used in the approximation.

Examples

vi <- c(0.04, 0.05, 0.03, 0.06)
d_tau <- aedl_tau2_density(
  vi = vi,
  tau2 = 0.01,
  nsim_chi = 500,
  n_tau = 50
)
str(d_tau[c("x", "y")])

Conditional variance of the DL test statistic

Description

Conditional variance of the DL test statistic

Usage

aedl_v2tdls(cov_list, x, sig2i, K)

Confidence interval for an aedl object

Description

Confidence interval for an aedl object

Usage

## S3 method for class 'aedl'
confint(object, parm = NULL, level = NULL, ...)

Arguments

object

An object of class "aedl".

parm

Unused; included for S3 compatibility.

level

Confidence level. Currently must match the level used when fitting object; a different level requires refitting.

...

Unused.

Value

A two-column matrix with confidence limits.


Print an aedl object

Description

Print an aedl object

Usage

## S3 method for class 'aedl'
print(x, digits = max(3, getOption("digits") - 3), ...)

Arguments

x

An object of class "aedl".

digits

Number of significant digits to print.

...

Unused.

Value

Invisibly returns x, the input object of class "aedl".