help opl_dt

Title

opl_dt -- Decision-tree optimal policy learning

Syntax

opl_dt ,
xlist(var1 var2)
cate(varname)

Description

opl_dt is a command implementing optimal ex-ante treatment assignment using as policy
class a 2-layer fixed-depth decision-tree based on selection variables var1 and var2.

Options

options

xlist(var1 var2) defines the two variables the policymaker decide to use for selecting policy beneficiaries

cate(varname) puts into varname a variable already present in the dataset containing the conditional average treatment effect (CATE). This variable can be generate using the command make_cate

Returns: general

Scalars
e(best_c1) optimal threshold level of the first variable used for splitting which maximizes the welfare

e(best_c2) optimal threshold level of the second variable used for splitting which maximizes the welfare

e(best_c3) optimal threshold level of the third variable used for splitting which maximizes the welfare

Remarks

Remark 1. Please, consider to keep updated with future versions of this command.

Example

Example: Decision-tree optimal policy learning

Load initial dataset

sysuse JTRAIN2, clear

Split the original data into a "old" (training) and "new" (testing) dataset

get_train_test, dataname(jtrain) split(0.60 0.40) split_var(svar) rseed(101)

Use the "old" dataset (i.e. policy) for training

use jtrain_train , clear

Set the outcome

global y "re78"

Set the features

global x "re74 re75 age agesq nodegree"

Set the treatment variable

global w "train"

Set the selection variables

global z "age mostrn"

Run "make_cate" and generate training (old policy) and testing (new policy) CATE predictions

make_cate $y $x , treatment($w) model("linear") new_cate("my_cate_new") train_cate("my_cate_train") new_data("jtrain_test")

Generate a global macro containing the name of the variable "cate_new"

global T `e(cate_new)'

Select only the "new data"

keep if _train_new_index=="new"

Drop "my_cate_train" as in the new dataset treatment assignment and outcome performance are unknown

drop my_cate_train $w $y

Run "opl_dt" to find the optimal decision-tree splitting variables and thresholds

opl_dt , xlist($z) cate($T)

Display the optimal threshold values

di e(best_c1)

di e(best_c2)

di e(best_c3)

Display the optimal splitting variables

di "`e(best_x1)'"

di "`e(best_x2)'"

di "`e(best_x3)'"

References

Athey, S., and Wager S. 2021. Policy Learning with Observational Data, Econometrica, 89, 1, 133–161.

Cerulli, G. 2021. Improving econometric prediction by machine learning, Applied Economics Letters, 28, 16, 1419-1425.

Cerulli, G. 2022. Optimal treatment assignment of a threshold-based policy: empirical protocol and related issues, Applied Economics Letters, 30, 8, 1010-1017.

Cerulli, G. 2023. Fundamentals of Supervised Machine Learning: With Applications in Python, R, and Stata, Springer.

Cerulli, G. 2024. Optimal Policy Learning using Stata. Zenodo. DOI: https://doi.org/10.5281/zenodo.10822240.

Gareth, J., Witten, D., Hastie, D.T., Tibshirani, R. 2013. An Introduction to Statistical Learning: with Applications in R. New York, Springer.

Kitagawa, T., and A. Tetenov. 2018. Who Should Be Treated? Empirical Welfare Maximization Methods for Treatment Choice, Econometrica, 86, 2, 591–616.

Acknowledgment

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.

Author

Giovanni Cerulli

IRCrES-CNR

Research Institute for Sustainable Economic Growth, National Research Council of Italy

E-mail: giovanni.cerulli@ircres.cnr.it

Also see

Online: make_cate, opl_dt_c, opl_dt, opl_dt_c, opl_dt, opl_dt_c