Learn R Programming

ivmte (version 1.0.1)

genSSet: 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

genSSet(data, sset, sest, splinesobj, pmodobj, pm0, pm1, ncomponents,
  scount, subset_index, means = TRUE, yvar, dvar, noisy = TRUE)

Arguments

data

data.frame used to estimate the treatment effects.

sset

A list, which is modified and returned as the output.

sest

A list containing the point estimates and S-weights corresponding to a particular IV-like estimand.

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.

ncomponents

The number of components from the IV regression we want to include in the S-set.

scount

A counter for the number of elements in the S-set.

subset_index

An index for the subset of the data the IV regression is restricted to.

means

boolean, set to TRUE by default. If set to TRUE, then the gamma moments are returned, i.e. sample averages are taken. If set to FALSE, 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.

yvar

name of outcome variable. This is only used if means = FALSE, which occurs when the user believes the treatment effect is point identified.

dvar

name of treatment indicator. This is only used if means = FALSE, which occurs when the user believes the treatment effect is point identified.

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 the point estimate for the IV regression, and the expectation of each monomial term in the MTR.

Examples

Run this code
# NOT RUN {
## Declare empty list to be updated (in the event multiple IV like
## specifications are provided)
sSet <- list()

## Declare MTR formulas
formula1 = ~ 1 + u
formula0 = ~ 1 + 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(d),
                          treat = d,
                          list = FALSE)

## Construct S-set, which contains the coefficients and weights
## coresponding to various IV-like estimands
genSSet(data = dtm,
        sset = sSet,
        sest = ivEstimates,
        splinesobj = splinesList,
        pmodobj = propensityObj$phat,
        pm0 = polynomials0,
        pm1 = polynomials1,
        ncomponents = 1,
        scount = 1)

# }

Run the code above in your browser using DataLab