print.aggTrees.inference | R Documentation |
Prints an aggTrees.inference
object.
## S3 method for class 'aggTrees.inference'
print(x, table = "avg_char", ...)
x |
|
table |
Either |
... |
Further arguments passed to or from other methods. |
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
.
Prints LATEX code.
Riccardo Di Francesco
Di Francesco, R. (2022). Aggregation Trees. CEIS Research Paper, 546. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2139/ssrn.4304256")}.
build_aggtree
, inference_aggtree
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.