hatmatrix: Derive hat matrix from network meta-analysis

View source: R/hatmatrix.R

hatmatrixR Documentation

Derive hat matrix from network meta-analysis

Description

Auxiliary function to derive hat matrix from network meta-analysis

Usage

hatmatrix(
  x,
  method = "Ruecker",
  type,
  common = x$common,
  random = x$random,
  nchar.trts = x$nchar.trts,
  nchar.studlab = x$nchar.studlab
)

## S3 method for class 'hatmatrix'
print(
  x,
  common = x$x$common,
  random = x$x$random,
  nchar.trts = x$x$nchar.trts,
  nchar.studlab = x$x$nchar.studlab,
  digits = gs("digits"),
  legend = TRUE,
  legend.studlab = TRUE,
  ...
)

Arguments

x

A netmeta object.

method

A character string indicating which method is used to derive the hat matrix. Either "Ruecker", "Krahn" or "Davies" (can be abbreviated, see Details).

type

A character string indicating which specific hat matrix should be derived (can be abbreviated, see Details).

common

A logical indicating whether a hat matrix should be printed for the common effects network meta-analysis.

random

A logical indicating whether a hat matrix should be printed for the random effects network meta-analysis.

nchar.trts

A numeric defining the minimum number of characters used to create unique treatment names.

nchar.studlab

A numeric defining the minimum number of characters used to create unique study labels.

digits

Minimal number of significant digits, see print.default.

legend

A logical indicating whether a legend should be printed.

legend.studlab

A logical indicating whether a legend should be printed for abbreviated study labels.

...

Additional arguments (ignored).

Details

This auxiliary function can be used to derive various hat matrices from a network meta-analysis object.

Hat matrix by Rücker (2012)

This hat matrix is estimated if method = "Ruecker".

Let n be the number of different treatments (nodes, vertices) in a network and let m be the number of existing comparisons (edges) between the treatments. If there are only two-arm studies, m is equal to the number of studies, k. Let seTE.adj.common and seTE.adj.random be the vectors of adjusted standard errors under the common and random effects model (see netmeta). Let W be the m x m diagonal matrix that contains the inverse variance 1 / seTE.adj.common^2 or 1 / seTE.adj.random^2.

The given comparisons define the network structure. Therefrom an m x n design matrix X (edge-vertex incidence matrix) is formed; for more precise information, see Rücker (2012). Moreover, the n x n Laplacian matrix L and its Moore-Penrose pseudoinverse L^+ are calculated (both matrices play an important role in graph theory and electrical network theory). Using these matrices, the variances based on both direct and indirect comparisons can be estimated. The hat matrix H is estimated by H = XL^+X^TW = X(X^TW X)^+X^TW.

Hat matrices by Krahn et al. (2013)

One of the following hat matrices is estimated if method = "Krahn".

Use of type = "design" (default) results in a hat matrix of dimension n(n-1)/2 x s, where s is the sum of the number of independent comparisons from each design.

Use of type = "studies" results in a hat matrix of dimension n(n-1)/2 x l, where l is the number of independent pairwise comparisons, i.e., a three-arm study contributes two pairwise comparisons.

Hat matrices by Davies et al. (2022)

One of three hat matrices is estimated if method = "Davies".

Here, we focus on the hat matrix of the aggregate (two-step) version of the graph theoretical NMA model. In the first step, a pairwise meta-analysis is performed across each edge using the adjusted weights (these account for correlations due to multi-arm trials). From this we obtain direct treatment effect estimates (and corresponding aggregate weights) associated with each edge. In step two, we combine these direct estimates in a network meta analysis to obtain the network estimates. This is done using weighted least squares regression. The hat matrix associated with this second step is called the aggregate hat matrix.

All three versions of the aggregate hat matrix contain the same information: the second two can be derived directly from the first. They differ in their dimensionality.

Each row of the hat matrix that represents a treatment comparison (ij) describes the flow of evidence through each edge for that comparison. This defines a directed acyclic 'flow graph' from node i to node j.

(1) Use of type = "short" (default) results in a hat matrix of dimension e x e, where e is the number of (unique) edges (direct comparisons) in the network. This is the aggregate hat matrix described in Davies et al. (2022). Each row and column represents a pair of treatments for which there is at least one direct comparison.

(2) Use of type = "long" results in a hat matrix of dimension n(n-1)/2 x e. There is a row for every possible pair of treatments in the network - regardless of whether there is direct evidence for this comparison. Each column represents a pair of treatments for which there is at least one direct comparison. The extra rows can be calculated from the short hat matrix using consistency equations.

(3) Use of type = "full" results in a hat matrix of dimension n(n-1)/2 x n(n-1)/2. In comparison to the long hat matrix, columns of zeroes are added for comparisons that do not have any direct evidence. Therefore, there is a row and column for every pair of treatments in the network. This hat matrix is used to calculate the transition matrices for the random walk in netcontrib.

Value

A list with two hat matrices: common (common effects model) and random (random effects model).

Author(s)

Guido Schwarzer guido.schwarzer@uniklinik-freiburg.de

References

Davies AL, Papakonstantinou T, Nikolakopoulou A, Rücker G, Galla T (2022): Network meta-analysis and random walks. Statistics in Medicine, 41, 2091–2114

Krahn U, Binder H, König J (2013): A graphical tool for locating inconsistency in network meta-analyses. BMC Medical Research Methodology, 13, 35

Rücker G (2012): Network meta-analysis, electrical networks and graph theory. Research Synthesis Methods, 3, 312–24

See Also

netmeta, netcontrib, netheat

Examples

data(Dong2013)
# Only consider first ten studies for concise output
first10 <- subset(Dong2013, id <= 10)
p1 <- pairwise(treatment, death, randomized, studlab = id,
  data = first10, sm = "OR")
net1 <- netmeta(p1, common = FALSE)

hatmatrix(net1)
hatmatrix(net1, method = "k")
hatmatrix(net1, method = "k", type = "studies")
hatmatrix(net1, method = "d")
hatmatrix(net1, method = "d", type = "long")
hatmatrix(net1, method = "d", type = "full")


netmeta documentation built on June 23, 2024, 9:06 a.m.