Partition chronologically ordered data using regression trees (mvpart::rpart()). This function performs regression partitioning analysis on a given data source to identify segments with different relationships between the dependent variable and a specified independent variable. The output includes the partitioned data, the resulting regression tree, the number of resulting segments, and the change points in the independent variable age that correspond to the partitioning.

regression_partition(data_source, var = "", age_var = "")

Arguments

data_source

Data frame with the variables to partition

var

Character. Name (in quotes) of variable to partition

age_var

Character. Name (in quotes) of variable which define the age of samples

Value

  • rpart_result - the regression tree generated by the mvpart::rpart()

  • pruned_tree - the pruned version of the regression tree

  • rpart_groups - the number of segments generated by the regression partitioning analysis

  • rpart_change_points - the change points in the independent variable (age) that correspond to the partitioning

  • rpart_partitions - the partitioned data, with an additional column indicating the segment to which each row belongs

See also

mvpart::rpart()