Learn R Programming

aggTrees (version 2.1.0)

print.aggTrees.inference: Print Method for aggTrees.inference Objects

Description

Prints an aggTrees.inference object.

Usage

# S3 method for aggTrees.inference
print(x, table = "avg_char", ...)

Value

Prints LATEX code.

Arguments

x

aggTrees.inference object.

table

Either "avg_char" or "diff", controls which table must be produced.

...

Further arguments passed to or from other methods.

Author

Riccardo Di Francesco

Details

A description of each table is provided in its caption.

Some covariates may feature zero variation in some leaf. This generally happens to dummy variables used to split some nodes. In this case, when table == "avg_char" a warning message is produced displaying the names of the covariates with zero variation in one or more leaves. The user should correct the table by removing the associated standard errors.

Compilation of the LATEX code requires the following packages: booktabs, float, adjustbox, multirow.

References

  • Di Francesco, R. (2022). Aggregation Trees. CEIS Research Paper, 546. tools:::Rd_expr_doi("10.2139/ssrn.4304256").

See Also

build_aggtree, inference_aggtree

Examples

Run this code
## Generate data.
set.seed(1986)

n <- 1000
k <- 3

X <- matrix(rnorm(n * k), ncol = k)
colnames(X) <- paste0("x", seq_len(k))
D <- rbinom(n, size = 1, prob = 0.5)
mu0 <- 0.5 * X[, 1]
mu1 <- 0.5 * X[, 1] + X[, 2]
Y <- mu0 + D * (mu1 - mu0) + rnorm(n)

## Training-honest sample split.
honest_frac <- 0.5
splits <- sample_split(length(Y), training_frac = (1 - honest_frac))
training_idx <- splits$training_idx
honest_idx <- splits$honest_idx

Y_tr <- Y[training_idx]
D_tr <- D[training_idx]
X_tr <- X[training_idx, ]

Y_hon <- Y[honest_idx]
D_hon <- D[honest_idx]
X_hon <- X[honest_idx, ]

## Construct sequence of groupings. CATEs estimated internally.
groupings <- build_aggtree(Y_tr, D_tr, X_tr,
                           Y_hon, D_hon, X_hon)

## Analyze results with 4 groups.
results <- inference_aggtree(groupings, n_groups = 4)

## Print results.
print(results, table = "diff")
print(results, table = "avg_char")

Run the code above in your browser using DataLab