# NOT RUN {
attach(dt_Rouse)
# Construct an IV out of differential distance to two-year versus
# four-year college. Z = 1 if the subject lives not farther from
# a 4-year college compared to a 2-year college.
Z = (dist4yr <= dist2yr) + 0
# Treatment A = 1 if the subject attends a 4-year college and 0
# otherwise.
A = 1 - twoyr
# Outcome Y = 1 if the subject obtained a bachelor's degree
Y = (educ86 >= 16) + 0
# Prepare the dataset
dt = data.frame(Z, female, black, hispanic, bytest, dadsome,
dadcoll, momsome, momcoll, fincome, fincmiss, A, Y)
# Calculate the Balke-Pearl bound by estimating each constituent
# conditional probability p(Y = y, A = a | Z, X) with a random
# forest.
dt_with_BP_bound_rf = estimate_BP_bound(dt, method = 'rf', nodesize = 5)
# Calculate the Balke-Pearl bound by estimating each constituent
# conditional probability p(Y = y, A = a | Z, X) with a multinomial
# regression.
dt_with_BP_bound_multinom = estimate_BP_bound(dt, method = 'multinom')
# }
Run the code above in your browser using DataLab