The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

PRTree: Probabilistic Regression Trees

CRAN status License: GPL v3 DOI (Theoretical Paper) arXiv (Package Paper)

Overview

PRTree provides an efficient R implementation of Probabilistic Regression Trees (PRTrees) with built-in handling of missing predictor values. Unlike standard regression trees that rely on hard binary splits, PRTrees assign observations to terminal regions smoothly via probability distributions, yielding continuous regression surfaces.

The core tree-building and prediction routines are implemented in Fortran (using LAPACK’s DGELSD for numerically stable least-squares estimation), offering high computational efficiency alongside a clean S3 interface in R.

Key Features

Installation

Install the released version from CRAN:

install.packages("PRTree")

Or install the development version from GitHub:

# install.packages("remotes")
remotes::install_github("tsprass/PRTree")

Quick Example

library(PRTree)

# Simulate noisy data
set.seed(1234)
X <- matrix(runif(200, 0, 10), ncol = 1)
y <- cos(X) + rnorm(200, 0, 0.05)

# Fit a Probabilistic Regression Tree
fit <- pr_tree(y, X, max_terminal_nodes = 9, prop_hold = 0)
summary(fit)

# Predict on new observations (including missing values)
X_new <- matrix(c(2.5, 5.0, NA), ncol = 1)
predict(fit, newdata = X_new)

# Diagnostic plots and tree visualization
plot(fit, y, which = c(1, 2, 4, 5), ncol = 2)
plot_tree(fit, max_bins = 10)

Cross-validation example:

set.seed(123)
X <- matrix(runif(1000, 0, 10), ncol = 2)
y <- 2 * sin(X[, 1]) + 0.5 * X[, 2] + rnorm(500, 0, 0.2)

ctrl_cv <- pr_tree_control_cv(
  method = "montecarlo",
  n_rep = 10,
  prop_test = 0.2,
  prop_valid = 0.2
)
cv_res <- pr_tree_cv(y, X, control_cv = ctrl_cv)
summary(cv_res)
plot(cv_res)

Main Functions

Function Description
pr_tree() Fit a Probabilistic Regression Tree model
predict() Generate predictions (and optionally probability matrices) for new data
pr_tree_control() Configure tree-building, distribution, and missing-data parameters
expand_sigma_grid() Build custom smoothing parameter (sigma) grids
pr_tree_cv() Perform k-fold or Monte Carlo cross-validation
pr_tree_control_cv() Configure cross-validation settings
train_test_split() Create random or missing-value stratified splits and folds
plot_tree() Visualize the fitted tree structure and terminal probability distributions

References

Citation

To cite PRTree in publications, run citation("PRTree") in R.

License

GPL (>= 3)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.