diff --git a/man/outstandR-package.Rd b/man/outstandR-package.Rd index 1888188..a645b08 100644 --- a/man/outstandR-package.Rd +++ b/man/outstandR-package.Rd @@ -18,7 +18,7 @@ Useful links: } \author{ -\strong{Maintainer}: Nathan Green \email{n.green@ucl.ac.uk} (\href{https://orcid.org/0000-0003-2745-1736}{ORCID}) (02jx3x895) [copyright holder] +\strong{Maintainer}: Nathan Green \email{n.green@ucl.ac.uk} (\href{https://orcid.org/0000-0003-2745-1736}{ORCID}) (\href{https://ror.org/02jx3x895}{ROR}) [copyright holder] Authors: \itemize{ diff --git a/scripts/exercises2.html b/scripts/exercises2.html index 9e84347..85b25dd 100644 --- a/scripts/exercises2.html +++ b/scripts/exercises2.html @@ -315,8 +315,8 @@

Function Arguments


 SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 1).
 Chain 1: 
-Chain 1: Gradient evaluation took 0.000114 seconds
-Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 1.14 seconds.
+Chain 1: Gradient evaluation took 5.3e-05 seconds
+Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.53 seconds.
 Chain 1: Adjust your expectations accordingly!
 Chain 1: 
 Chain 1: 
@@ -327,15 +327,15 @@ 

Function Arguments

Chain 1: Iteration: 1500 / 2000 [ 75%] (Sampling) Chain 1: Iteration: 2000 / 2000 [100%] (Sampling) Chain 1: -Chain 1: Elapsed Time: 0.287 seconds (Warm-up) -Chain 1: 0.293 seconds (Sampling) -Chain 1: 0.58 seconds (Total) +Chain 1: Elapsed Time: 0.223 seconds (Warm-up) +Chain 1: 0.208 seconds (Sampling) +Chain 1: 0.431 seconds (Total) Chain 1: SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 2). Chain 2: -Chain 2: Gradient evaluation took 2.1e-05 seconds -Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.21 seconds. +Chain 2: Gradient evaluation took 1.8e-05 seconds +Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds. Chain 2: Adjust your expectations accordingly! Chain 2: Chain 2: @@ -346,9 +346,9 @@

Function Arguments

Chain 2: Iteration: 1500 / 2000 [ 75%] (Sampling) Chain 2: Iteration: 2000 / 2000 [100%] (Sampling) Chain 2: -Chain 2: Elapsed Time: 0.261 seconds (Warm-up) -Chain 2: 0.246 seconds (Sampling) -Chain 2: 0.507 seconds (Total) +Chain 2: Elapsed Time: 0.216 seconds (Warm-up) +Chain 2: 0.204 seconds (Sampling) +Chain 2: 0.42 seconds (Total) Chain 2:
@@ -369,8 +369,8 @@

Function Arguments


 SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 1).
 Chain 1: 
-Chain 1: Gradient evaluation took 2.6e-05 seconds
-Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.26 seconds.
+Chain 1: Gradient evaluation took 2.4e-05 seconds
+Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.24 seconds.
 Chain 1: Adjust your expectations accordingly!
 Chain 1: 
 Chain 1: 
@@ -387,15 +387,15 @@ 

Function Arguments

Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling) Chain 1: Iteration: 2000 / 2000 [100%] (Sampling) Chain 1: -Chain 1: Elapsed Time: 0.281 seconds (Warm-up) -Chain 1: 0.253 seconds (Sampling) -Chain 1: 0.534 seconds (Total) +Chain 1: Elapsed Time: 0.229 seconds (Warm-up) +Chain 1: 0.21 seconds (Sampling) +Chain 1: 0.439 seconds (Total) Chain 1: SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 2). Chain 2: -Chain 2: Gradient evaluation took 2e-05 seconds -Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds. +Chain 2: Gradient evaluation took 1.6e-05 seconds +Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.16 seconds. Chain 2: Adjust your expectations accordingly! Chain 2: Chain 2: @@ -412,9 +412,9 @@

Function Arguments

Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling) Chain 2: Iteration: 2000 / 2000 [100%] (Sampling) Chain 2: -Chain 2: Elapsed Time: 0.261 seconds (Warm-up) -Chain 2: 0.258 seconds (Sampling) -Chain 2: 0.519 seconds (Total) +Chain 2: Elapsed Time: 0.211 seconds (Warm-up) +Chain 2: 0.216 seconds (Sampling) +Chain 2: 0.427 seconds (Total) Chain 2:
@@ -570,8 +570,8 @@

Function Arguments


 SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 1).
 Chain 1: 
-Chain 1: Gradient evaluation took 2.8e-05 seconds
-Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.28 seconds.
+Chain 1: Gradient evaluation took 2.5e-05 seconds
+Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.25 seconds.
 Chain 1: Adjust your expectations accordingly!
 Chain 1: 
 Chain 1: 
@@ -582,15 +582,15 @@ 

Function Arguments

Chain 1: Iteration: 1500 / 2000 [ 75%] (Sampling) Chain 1: Iteration: 2000 / 2000 [100%] (Sampling) Chain 1: -Chain 1: Elapsed Time: 0.269 seconds (Warm-up) -Chain 1: 0.252 seconds (Sampling) -Chain 1: 0.521 seconds (Total) +Chain 1: Elapsed Time: 0.225 seconds (Warm-up) +Chain 1: 0.205 seconds (Sampling) +Chain 1: 0.43 seconds (Total) Chain 1: SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 2). Chain 2: -Chain 2: Gradient evaluation took 2.2e-05 seconds -Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.22 seconds. +Chain 2: Gradient evaluation took 1.7e-05 seconds +Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.17 seconds. Chain 2: Adjust your expectations accordingly! Chain 2: Chain 2: @@ -601,9 +601,9 @@

Function Arguments

Chain 2: Iteration: 1500 / 2000 [ 75%] (Sampling) Chain 2: Iteration: 2000 / 2000 [100%] (Sampling) Chain 2: -Chain 2: Elapsed Time: 0.278 seconds (Warm-up) -Chain 2: 0.259 seconds (Sampling) -Chain 2: 0.537 seconds (Total) +Chain 2: Elapsed Time: 0.215 seconds (Warm-up) +Chain 2: 0.204 seconds (Sampling) +Chain 2: 0.419 seconds (Total) Chain 2:
@@ -659,8 +659,8 @@

Function Arguments


 SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 1).
 Chain 1: 
-Chain 1: Gradient evaluation took 2.6e-05 seconds
-Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.26 seconds.
+Chain 1: Gradient evaluation took 3.2e-05 seconds
+Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.32 seconds.
 Chain 1: Adjust your expectations accordingly!
 Chain 1: 
 Chain 1: 
@@ -677,15 +677,15 @@ 

Function Arguments

Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling) Chain 1: Iteration: 2000 / 2000 [100%] (Sampling) Chain 1: -Chain 1: Elapsed Time: 0.283 seconds (Warm-up) -Chain 1: 0.254 seconds (Sampling) -Chain 1: 0.537 seconds (Total) +Chain 1: Elapsed Time: 0.227 seconds (Warm-up) +Chain 1: 0.209 seconds (Sampling) +Chain 1: 0.436 seconds (Total) Chain 1: SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 2). Chain 2: -Chain 2: Gradient evaluation took 2.2e-05 seconds -Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.22 seconds. +Chain 2: Gradient evaluation took 1.7e-05 seconds +Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.17 seconds. Chain 2: Adjust your expectations accordingly! Chain 2: Chain 2: @@ -702,9 +702,9 @@

Function Arguments

Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling) Chain 2: Iteration: 2000 / 2000 [100%] (Sampling) Chain 2: -Chain 2: Elapsed Time: 0.259 seconds (Warm-up) -Chain 2: 0.264 seconds (Sampling) -Chain 2: 0.523 seconds (Total) +Chain 2: Elapsed Time: 0.21 seconds (Warm-up) +Chain 2: 0.224 seconds (Sampling) +Chain 2: 0.434 seconds (Total) Chain 2:
@@ -1029,8 +1029,8 @@

Exercises


 SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
 Chain 1: 
-Chain 1: Gradient evaluation took 4.8e-05 seconds
-Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.48 seconds.
+Chain 1: Gradient evaluation took 6.8e-05 seconds
+Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.68 seconds.
 Chain 1: Adjust your expectations accordingly!
 Chain 1: 
 Chain 1: 
@@ -1041,15 +1041,15 @@ 

Exercises

Chain 1: Iteration: 1500 / 2000 [ 75%] (Sampling) Chain 1: Iteration: 2000 / 2000 [100%] (Sampling) Chain 1: -Chain 1: Elapsed Time: 0.09 seconds (Warm-up) -Chain 1: 0.098 seconds (Sampling) -Chain 1: 0.188 seconds (Total) +Chain 1: Elapsed Time: 0.121 seconds (Warm-up) +Chain 1: 0.14 seconds (Sampling) +Chain 1: 0.261 seconds (Total) Chain 1: SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2). Chain 2: -Chain 2: Gradient evaluation took 3.4e-05 seconds -Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.34 seconds. +Chain 2: Gradient evaluation took 2.1e-05 seconds +Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.21 seconds. Chain 2: Adjust your expectations accordingly! Chain 2: Chain 2: @@ -1060,9 +1060,9 @@

Exercises

Chain 2: Iteration: 1500 / 2000 [ 75%] (Sampling) Chain 2: Iteration: 2000 / 2000 [100%] (Sampling) Chain 2: -Chain 2: Elapsed Time: 0.087 seconds (Warm-up) -Chain 2: 0.102 seconds (Sampling) -Chain 2: 0.189 seconds (Total) +Chain 2: Elapsed Time: 0.099 seconds (Warm-up) +Chain 2: 0.14 seconds (Sampling) +Chain 2: 0.239 seconds (Total) Chain 2:
@@ -1102,15 +1102,15 @@

Exercises

Chain 1: Iteration: 1800 / 2000 [ 90%] (Sampling) Chain 1: Iteration: 2000 / 2000 [100%] (Sampling) Chain 1: -Chain 1: Elapsed Time: 0.095 seconds (Warm-up) -Chain 1: 0.096 seconds (Sampling) -Chain 1: 0.191 seconds (Total) +Chain 1: Elapsed Time: 0.115 seconds (Warm-up) +Chain 1: 0.12 seconds (Sampling) +Chain 1: 0.235 seconds (Total) Chain 1: SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2). Chain 2: -Chain 2: Gradient evaluation took 1.2e-05 seconds -Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.12 seconds. +Chain 2: Gradient evaluation took 3.8e-05 seconds +Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.38 seconds. Chain 2: Adjust your expectations accordingly! Chain 2: Chain 2: @@ -1127,9 +1127,9 @@

Exercises

Chain 2: Iteration: 1800 / 2000 [ 90%] (Sampling) Chain 2: Iteration: 2000 / 2000 [100%] (Sampling) Chain 2: -Chain 2: Elapsed Time: 0.097 seconds (Warm-up) -Chain 2: 0.105 seconds (Sampling) -Chain 2: 0.202 seconds (Total) +Chain 2: Elapsed Time: 0.122 seconds (Warm-up) +Chain 2: 0.141 seconds (Sampling) +Chain 2: 0.263 seconds (Total) Chain 2: @@ -1359,15 +1359,15 @@

Exercises

3. Calculate the unadjusted (naive) estimates for comparison.

-

To see exactly how much our PAIC methods moved the needle, we will calculate the naive estimators. Let \(p_A\) and \(p_{C(AC)}\) be the raw probabilities of the event in the IPD trial, and let \(p_B\) and \(p_{C(BC)}\) be the raw probabilities in the ALD trial.

+

To see exactly how much our PAIC methods moved the needle, we will calculate the naive estimators. Let \(p_{A(AC)}\) and \(p_{C(AC)}\) be the raw probabilities of the event in the IPD trial, and let \(p_{B(BC)}\) and \(p_{C(BC)}\) be the raw probabilities in the ALD trial.

-

\[\hat{\Delta}_{AB}^{\text{naive\_anchored}} = (p_A - p_{C(AC)}) - (p_B - p_{C(BC)})\]

+

\[\hat{\Delta}_{AB}^{\text{naive\_anchored}} = (p_{A(AC)} - p_{C(AC)}) - (p_{B(BC)} - p_{C(BC)})\]

-

\[\hat{\Delta}_{AB}^{\text{naive\_unanchored}} = p_A - p_B\]

+

\[\hat{\Delta}_{AB}^{\text{naive\_unanchored}} = p_{A(AC)} - p_{B(BC)}\]

diff --git a/scripts/exercises2.qmd b/scripts/exercises2.qmd index ae3bad7..49dce62 100644 --- a/scripts/exercises2.qmd +++ b/scripts/exercises2.qmd @@ -605,16 +605,16 @@ cat("Unanchored Risk Difference (A vs B):", round(unanchored_rd, 3), "\n") 3.\ Calculate the unadjusted (naive) estimates for comparison. -To see exactly how much our PAIC methods moved the needle, we will calculate the naive estimators. Let $p_A$ and $p_{C(AC)}$ be the raw probabilities of the event in the IPD trial, and let $p_B$ and $p_{C(BC)}$ be the raw probabilities in the ALD trial. +To see exactly how much our PAIC methods moved the needle, we will calculate the naive estimators. Let $p_{A(AC)}$ and $p_{C(AC)}$ be the raw probabilities of the event in the IPD trial, and let $p_{B(BC)}$ and $p_{C(BC)}$ be the raw probabilities in the ALD trial. * **Naive Anchored Risk Difference:** This assumes the relative effect is transportable without adjustment (the classic Bucher indirect comparison). -$$\hat{\Delta}_{AB}^{\text{naive\_anchored}} = (p_A - p_{C(AC)}) - (p_B - p_{C(BC)})$$ +$$\hat{\Delta}_{AB}^{\text{naive\_anchored}} = (p_{A(AC)} - p_{C(AC)}) - (p_{B(BC)} - p_{C(BC)})$$ * **Naive Unanchored Risk Difference:** This drops the common comparator entirely and assumes absolute exchangeability between the two isolated active arms. -$$\hat{\Delta}_{AB}^{\text{naive\_unanchored}} = p_A - p_B$$ +$$\hat{\Delta}_{AB}^{\text{naive\_unanchored}} = p_{A(AC)} - p_{B(BC)}$$ ::: {.callout-warning} diff --git a/scripts/practical_paic.pdf b/scripts/practical_paic.pdf index 67aee73..d516d0f 100644 Binary files a/scripts/practical_paic.pdf and b/scripts/practical_paic.pdf differ