Skip to content

Commit 45a6d88

Browse files
committed
Make left-truncation example cleaner
1 parent 1737006 commit 45a6d88

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/ppc-censoring.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@
5959
#' ppc_km_overlay_grouped(y, yrep[1:25, ], group = group, status_y = status_y)
6060
#' }
6161
#' # With left-truncation (delayed entry) times:
62-
#' left_truncation_y <- runif(length(y), min = 0, max = 0.6) * y
62+
#' condition <- y > mean(y) / 2
63+
#' left_truncation_y[condition] <- pmin(
64+
#' runif(sum(condition), min = 0.6, max = 0.99) * y[condition],
65+
#' min_vals[condition] - 0.001
66+
#' )
6367
#' \donttest{
6468
#' ppc_km_overlay(y, yrep[1:25, ], status_y = status_y,
6569
#' left_truncation_y = left_truncation_y)

0 commit comments

Comments
 (0)