R Under development (unstable) (2026-10-28 r90783 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(BATTS) > # S3 classes and display methods (BATTS 0.3.0.9000). > set.seed(21) > x <- matrix(c(rnorm(30), rnorm(30, 0.5)), ncol = 1); g <- rep(0:1, each = 30) > > set.seed(3); fb <- boots(x, g, num_trees_max = 6, K_CV = 3, quiet = TRUE) Warning message: boots() is deprecated; use batts_boost() instead (see ?`BATTS-deprecated`). boots() still works and gives the same result. This warning is shown once per session. > set.seed(4); fs <- batts(x, g, num_trees = 4, size_burnin = 5, size_backfitting = 8, + output_BART_ensembles = TRUE, quiet = TRUE) Warning message: batts() is deprecated; use batts_bart() instead (see ?`BATTS-deprecated`). batts() still works and gives the same result. This warning is shown once per session. > > # Class structure: BART does not inherit the boosting class. > stopifnot(inherits(fb, "batts_boost"), inherits(fb, "batts_fit"), + inherits(fs, "batts_bart"), inherits(fs, "batts_fit"), + !inherits(fs, "batts_boost"), + !inherits(fb, "batts_bart")) > > # Nothing but the class attribute changed. > stopifnot(identical(class(unclass(fb)), "list"), + identical(class(unclass(fs)), "list"), + identical(names(unclass(fb)), + c("balance_weight_boosting_data", "n_nodes", "loss_curve", + "tree_list", "c", "data_info", "loss_CV_store", "Omega"))) > > # Display methods run and return their argument invisibly. > out <- capture.output({ + stopifnot(identical(withVisible(print(fb))$visible, FALSE), + identical(withVisible(print(fs))$visible, FALSE)) + }) > stopifnot(any(grepl("BATTS boosting fit", out, fixed = TRUE)), + any(grepl("BATTS Bayesian additive trees fit", out, fixed = TRUE))) > stopifnot(sum(grepl("w = sqrt(p/q), group 0 in the numerator", out, fixed = TRUE)) == 2L) > > sb <- summary(fb); ss <- summary(fs) > stopifnot(inherits(sb, "summary.batts_fit"), inherits(ss, "summary.batts_fit"), + identical(sb$type, "boost"), identical(ss$type, "bart"), + sb$n0 == 30, sb$n1 == 30, sb$d == 1, + ss$draws == 8, isTRUE(ss$forests_saved), + sb$num_trees == length(fb$tree_list), + length(sb$weight_range) == 2, all(is.finite(sb$weight_range)), + length(ss$weight_range) == 2, all(is.finite(ss$weight_range))) > > out2 <- capture.output({ + stopifnot(identical(withVisible(print(sb))$visible, FALSE), + identical(withVisible(print(ss))$visible, FALSE)) + }) > stopifnot(any(grepl("fitted weight w = sqrt(p/q) range", out2, fixed = TRUE))) > > stopifnot(nobs(fb) == 60, nobs(fs) == 60, identical(nobs(fb), nobs(fs))) > > # The methods consume no random numbers. > rng <- .Random.seed > invisible(capture.output({print(fb); print(fs); print(summary(fb)); print(summary(fs))})) > invisible(nobs(fb)) > stopifnot(identical(rng, .Random.seed)) > > cat('S3 class checks passed.\n') S3 class checks passed. > > proc.time() user system elapsed 0.26 0.01 0.28