Learn R Programming

ivDiag (version 1.0.6)

ltz: Local-to-Zero Test

Description

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)

Value

iv

results from a 2SLS regression.

ltz

results after local-to-zerio adjustment.

prior

prior mean and standard deviation

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).

References

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

See Also

plot_coef

Examples

Run this code
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)    
    
library(testthat)    
test_that("Check local-to-zero adjustment", {
  expect_equal(as.numeric(ltz_out$ltz[1]), 3.6088)
})

Run the code above in your browser using DataLab