get_BLP: Accessor function for the BLP generic target estimates

View source: R/accessors.R

get_BLPR Documentation

Accessor function for the BLP generic target estimates

Description

Accessor function for the BLP generic target estimates

Usage

get_BLP(x, learner = "best", plot = TRUE)

Arguments

x

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

learner

A character string of the learner whose BLP generic target estimates shall be accessed. Default is "best" for the best learner for BLP.

plot

Logical. If TRUE (default), a "ggplot" object is computed.

Value

An object of class "BLP_info", which consists of the following components:

estimate

A numeric vector of point estimates of the BLP generic targets.

confidence_interval

A numeric matrix of the lower and upper confidence bounds for each generic target. The confidence level of the implied confidence interval is equal to 1 - 2 * significance_level.

confidence_level

The confidence level of the confidence intervals. Equals 1 - 2 * significance_level.

learner

The argument learner.

plot

An object of class "ggplot". Only returned if the argument plot = TRUE.

See Also

GenericML(), get_GATES(), get_CLAN(), get_best(), print.BLP_info(), print.GATES_info(), print.CLAN_info()

Examples

if(require("rpart") && 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

## column names of Z
colnames(Z) <- paste0("V", 1:p)

## specify learners
learners <- c("tree", "mlr3::lrn('ranger', num.trees = 10)")

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

## access best learner
get_best(x)

## access BLP generic targets for best learner w/o plot
get_BLP(x, learner = "best", plot = FALSE)

## access BLP generic targets for ranger learner w/o plot
get_BLP(x, learner = "mlr3::lrn('ranger', num.trees = 10)", plot = FALSE)

## access GATES generic targets for best learner w/o plot
get_GATES(x, learner = "best", plot = FALSE)

## access GATES generic targets for ranger learner w/o plot
get_GATES(x, learner = "mlr3::lrn('ranger', num.trees = 10)", plot = FALSE)

## access CLAN generic targets for "V1" & best learner, w/o plot
get_CLAN(x, learner = "best", variable = "V1", plot = FALSE)

## access CLAN generic targets for "V1" & ranger learner, w/o plot
get_CLAN(x, learner = "mlr3::lrn('ranger', num.trees = 10)",
         variable = "V1", plot = FALSE)
}


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

Related to get_BLP in GenericML...