OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Data & Analytics

Grf

Grf is an open-source R package for forest-based statistical estimation and inference, including heterogeneous treatment-effect estimation, regression and survival analysis.

Independent OpenViST project profile, based on linked sources.

Grf — OpenViST project profile in AI Data & Analytics.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use Grf when an R analysis calls for non-parametric forest-based estimation, particularly when treatment effects may vary across observations or outcomes are right-censored.

Who it is for

  • Researchers and analysts conducting treatment-effect or causal-inference analysis in R.
  • Users seeking forest-based regression, quantile or survival estimation.

Documented uses

  • Estimate heterogeneous treatment effects and predict them for new covariate data.
  • Calculate average treatment effects for a specified target sample.
  • Fit least-squares, quantile or survival regression forests.
  • Analyze outcomes that may be right-censored, with multiple treatment arms or outcomes, or instrumental variables.
Before you choose

Requirements & limits

The package is open source under GPL-3.0. The repository documents installation through CRAN and conda-forge; source installation requires a C++17-or-later compiler, and Windows source installation also requires RTools.

  • Grf is an R package with C++ implementation, not a hosted analytics interface.
  • Its methods include causal, regression, quantile and survival forests; the appropriate forest depends on the analysis task.
  • Source installation has compiler prerequisites, while the README also documents CRAN and conda-forge installation routes.
  • The examples show prediction, average treatment effects and confidence intervals; confidence-interval examples use a larger forest.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Fit and predict with a causal forest

Estimate heterogeneous treatment effects and obtain predictions for a test sample.

Before you start

  • The grf R package.
  • Covariate matrix X, outcome vector Y, treatment indicator W, and test covariates X.test.

Steps

  1. Load the package with library(grf).

  2. Fit a forest with tau.forest <- causal_forest(X, Y, W).

  3. Estimate test-sample treatment effects with tau.hat <- predict(tau.forest, X.test).

  4. Optionally estimate an average effect with average_treatment_effect(tau.forest, target.sample = "all") or use target.sample = "treated".

Expected outcome

The fitted forest provides treatment-effect predictions for the test data and can estimate an average effect for the selected target sample.

Guide limitations

  • The guide does not prescribe data preparation or establish that a particular dataset is suitable for causal inference.
  • Confidence intervals require variance estimation; the example uses a larger forest with 4,000 trees.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
13 October 2026
Original website title
grf-labs/grf · Official homepage title · retained in its source language