File size: 3,351 Bytes
026774a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# TSA Algorithms Reference

## Overview

Trial Sequential Analysis (TSA) applies sequential monitoring boundaries to cumulative meta-analysis, controlling for repeated significance testing as evidence accumulates.

## Core Algorithm: Z-Curve Calculation

### Step 1: Calculate Cumulative Effect

For each study k added to the meta-analysis:

```
Z_k = θ_k / SE_k
```

Where:
- θ_k = pooled effect estimate after k studies
- SE_k = standard error of pooled estimate

### Step 2: Information Fraction

```
t_k = V_k / V_OIS
```

Where:
- V_k = cumulative information (sum of inverse variances)
- V_OIS = required information size

### Step 3: Boundary Calculation

Using alpha-spending function a(t):

```
Z_upper(t) = Φ^(-1)(1 - a(t)/2)
Z_lower(t) = -Z_upper(t)  [for symmetrical boundaries]
```

## Optimal Information Size (OIS)

### Dichotomous Outcomes

```
OIS = 4 * (Z_α + Z_β)² * p̄(1-p̄) / (p_C - p_I)²
```

Where:
- Z_α = critical value for type I error
- Z_β = critical value for type II error
- p̄ = average of control and intervention rates
- p_C = expected control event rate
- p_I = expected intervention event rate

### Heterogeneity Adjustment

```
OIS_adjusted = OIS / (1 - I²/100)
```

## Effect Size Calculations

### Odds Ratio (OR)

```
log(OR) = log(a*d / b*c)
SE(log(OR)) = √(1/a + 1/b + 1/c + 1/d)
```

### Relative Risk (RR)

```
log(RR) = log((a/(a+c)) / (b/(b+d)))
SE(log(RR)) = √(c/(a(a+c)) + d/(b(b+d)))
```

### Risk Difference (RD)

```
RD = a/(a+c) - b/(b+d)
SE(RD) = √(ac/(a+c)³ + bd/(b+d)³)
```

## Pooling Methods

### Fixed Effect (Inverse Variance)

```
θ_pooled = Σ(w_i * θ_i) / Σw_i
SE_pooled = √(1 / Σw_i)

where w_i = 1/SE_i²
```

### Random Effects (DerSimonian-Laird)

```
τ² = max(0, (Q - df) / (Σw_i - Σw_i²/Σw_i))
w_i* = 1/(SE_i² + τ²)

θ_pooled = Σ(w_i* * θ_i) / Σw_i*
```

## Heterogeneity Statistics

### Q Statistic

```
Q = Σw_i(θ_i - θ_pooled)²
```

### I-squared

```
I² = max(0, (Q - df) / Q * 100%)
```

### Tau-squared (τ²)

Between-study variance estimated via:
- DerSimonian-Laird: Method of moments
- REML: Restricted maximum likelihood
- Sidik-Jonkman: Alternative estimator

## Lan-DeMets Alpha Spending

### Implementation

The Lan-DeMets method approximates group sequential boundaries through:

1. Divide [0,1] into small increments
2. At each t: calculate cumulative alpha spent
3. Find Z-boundary that produces exact alpha spent

```java
// Simplified algorithm from LanDeMetsCalculus.java
for (int i = 1; i <= maxIterations; i++) {
    t = i / maxIterations;
    alpha_spent = spendingFunction(t, alpha);
    z_boundary[i] = findBoundary(alpha_spent, previous_boundaries);
}
```

## Boundary Interpolation

For arbitrary information fractions, interpolate between calculated points:

```
Z(t) = Z(t_lower) + (Z(t_upper) - Z(t_lower)) * (t - t_lower) / (t_upper - t_lower)
```

## References

1. Lan GKK, DeMets DL (1983). Discrete sequential boundaries for clinical trials. Biometrika.
2. O'Brien PC, Fleming TR (1979). A multiple testing procedure for clinical trials. Biometrics.
3. Pocock SJ (1977). Group sequential methods in the design and analysis of clinical trials. Biometrika.
4. Wetterslev J, et al. (2008). Trial sequential analysis may establish when firm evidence is reached in cumulative meta-analysis. J Clin Epidemiol.