print.GenericML: Print method for a 'GenericML' object

View source: R/print.R

print.GenericMLR Documentation

Print method for a GenericML object

Description

Prints key results of the analyses conducted in GenericML().

Usage

## S3 method for class 'GenericML'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

Arguments

x

An object of the class "GenericML", as returned by the function GenericML().

digits

Number of digits to print.

...

Additional arguments to be passed down.

Value

A print to the console.

Examples

if(require("ranger")){

## generate data
set.seed(1)
n  <- 150                                  # number of observations
p  <- 5                                    # number of covariates
D  <- rbinom(n, 1, 0.5)                    # random treatment assignment
Z  <- matrix(runif(n*p), n, p)             # design matrix
Y0 <- as.numeric(Z %*% rexp(p) + rnorm(n)) # potential outcome without treatment
Y1 <- 2 + Y0                               # potential outcome under treatment
Y  <- ifelse(D == 1, Y1, Y0)               # observed outcome

## specify learners
learners <- c("random_forest")

## perform generic ML inference
# small number of splits to keep computation time low
x <- GenericML(Z, D, Y, learners, num_splits = 2,
               parallel = FALSE)

## print
print(x)
}


GenericML documentation built on June 18, 2022, 9:09 a.m.