@@ -48,6 +48,11 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla
4848 person_time = FALSE ,
4949 time_intervals = " 12, 36, 60" ,
5050 rate_multiplier = 100 ,
51+ use_tree = FALSE ,
52+ min_node = 20 ,
53+ complexity = 0.01 ,
54+ max_depth = 5 ,
55+ show_terminal_nodes = FALSE ,
5156 showExplanations = FALSE ,
5257 showSummaries = TRUE , ... ) {
5358
@@ -314,6 +319,32 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla
314319 " rate_multiplier" ,
315320 rate_multiplier ,
316321 default = 100 )
322+ private $ ..use_tree <- jmvcore :: OptionBool $ new(
323+ " use_tree" ,
324+ use_tree ,
325+ default = FALSE )
326+ private $ ..min_node <- jmvcore :: OptionInteger $ new(
327+ " min_node" ,
328+ min_node ,
329+ min = 5 ,
330+ max = 100 ,
331+ default = 20 )
332+ private $ ..complexity <- jmvcore :: OptionNumber $ new(
333+ " complexity" ,
334+ complexity ,
335+ min = 0.001 ,
336+ max = 0.1 ,
337+ default = 0.01 )
338+ private $ ..max_depth <- jmvcore :: OptionInteger $ new(
339+ " max_depth" ,
340+ max_depth ,
341+ min = 1 ,
342+ max = 10 ,
343+ default = 5 )
344+ private $ ..show_terminal_nodes <- jmvcore :: OptionBool $ new(
345+ " show_terminal_nodes" ,
346+ show_terminal_nodes ,
347+ default = FALSE )
317348 private $ ..showExplanations <- jmvcore :: OptionBool $ new(
318349 " showExplanations" ,
319350 showExplanations ,
@@ -369,6 +400,11 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla
369400 self $ .addOption(private $ ..person_time )
370401 self $ .addOption(private $ ..time_intervals )
371402 self $ .addOption(private $ ..rate_multiplier )
403+ self $ .addOption(private $ ..use_tree )
404+ self $ .addOption(private $ ..min_node )
405+ self $ .addOption(private $ ..complexity )
406+ self $ .addOption(private $ ..max_depth )
407+ self $ .addOption(private $ ..show_terminal_nodes )
372408 self $ .addOption(private $ ..showExplanations )
373409 self $ .addOption(private $ ..showSummaries )
374410 }),
@@ -419,6 +455,11 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla
419455 person_time = function () private $ ..person_time $ value ,
420456 time_intervals = function () private $ ..time_intervals $ value ,
421457 rate_multiplier = function () private $ ..rate_multiplier $ value ,
458+ use_tree = function () private $ ..use_tree $ value ,
459+ min_node = function () private $ ..min_node $ value ,
460+ complexity = function () private $ ..complexity $ value ,
461+ max_depth = function () private $ ..max_depth $ value ,
462+ show_terminal_nodes = function () private $ ..show_terminal_nodes $ value ,
422463 showExplanations = function () private $ ..showExplanations $ value ,
423464 showSummaries = function () private $ ..showSummaries $ value ),
424465 private = list (
@@ -468,6 +509,11 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla
468509 ..person_time = NA ,
469510 ..time_intervals = NA ,
470511 ..rate_multiplier = NA ,
512+ ..use_tree = NA ,
513+ ..min_node = NA ,
514+ ..complexity = NA ,
515+ ..max_depth = NA ,
516+ ..show_terminal_nodes = NA ,
471517 ..showExplanations = NA ,
472518 ..showSummaries = NA )
473519)
@@ -1169,7 +1215,7 @@ multisurvivalBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
11691215 super $ initialize(
11701216 package = " jsurvival" ,
11711217 name = " multisurvival" ,
1172- version = c(0 ,0 ,32 ),
1218+ version = c(0 ,0 ,33 ),
11731219 options = options ,
11741220 results = multisurvivalResults $ new(options = options ),
11751221 data = data ,
@@ -1381,6 +1427,19 @@ multisurvivalBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
13811427# ' 60+.
13821428# ' @param rate_multiplier Specify the multiplier for incidence rates (e.g.,
13831429# ' 100 for rates per 100 person-years, 1000 for rates per 1000 person-years).
1430+ # ' @param use_tree If true, fits a survival decision tree to identify
1431+ # ' subgroups with different survival outcomes. Decision trees provide an
1432+ # ' intuitive alternative to Cox regression for identifying risk factors.
1433+ # ' @param min_node The minimum number of observations required in a terminal
1434+ # ' node. Larger values create simpler trees that may be more generalizable but
1435+ # ' potentially miss important subgroups.
1436+ # ' @param complexity The complexity parameter for tree pruning. Higher values
1437+ # ' result in smaller trees. This parameter controls the trade-off between tree
1438+ # ' size and goodness of fit.
1439+ # ' @param max_depth The maximum depth of the decision tree. Limits the
1440+ # ' complexity of the tree to avoid overfitting.
1441+ # ' @param show_terminal_nodes If true, displays Kaplan-Meier survival curves
1442+ # ' for each terminal node of the decision tree.
13841443# ' @param showExplanations Display detailed explanations for each analysis
13851444# ' component to help interpret the statistical methods and results.
13861445# ' @param showSummaries Display natural language summaries alongside tables
@@ -1491,6 +1550,11 @@ multisurvival <- function(
14911550 person_time = FALSE ,
14921551 time_intervals = " 12, 36, 60" ,
14931552 rate_multiplier = 100 ,
1553+ use_tree = FALSE ,
1554+ min_node = 20 ,
1555+ complexity = 0.01 ,
1556+ max_depth = 5 ,
1557+ show_terminal_nodes = FALSE ,
14941558 showExplanations = FALSE ,
14951559 showSummaries = TRUE ) {
14961560
@@ -1564,6 +1628,11 @@ multisurvival <- function(
15641628 person_time = person_time ,
15651629 time_intervals = time_intervals ,
15661630 rate_multiplier = rate_multiplier ,
1631+ use_tree = use_tree ,
1632+ min_node = min_node ,
1633+ complexity = complexity ,
1634+ max_depth = max_depth ,
1635+ show_terminal_nodes = show_terminal_nodes ,
15671636 showExplanations = showExplanations ,
15681637 showSummaries = showSummaries )
15691638
0 commit comments