Skip to contents

Estimates Local-to-Zero IV coefficients and SEs for a single instrument.

Usage

ltz(data, Y, D, Z, controls, FE = NULL, cl = NULL, weights = NULL, prior, prec = 4)

Arguments

data

name of a dataframe.

Y

a string indicating the outcome variable.

D

a string indicating the treatment variable.

Z

a vector of strings indicating the instrumental variables.

controls

a vector of strings indicating the control variables.

FE

a vector of strings indicating the fixed effects variables.

cl

a string indicating the clustering variable.

weights

a string indicating the variable that stores weights.

prior

prior mean and standard deviation of the direct effect of instrument on outcome.

prec

precision of results (4 by default).

Value

iv

results from a 2SLS regression.

ltz

results after local-to-zerio adjustment.

prior

prior mean and standard deviation

See also

References

Conley, Timothy G, Christian B Hansen, and Peter E Rossi. 2012. "Plausibly Exogenous." Review of Economics and Statistics 94 (1): 260–72.

Examples

data(ivDiag)
controls <- c('altitudine', 'escursione', 'costal', 'nearsea', 'population', 
    'pop2', 'gini_land', 'gini_income')
ltz_out <- ltz(data = gsz, Y = "totassoc_p", D = "libero_comune_allnord", 
    Z = "bishopcity", controls = controls, weights = "population", 
    prior = c(0.178, 0.137))
plot_ltz(ltz_out)    
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.

    
library(testthat)    
test_that("Check local-to-zero adjustment", {
  expect_equal(as.numeric(ltz_out$ltz[1]), 3.6088)
})
#> Test passed 😸