@@ -399,13 +399,15 @@ MultistateModel <- R6::R6Class("MultistateModel",
399399 # ' @param w Spline weights. Matrix of shape \code{num_trans} x
400400 # ' \code{num_weights}. If \code{NULL}, a matrix of zeros is used.
401401 # ' @param num_doses Average number of doses taken by each subject. Only
402- # ' has effect if model as a PK submodel.
402+ # ' has effect if model has a PK submodel.
403403 # ' @param subjects_df Subject data frame. If \code{NULL}, simulated using
404404 # ' the \code{simulate_subjects} method.
405+ # ' @param truncate Truncate paths after terminal events?
405406 # ' @return A \code{\link{JointData}} object.
406407 simulate_data = function (N_subject = 100 , beta_haz = NULL ,
407408 beta_pk = NULL , w0 = 1e-3 , w = NULL , num_doses = 10 ,
408- subjects_df = NULL ) {
409+ subjects_df = NULL , truncate = TRUE ) {
410+ checkmate :: assert_logical(truncate , len = 1 )
409411 H <- self $ system $ num_trans()
410412 if (is.null(subjects_df )) {
411413 subjects_df <- self $ simulate_subjects(N_subject )
@@ -442,6 +444,9 @@ MultistateModel <- R6::R6Class("MultistateModel",
442444 subjects_df , path_df , link_df , self $ system $ tm(),
443445 colnames(subjects_df )
444446 )
447+ if (truncate ) {
448+ pd <- pd $ truncate()
449+ }
445450 JointData $ new(pd , pksim $ dosing )
446451 },
447452
0 commit comments