## Example 1 - positive correlation
i <- 1764002323
set.seed(i)
PADY <- 2
D <- simTTE(n = 1000, TTE_A = c(0.1, 0.04),
TTE_P = c(.15, 0.045), theta = 4, alpha0 = 2, alpha = -1, shape = 2,
fixedfy = PADY, rHR = 1)
####### Summary of first events by treatment group ########
table(D$EVENT1, D$TRTP)
####### Summary of second events by treatment group ########
table(D$EVENT2, D$TRTP)
######## Calculate win odds #########################
calcWO(D, ref = "P")
## Plot the ordinal dominance graph ######
D$TRTP <- factor(D$TRTP, levels = c("P", "A"))
plot(D, type = "l", col = 2, fill = TRUE)
abline(a = 0, b = 1, lwd = 2, lty = 3, col = "darkgreen")
grid()
################################################################
## Example 2 - Move-down approach (discrete‑time case only)
PADY <- 2
# Continuous-time
set.seed(2)
D <- simTTE(n = 1000, TTE_A = c(0.1, 0.04),
TTE_P = c(.15, 0.045), theta = 4, alpha0 = 2, alpha = -1, shape = 2,
fixedfy = PADY, rHR = 1, m = Inf)
summaryWO(D, ref = "P")$summary_by_GROUP
# Discrete-time (more-ties)
D0 <- simTTE(n = 1000, TTE_A = c(0.1, 0.04),
TTE_P = c(.15, 0.045), theta = 4, alpha0 = 2, alpha = -1, shape = 2,
fixedfy = PADY, rHR = 1, m = 5)
summaryWO(D0, ref = "P")$summary_by_GROUP
# Discrete-time and move-down approach (less ties on death)
D1 <- simTTE(n = 1000, TTE_A = c(0.1, 0.04),
TTE_P = c(.15, 0.045), theta = 4, alpha0 = 2, alpha = -1, shape = 2,
fixedfy = PADY, rHR = 1, m = 5, hce_type = "md")
summaryWO(D1, ref = "P")$summary_by_GROUP
Run the code above in your browser using DataLab