HDCATE.plot {hdcate}R Documentation

Plot HDCATE function and the uniform confidence bands

Description

Plot HDCATE function and the uniform confidence bands

Usage

HDCATE.plot(
  HDCATE_model,
  output_pdf = FALSE,
  pdf_name = "hdcate_plot.pdf",
  include_band = TRUE,
  test_side = "both",
  y_axis_min = "auto",
  y_axis_max = "auto",
  display.hdcate = "HDCATEF",
  display.ate = "ATE",
  display.siglevel = "sig_level"
)

Arguments

HDCATE_model

an object created via HDCATE

output_pdf

if TRUE, the plot will be saved as a PDF file, the default is FALSE

pdf_name

file name when output_pdf=TRUE

include_band

if TRUE, plot the uniform confidence bands (need: HDCATE.inference was called before)

test_side

'both', 'left' or 'right', i.e. 2-side test or one-side test

y_axis_min

minimum value of the Y axis to plot in the graph, the default is auto

y_axis_max

maximum value of the Y axis to plot in the graph, the default is auto

display.hdcate

the name of HDCATE function in the legend, the default is 'HDCATEF'

display.ate

the name of average treatment effect in the legend, the default is 'ATE'

display.siglevel

the name of the significant level for confidence bands in the legend, the default is 'sig_level'

Value

None. A plot will be shown or saved as PDF.

Examples

# get simulation data
n_obs <- 500  # Num of observations
n_var <- 100  # Num of observed variables
n_rel_var <- 4  # Num of relevant variables
data <- HDCATE.get_sim_data(n_obs, n_var, n_rel_var)
# conditional expectation model is misspecified
x_formula <- paste(paste0('X', c(2:n_var)), collapse ='+')
# propensity score model is misspecified
# x_formula <- paste(paste0('X', c(1:(n_var-1))), collapse ='+')

# create a new HDCATE model
model <- HDCATE(data=data, y_name='Y', d_name='D', x_formula=x_formula)

HDCATE.set_condition_var(model, 'X2', min=-1, max=1, step=0.01)

HDCATE.fit(model)
HDCATE.inference(model)
HDCATE.plot(model)


[Package hdcate version 0.1.0 Index]