knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(OPL)
The opl_lc_c
function implements ex-ante treatment assignment using as
policy class a fixed-depth (1-layer) decision-tree at specific splitting
variables and threshold values.
opl_lc_c(make_cate_result,z,w,c1=NA,c2=NA,c3=NA)
make_cate_result
: A data frame containing input data, including a column named my_cate
, representing conditional average treatment effects (CATE).w
: A character string indicating the column name for treatment assignment (binary variable).policy_constraints
: A list of constraints applied to the treatment assignment, such as budget limits or fairness constraints.The function returns the input data frame augmented with:
- treatment_assignment
: Binary indicator for treatment assignment based on policy learning.
- policy_summary
: Summary statistics detailing the constrained optimization results.
Additionally, the function: - Prints a summary of key results, including welfare improvements under the learned policy. - Displays a visualization of the treatment allocation.
The function follows these steps: 1. Estimates the optimal policy assignment using a machine learning-based approach. 2. Incorporates policy constraints to balance fairness, budget, or other practical limitations. 3. Computes and reports key statistics, including constrained welfare gains and proportion of treated units.
# Load example data set.seed(123) data_example <- data.frame( my_cate = runif(100, -1, 1), treatment = sample(0:1, 100, replace = TRUE)") # Define policy constraints constraints <- list(budget = 0.5) # Example: treating at most 50% of units # Run learning-based constrained policy assignment result <- opl_lc_c( make_cate_result = data_example, w = "treatment", policy_constraints = constraints )
This vignette provides an overview of the opl_lc_c
function and demonstrates its usage for learning-based constrained policy assignment. For further details, consult the package documentation.
The development of this software was supported by FOSSR (Fostering Open Science in Social Science Research), a project funded by the European Union - NextGenerationEU under the NPRR Grant agreement n. MURIR0000008.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.