gmmEstimate {ivmte} | R Documentation |
GMM estimate of TE under point identification
Description
If the user sets the argument point = TRUE
in the function
ivmte
, then it is assumed that the treatment effect
parameter is point identified. The observational equivalence
condition is then set up as a two-step GMM problem. Solving this
GMM problem recovers the coefficients on the MTR functions m0 and
m1. Combining these coefficients with the target gamma moments
allows one to estimate the target treatment effect.
Usage
gmmEstimate(
sset,
gstar0,
gstar1,
center = NULL,
subsetList = NULL,
n = NULL,
redundant = NULL,
identity = FALSE,
nMoments,
splines,
noisy = TRUE
)
Arguments
sset |
a list of lists constructed from the function genSSet. Each inner list should include a coefficient corresponding to a term in an IV specification, a matrix of the estimates of the gamma moments conditional on (X, Z) for the control group, and a matrix of the estimates of the gamma moments conditional on (X, Z) for the treated group. The column means of the last two matrices is what is used to generate the gamma moments. |
gstar0 |
vector, the target gamma moments for the control group. |
gstar1 |
vector, the target gamma moments for the treated group. |
center |
numeric, the GMM moment equations from the original sample. When bootstrapping, the solution to the point identified case obtained from the original sample can be passed through this argument to recenter the bootstrap distribution of the J-statistic. |
subsetList |
list of subset indexes, one for each IV-like specification. |
n |
number of observations in the data. This option is only used when subsetting is involved. |
redundant |
vector of integers indicating which components in the S-set are redundant. |
identity |
boolean, default set to |
nMoments |
number of linearly independent moments. This option is used to determine the cause of underidentified cases. |
splines |
boolean, set to |
noisy |
boolean, default set to |
Value
a list containing the point estimate of the treatment
effects, and the MTR coefficient estimates. The moment
conditions evaluated at the solution are also returned, along
with the J-test results. However, if the option center
is passed, then the moment conditions and J-test are centered
(this is to perform the J-test via bootstrap).
Examples
dtm <- ivmte:::gendistMosquito()
## Declare empty list to be updated (in the event multiple IV like
## specifications are provided
sSet <- list()
## Declare MTR formulas
formula1 = ~ 0 + u
formula0 = ~ 0 + u
## Construct object that separates out non-spline components of MTR
## formulas from the spline components. The MTR functions are
## obtained from this object by the function 'genSSet'.
splinesList = list(removeSplines(formula0), removeSplines(formula1))
## Construct MTR polynomials
polynomials0 <- polyparse(formula = formula0,
data = dtm,
uname = u,
as.function = FALSE)
polynomials1 <- polyparse(formula = formula0,
data = dtm,
uname = u,
as.function = FALSE)
## Generate propensity score model
propensityObj <- propensity(formula = d ~ z,
data = dtm,
link = "linear")
## Generate IV estimates
ivEstimates <- ivEstimate(formula = ey ~ d | z,
data = dtm,
components = l(intercept, d),
treat = d,
list = FALSE)
## Generate target gamma moments
targetGamma <- genTarget(treat = "d",
m0 = ~ 1 + u,
m1 = ~ 1 + u,
target = "atu",
data = dtm,
splinesobj = splinesList,
pmodobj = propensityObj,
pm0 = polynomials0,
pm1 = polynomials1)
## Construct S-set. which contains the coefficients and weights
## corresponding to various IV-like estimands
sSet <- genSSet(data = dtm,
sset = sSet,
sest = ivEstimates,
splinesobj = splinesList,
pmodobj = propensityObj$phat,
pm0 = polynomials0,
pm1 = polynomials1,
ncomponents = 2,
scount = 1,
yvar = "ey",
dvar = "d",
means = FALSE)
## Obtain point estimates using GMM
gmmEstimate(sset = sSet$sset,
gstar0 = targetGamma$gstar0,
gstar1 = targetGamma$gstar1)