
Comprehensive Summary of Causal Forest Results
causal_forest_summary.RdProduces a complete, publication-ready summary of a grf causal forest object, including: ATE with inference, heterogeneity assessment (BLP, GATES), CATE distribution, most important features, and policy-relevant summaries.
Usage
causal_forest_summary(
cf,
X,
feature_names = NULL,
n_groups = 5,
top_features = 10,
plot = TRUE
)Arguments
- cf
A
causal_forestobject from grf.- X
Data frame or matrix of covariates (same as used for fitting).
- feature_names
Character vector. Names for the feature columns. If
NULL, uses column names ofX.- n_groups
Integer. Number of groups for GATES analysis. Default
5.- top_features
Integer. Number of top features to show in importance plot. Default
10.- plot
Logical. Produce plots. Default
TRUE.
Value
A list with:
- ate
Data frame: ATE estimate with SE, t-stat, p-value, CI.
- cate_summary
Summary statistics of CATE distribution.
- blp
BLP analysis results (from
blp_analysis()).- feature_importance
Data frame of variable importance scores.
- plot_cate_dist
ggplot2: CATE distribution histogram.
- plot_importance
ggplot2: feature importance bar chart.
- plot_blp
ggplot2: BLP coefficient plot.
- plot_gates
ggplot2: GATES plot.
Examples
if (FALSE) { # \dontrun{
library(grf)
n <- 1000; p <- 10
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- paste0("X", 1:p)
W <- rbinom(n, 1, 0.5)
tau <- pmax(X[, 1], 0)
Y <- tau * W + rnorm(n)
cf <- causal_forest(X, Y, W, num.trees = 500)
result <- causal_forest_summary(cf, X, feature_names = colnames(X))
result$ate
result$plot_cate_dist
} # }