setup: Transforming arm-level data to contrast-based summary...

View source: R/setup.r

setupR Documentation

Transforming arm-level data to contrast-based summary statistics and making objects for network meta-analysis

Description

A setup function to generate R objects that may be used for network meta-analysis. Users should prepare arm-level datasets, and the setup function transforms the arm-level data to the contrast-based summary statistics. The type of outcome variable can be specified by the measure. If the measure is specified as OR, RR or RD, the outcome ought to be dichotomous, and d and n are needed to compute the summary statistics. Besides, if the measure is specified as MD or SMD, the outcome ought to be continuous, and m, s and n are needed to compute the summary statistics. Also, if the measure is specified as HR or SPD, the outcome ought to be survival (time-to-event), and d and n (actual or pseudo-data for the event numbers and sample sizes calculated by trans.armdata or trans.armdataP ) are needed to compute the summary statistics; hazard ratios are estimated by the complementary log-log-type estimator. Several covariates can be involved as z for network meta-regression analysis (nmareg) and transitivity analysis (transitivity).

Usage

setup(study,trt,d,n,m,s,z,measure,ref,data)

Arguments

study

Study ID

trt

Treatment variable. It can be formed as both of numbered treatment (=1,2,...) and characters (e.g., "Placebo", "ARB", "Beta blocker").

d

Number of events (for dichotomous outcome and survival outcome).

n

Sample size.

m

Mean of the outcome variable (for continuous outcome).

s

Standard deviation of the outcome variable (for continuous outcome).

z

Covariate name vector to be used for network meta-regression analysis or transitivity analysis (optional).

measure

Outcome measure (can be OR (odds ratio), RR (risk ratio), and RD (risk difference) for dichotomous outcome, MD (mean difference) and SMD (standardized mean difference) for continuous outcome, and HR (hazard ratio) and SPD (survival probability difference) for survival outcome.

ref

Reference treatment category that ought to be involved in trt.

data

A data frame that involves the arm-based data.

Value

Contrast-based summary statistics are generated.

  • coding: A table that presents the correspondence between the numerical code and treatment categories (the reference category is coded as 1).

  • reference: Reference treatment category.

  • measure: Outcome measure.

  • covariate: Covariate name(s).

  • N: The number of study.

  • p: The dimension of the contrast-based statistics.

  • df: The degree of freedom.

  • study: The ID variable that specifies studies.

  • trt: The original vector that specifies treatment categories.

  • treat: A numerical vector that specifies treatment categories based on the coding table.

  • d: The original vector that specifies number of events.

  • n: The original vector that specifies sample sizes.

  • m: The original vector that specifies means.

  • s: The original vector that specifies standard deviations.

  • Z: The data frame that specifies covariates matrix (design matrix).

  • y: Contrast-based summary estimates.

  • S: Vectored within-study covariance matrix.

References

Noma, H. (2024b). Within-study covariance estimators for network meta-analysis with contrast-based approach. Japanese Journal of Biometrics 44, 119-126.

Noma, H. and Maruo, K. (2025). Network meta-analysis combining survival and count outcome data: A simple frequentist approach. medRxiv, \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1101/2025.01.23.25321051")}.

Examples

data(heartfailure)

hf2 <- setup(study=study,trt=trt,d=d,n=n,measure="OR",ref="Placebo",data=heartfailure)
hf3 <- setup(study=study,trt=trt,d=d,n=n,measure="RR",ref="Placebo",data=heartfailure)
hf4 <- setup(study=study,trt=trt,d=d,n=n,measure="RD",ref="Placebo",data=heartfailure)

hf5 <- setup(study=study,trt=trt,d=d,n=n,z=c(SBP,DBP,pubyear),measure="OR",
ref="Placebo",data=heartfailure)


data(antidiabetic)

ad2 <- setup(study=id,trt=t,m=y,s=sd,n=n,measure="MD",ref="Placebo",data=antidiabetic)
ad3 <- setup(study=id,trt=t,m=y,s=sd,n=n,measure="SMD",ref="Placebo",data=antidiabetic)


data(woods1)
data(woods2)
woods3 <- trans.armdata(study=studlab,treat1=treat1,treat2=treat2,n1=n1,n2=n2,
y=TE,SE=seTE,measure="logHR",data=woods1)
# Creating pseudo-dichotomized data that is equivalent to the hazard ratio data.
# Using the setup function, the hazard ratio estimates are reproduced.

woods4 <- rbind(woods2,woods3)
# If some studies did not report hazard ratio estimates and only reported event numbers,
# the survival and dichotomized outcomes can be combined using this method.

wd4 <- setup(study=study,trt=trt,d=d,n=n,measure="HR",ref="Placebo",data=woods4)


data(exdataP)
woods5 <- trans.armdataP(study=study,treat=trt,y=y,SE=se,data=exdataP)

wd5 <- setup(study=study,trt=trt,d=d,n=n,measure="SPD",ref="Placebo",data=woods5)

NMA documentation built on Nov. 5, 2025, 7:15 p.m.