Available as electronic file in AppAnetmetascript.R.
# Full Thrombo example: load data
datanet <- read.csv("DataThromb.csv", header=TRUE, sep=",")
TreatCodes <- read.csv("TreatCodes.csv", header=TRUE, sep=",")
print(TreatCodes)
#
######################################################
# Obtain reduced weights for FE model
######################################################
library(netmeta)
# Gerta Rücker, Guido Schwarzer, Ulrike Krahn and Jochem König (2016).
# netmeta: Network Meta-Analysis using Frequentist Methods. R package
# version 0.9-1. https://CRAN.R-project.org/package=netmeta
p1 <- pairwise(treat=list(t1, t2, t3),
event=list(r1, r2, r3),
n=list(n1,n2,n3),
data=datanet, studlab=study)
print(p1)
# net1 <- netmeta(TE, seTE, treat1,treat2,studlab, data=p1)
print(net1)
# study 1
s1 <- net1$studlab == 1 # choose study 1
net1$seTE[s1] # Unadjusted standard errors
net1$seTE.adj[s1] # Adjusted standard errors
# study 6
s2 <- net1$studlab == 6 # choose study 6
net1$seTE[s2] # Unadjusted standard errors (as given in the data)
net1$seTE.adj[s2] # Adjusted standard errors
#
# DATA FOR WinBUGS: treatment difference and adjusted st. errors
# change sign to be log-OR of treat 2 compared to 1
cbind(t1=c(net1$treat1[s1], net1$treat1[s2]),
t2=c(net1$treat2[s1], net1$treat2[s2]),
y2=c(-net1$TE[s1], -net1$TE[s2]),
se2=c(net1$seTE.adj[s1], net1$seTE.adj[s2]),
study=c(rep(1,3), rep(6,3)))
#
# END
We want to find a half-normal distribution, that is, a Normal(0,m 2) distribution, truncated to take only positive values, which expresses the prior belief that 95% of trials will give odds ratios within a factor of 2 from the estimated median odds ratio. Assuming no treatment effect (without loss of generality), we have
and we want to find m that defines a prior distribution for σ such that the 95% CrI for OR = exp(δ) is approximately (0.5, 2).
Implementing this in WinBUGS gives the following code:
model{
delta ~ dnorm(0,tau)
tau <- pow(sd,-2)
prec <- pow(m,-2)
sd ~ dnorm(0,prec)I(0,)
OR <- exp(delta)
}
Thus, we want to find m
such that the 95% CrI for OR
is approximately (0.5, 2). We can do this simply by experimentation with different values of m
, given as data. When we set m
to 0.32: list(m=0.32)
, we get the following results:
node | mean | sd | MC error | 2.5% | median | 97.5% | start | sample |
OR | 1.051 | 0.4147 | 0.001756 | 0.4924 | 0.9998 | 1.985 | 5001 | 50000 |
delta | –0.002994 | 0.3186 | 0.001378 | –0.7084 | –1.602E–4 | 0.6857 | 5001 | 50000 |
sd | 0.2554 | 0.193 | 8.714E–4 | 0.01026 | 0.2155 | 0.718 | 5001 | 50000 |
which are close enough to the desired values. Thus we chose σ ~ Half- as the prior in the example given in Section 8.4.2 (equation 8.7).
Data inputs required are the coordinates extracted from the Kaplan–Meier (KM) curve: times U j where and corresponding survival probabilities S j for points on the KM curve. These points should include the times at which numbers at risk are reported below the curve, must capture all steps in the curve, and adjustments to the extracted coordinates to ensure the survival probabilities are decreasing with time. The curve is split into intervals, defined by the points where number at risk are reported below the curves, where and give the extracted coordinates corresponding to the lower and upper ends of interval m, respectively. The reported number at risk at the start of interval m is nrisk m . If reported, the total number of events, totevents, is also used by the algorithm.
Here we assume that the number at risk is reported at the start of the study and at least one other time point and that the total number of events is also reported. See Guyot et al. (2012) for adaptations to the algorithm when this is not the case. We assume the number of censored individuals on each interval is not available. We therefore estimate the number of censored individuals on each interval by an iterative process to match the predictions from the inverted KM equations with the reported number at risk at the ends of each interval. We assume that censoring occurs at a constant rate within each of the time intervals, which seems reasonable if the censoring pattern is non-informative (each subject has a censoring time that is statistically independent of their failure time).
The algorithm is made up of the following steps:
An initial guess for the number censored on interval m is the difference between the reported number at risk at the beginning of interval and the number at risk under no censoring:
Rearranging gives
rounded to the nearest integer.
The number of patients at risk at each extracted coordinate, j, is then obtained:
where at the start of the interval we set . This produces an estimated number at risk at the start of the following interval .
The algorithm described here is based on the method used by Jansen and Cope (2012) to create interval data. The available follow-up time period for each arm of each trial is divided in w sequential short time intervals with u 1 = 0. For each time interval , the conditional survival probability is calculated based on the scanned survival proportions according to . If there is no survival proportion available for a specific time point, a corresponding estimate for S(u m ) can be obtained by linear interpolation of the first available extracted scanned survival proportions before and after this time point.
Given the reported numbers at risk n m at the beginning of the mth interval and the event probability for that interval, the actual number of events r m for each interval will be calculated. As such, it is desirable to have the time intervals defined in such a way that (some) time points u m are aligned with the time point for which the size of the at-risk population is reported below the published KM curve.
When the population at risk at the beginning of the mth interval is not reported below the KM curve, it can be imputed. First, based on the reported size of the at-risk population at subsequent time points, n m will be estimated according to
With this ‘backward calculation’ approach, we implicitly assume that censoring occurs before the events happen within a time interval. However, this approach is not feasible if there is no information regarding the at-risk population for time intervals, beyond the at-risk population reported at a certain time point. In other words, this approach is only feasibly for intervals up to the latest time point for which an at-risk population is reported. Next, n m will be estimated according to
The disadvantage of this ‘forward calculation’ approach is that censoring is ignored and the sample size potentially too large for those intervals. For intervals where both and were calculated, the actual estimate for the population at risk is calculated as to ensure the sample size at the beginning of each interval is not overestimated. For intervals where could not be calculated, .
The number of events for each interval is calculated according to
The time intervals do not have to have the same length. In general, the shorter the intervals, the more variation in the hazard function will be picked up, but if the intervals are too short, the number of events will be zero for many subsequent intervals, potentially compromising estimation.
Obviously, the dataset created with the Guyot IPD algorithm can also be used to create interval data, that is, n m and r m for the mth interval.
18.118.120.206