Closed jkcshea closed 3 years ago
Thanks @jkcshea . I think it looks good. One minor question: For outcome
we pass this as a string even though it is a variable name. Is that consistent with good R practice?
I will post possible bugs/problems that I find in separate issues.
One minor question: For outcome we pass this as a string even though it is a variable name. Is that consistent with good R practice?
Ah, good catch.
The function is supposed to allow outcome
to be passed as a variable name and not as a string, as I had recycled the code to parse the treat
and propensity
arguments.
But then upon checking I found that there is an error later on in the code!
This has now been resolved!
By the way, I'm not sure CPLEX will allow for quadratically constrained quadratic programs in R. (Can't remember why though...I think it's a limitation of the API(s) if I recall.) If that's true, then we just need to require Gurobi for this procedure.
To briefly summarize what is being done:
ivlike
argument (or can passNULL
). Instead, this procedure first tries to estimate the MTRs by regressing the outcome variable on the basis functions. If the coefficients are point identified, then they are used to construct the target parameter.Attached is the note by @a-torgovitsky on the procedure, for additional details and for the sake of documentation. direct-mtr-procedure.pdf
This has mostly been implemented, but two things remain:
Hopefully this is enough for @johnnybonney @cblandhol @a-torgovitsky to get started.
Below are some examples based on the Mogstad and Torgovitsky (2018) paper.
Example 1: Point identified
In the example below, the coefficients of the MTR are point identified from a linear regression. The target parameter may then be constructed from these coefficients.
The estimates of the MTR and ATE align with the paper, which is good. A
testthat
test has also been written for this new procedure.Some things to note:
ivlike
is no longer passed, the function must be informed of what the outcome variable is. That may be done using theoutcome
argument.Now I add a collinear variable to the MTR. So the coefficients on the MTR will no longer be point identified. A partial identification approach will then be used, even though the user declared
point = TRUE
.Shape constraints are no longer ignored now. I've added some shape constraints to demonstrate that the audit procedure takes place as before.
As before, the argument
criterion.tol
allows the user to decide how much to relax the constraint.Let me know if anything is unclear, or if things should be done differently.