File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,8 @@ ppc_km_overlay <- function(
88
88
status_y ,
89
89
left_truncation_y = NULL ,
90
90
size = 0.25 ,
91
- alpha = 0.7
91
+ alpha = 0.7 ,
92
+ extrapolation_factor = 1.2
92
93
) {
93
94
check_ignored_arguments(... , ok_args = " add_group" )
94
95
add_group <- list (... )$ add_group
@@ -106,6 +107,10 @@ ppc_km_overlay <- function(
106
107
}
107
108
}
108
109
110
+ if (extrapolation_factor < 1 ) {
111
+ stop(" `extrapolation_factor` must be greater than or equal to 1." )
112
+ }
113
+
109
114
data <- ppc_data(y , yrep , group = status_y )
110
115
111
116
# Modify the status indicator:
@@ -149,6 +154,10 @@ ppc_km_overlay <- function(
149
154
fsf $ is_y_size <- ifelse(fsf $ is_y_color == " yrep" , size , 1 )
150
155
fsf $ is_y_alpha <- ifelse(fsf $ is_y_color == " yrep" , alpha , 1 )
151
156
157
+ max_time_y <- max(y , na.rm = TRUE )
158
+ fsf <- fsf %> %
159
+ dplyr :: filter(is_y_color != " yrep" | time < = max_time_y * extrapolation_factor )
160
+
152
161
# Ensure that the observed data gets plotted last by reordering the
153
162
# levels of the factor "strata"
154
163
fsf $ strata <- factor (fsf $ strata , levels = rev(levels(fsf $ strata )))
You can’t perform that action at this time.
0 commit comments