## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----basic-example------------------------------------------------------------ library(ROOT) set.seed(123) # Simulate 80 units with two covariates and a variance-type objective n <- 80 dat <- data.frame( vsq = c(rnorm(40, mean = 0.01, sd = 0.005), # low-variance group rnorm(40, mean = 0.08, sd = 0.02)), # high-variance group x1 = c(runif(40, 0, 1), runif(40, 0, 1)), x2 = c(rep(0, 40), rep(1, 40)) # x2 = 1 flags high-variance units ) fit <- ROOT( data = dat, num_trees = 20, top_k_trees = TRUE, k = 10, seed = 123 ) ## ----inspect------------------------------------------------------------------ print(fit) # brief summary ## ----summary------------------------------------------------------------------ summary(fit) # full summary including Rashomon set details ## ----plot, fig.width = 6, fig.height = 4-------------------------------------- plot(fit) # visualize the characteristic tree