Learn R Programming

ivmte (version 1.0.1)

genTarget: Generating LP moments for IV-like estimands

Description

This function takes in the IV estimate and its IV-like specification, and generates a list containing the corresponding point estimate, and the corresponding moments (gammas) that will enter into the constraint matrix of the LP problem.

Usage

genTarget(treat, m0, m1, uname, target, target.weight0, target.weight1,
  target.knots0, target.knots1, late.Z, late.from, late.to, late.X, eval.X,
  genlate.lb, genlate.ub, data, splinesobj, pmodobj, pm0, pm1,
  point = FALSE, noisy = TRUE)

Arguments

treat

variable name for treatment indicator

m0

one-sided formula for marginal treatment response function for control group. Splines can also be incorporated using the expression "uSplines(degree, knots, intercept)". The 'intercept' argument may be omitted, and is set to TRUE by default.

m1

one-sided formula for marginal treatment response function for treated group. Splines can also be incorporated using the expression "uSplines(degree, knots, intercept)". The 'intercept' argument may be omitted, and is set to TRUE by default.

uname

variable name for unobservable used in declaring MTRs

target

target parameter to be estimated. Currently function allows for ATE ("ate"), ATT ("att"), ATU ("atu"), LATE ("late"), and generalized LATE ("genlate").

target.weight0

user-defined weight function for the control group defining the target parameter. A list of functions can be submitted if the weighting function is in fact a spline. The arguments of the function should be variable names in data. If the weight is constant across all observations, then the user can instead submit the value of the weight instead of a function.

target.weight1

user-defined weight function for the treated group defining the target parameter. A list of functions can be submitted if the weighting function is in fact a spline. The arguments of the function should be variable names in data. If the weight is constant across all observations, then the user can instead submit the value of the weight instead of a function.

target.knots0

user-defined set of functions defining the knots associated with splines weights for the control group. The arguments of the function should consist only of variable names in data. If the knot is constant across all observations, then the user can instead submit the value of the weight instead of a function.

target.knots1

user-defined set of functions defining the knots associated with splines weights for the treated group. The arguments of the function should be variable names in data. If the knot is constant across all observations, then the user can instead submit the value of the weight instead of a function.

late.Z

vector of variable names used to define the LATE.

late.from

baseline set of values of Z used to define the LATE.

late.to

comparison set of values of Z used to define the LATE.

late.X

vector of variable names of covariates which we condition on when defining the LATE.

eval.X

numeric vector of the values at which we condition variables in late.X on when estimating the LATE.

genlate.lb

lower bound value of unobservable u for estimating generalized LATE.

genlate.ub

upper bound value of unobservable u for estimating generalized LATE.

data

data.frame used to estimate the treatment effects.

splinesobj

list of spline components in the MTRs for treated and control groups. Spline terms are extracted using removeSplines.

pmodobj

A vector of propensity scores.

pm0

A list of the monomials in the MTR for d = 0.

pm1

A list of the monomials in the MTR for d = 1.

point

boolean, set to FALSE by default. point refers to whether the partial or point identification is desired. If set to FALSE, then the gamma moments are returned, i.e. sample averages are taken. If set to TRUE, then no sample averages are taken, and a matrix is returned. The sample average of each column of the matrix corresponds to a particular gamma moment.

noisy

boolean, default set to TRUE. If TRUE, then messages are provided throughout the estimation procedure. Set to FALSE to suppress all messages, e.g. when performing the bootstrap.

Value

A list containing either the vectors of gamma moments for D = 0 and D = 1, or a matrix of individual gamma values for D = 0 and D = 1. Additoinally, two vectors are returned. xindex0 and xindex1 list the variables that interact with the unobservable u in m0 and m1. uexporder0 and uexporder1 lists the exponents of the unobservable u in each term it appears in.

Examples

Run this code
# NOT RUN {
## Declare MTR functions
formula1 = ~ 1 + u
formula0 = ~ 1 + u
splinesList = list(removeSplines(formula0), removeSplines(formula1))

## Declare propensity score model
propensityObj <- propensity(formula = d ~ z,
                            data = dtm,
                            link = "linear")

## 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 target gamma moments
genTarget(treat = "d",
          m0 = ~ 1 + u,
          m1 = ~ 1 + u,
          uname = u,
          target = "atu",
          data = dtm,
          splinesobj = splinesList,
          pmodobj = propensityObj,
          pm0 = polynomials0,
          pm1 = polynomials1,
          point = FALSE)


# }

Run the code above in your browser using DataLab