jkcshea / ivmte

An R package for implementing the method in Mogstad, Santos, and Torgovitsky (2018, Econometrica).
GNU General Public License v3.0
18 stars 2 forks source link

Different values of criterion.tol for lower/upper bounds #234

Open johnnybonney opened 1 year ago

johnnybonney commented 1 year ago

When using the soft constraints approach, it seems like we may want to allow for different values of criterion.tol for the lower and upper bounds.

Currently, @cblandhol and I selecting criterion.tol using the approach outlined by @a-torgovitsky here, and so we allow for criterion.tol to differ for the lower and upper bound problems. With the current package version, we must then estimate each problem twice using ivmte---once to get the lower bound, and once to get the upper bound.

Since other users may wish to use a similar method to select criterion.tol, it may be desirable---when soft = T---to allow the user to provide a named list (e.g. criterion.tol = list(lower = 1000, upper = 10)) or a vector that passes different parameter values to each problem.

a-torgovitsky commented 1 year ago

Ah yes, and the default should be that they are different for the lower and upper bounds. Edit: Oops, sorry, ignore me. I was thinking we had already incorporated the selection approach @johnnybonney linked to into the module. But that's still outside of it. So for now we just need to allow the user to pass different choices for the LB and UB.

jkcshea commented 1 year ago

Yes, good suggestion. I can certainly do this!

jkcshea commented 1 year ago

Okay, you should be able to declare different values for criterion.tol when soft = TRUE now. As you suggested, you can either pass a named vector or named list. The names should be lower and upper. Here's an example:

devtools::load_all("../ivmte")
dtm <- ivmte:::gendistMosquito()
args <- list(data = dtm,
             propensity = d ~ 0 + factor(z),
             m0 = ~ uSplines(degree = 3, knots = c(0.3, 0.6)),
             m1 = ~ uSplines(degree = 3, knots = c(0.3, 0.6)),
             target = "att",
             outcome = 'ey',
             soft = TRUE,
             direct = "l2")

## Declare common values for criterion.tol
args$criterion.tol <- 10
do.call(ivmte, args)

Here are the bounds:

Bounds on the target parameter: [-0.234517, 0.2228876]
Audit terminated successfully after 2 rounds 

Below, I change the value of criterion.tol for the upper bound only. Only the estimate for the upper bound should change.

args$criterion.tol <- c(lower = 10,
                        upper = 2000)
do.call(ivmte, args)

Here are the bounds.

Bounds on the target parameter: [-0.234517, 0.003233728]
Audit terminated successfully after 2 rounds 
cblandhol commented 1 year ago

That works well for me -- thanks, @jkcshea !