Description Details Author(s) References See Also Examples
The package implements several types of instrumental variable analyses for makging causal inferences.
Package: | ivpack |
Type: | Package |
Version: | 1.0 |
Date: | 2013-12-28 |
License: | GPL-2 |
The functions robust.se and cluster.robust.se compute robust to heteroskedasticity and robust to clustering standard errors from an instrumental variable model fit using the ivreg command (from the AER package). The function anderson.rubin.ci computes the Anderson-Rubin confidence interval for an instrumental variable model, which is a confidence interval that is valid for both weak and strong instruments. The function power.iv computes the power for a planned instrumental variables analysis.
Dylan Small <dsmall@wharton.upenn.edu>
Baiocchi, M., Cheng, J. and Small, D., "Tutorial in Biostatistics: Instrumental Variable Methods for Causal Inference," available from authors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ### This is the IV model in panel A, column (5) of Table 3 from Card, 1995, "Using
### Geographic Variation in College Proximity to Esimate the Return from Schooling"
data(card.data)
ivmodel=ivreg(lwage ~ educ + exper + expersq + black + south + smsa + reg661 + reg662 +
reg663 + reg664 + reg665+ reg666 + reg667 + reg668 + smsa66, ~ nearc4 + exper +
expersq + black + south + smsa + reg661+ reg662 + reg663 + reg664 + reg665 + reg666 +
reg667 + reg668 + smsa66, x=TRUE, data=card.data)
# Anderson-Rubin confidence interval for effect of treatment
anderson.rubin.ci(ivmodel)
# Robust to heteroskedasticity standard errors
robust.se(ivmodel)
### Power for a study with in which the null hypothesis causal effect is 0,
### the true causal effect is 1, the sample size is 250, the instrument is
### binary with probability .5 (so variance = .25), the standard deviation
### of potential outcome under control is 1, the effect of the instrument
### is to increase the probability of a binary treatment being 1 from .25 to
### .75. The function sigmav.func computes the SD of v for a binary insrument,
### binary treatment. The correlation between u and v is assumed to be .5. The
### significance level for the study will be alpha = .05
sigmav.func(prob.d1.given.z1=.75,prob.d1.given.z0=.25,prob.z1=.5)
# The sigmav.func finds sigmav=.4330127
power.iv(n=250, lambda=1, gamma=.5, var.z=.25, sigmau=1, sigmav=.4330127, rho=.5,
alpha = 0.05)
|
Loading required package: AER
Loading required package: car
Loading required package: lmtest
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: sandwich
Loading required package: survival
$confidence.interval
[1] "[ 0.024804835963416 , 0.284823593340263 ]"
[1] "Robust Standard Errors"
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.77396514 0.91740530 4.1137 3.998e-05 ***
educ 0.13150384 0.05399953 2.4353 0.0149384 *
exper 0.10827111 0.02334656 4.6376 3.676e-06 ***
expersq -0.00233494 0.00034783 -6.7128 2.275e-11 ***
black -0.14677575 0.05236221 -2.8031 0.0050942 **
south -0.14467150 0.02906535 -4.9775 6.807e-07 ***
smsa 0.11180831 0.03106195 3.5995 0.0003240 ***
reg661 -0.10781423 0.04096681 -2.6317 0.0085383 **
reg662 -0.00704645 0.03369945 -0.2091 0.8343868
reg663 0.04044455 0.03252078 1.2437 0.2137248
reg664 -0.05791715 0.03921056 -1.4771 0.1397592
reg665 0.03845768 0.04946752 0.7774 0.4369648
reg666 0.05508871 0.05213085 1.0567 0.2907159
reg667 0.02675798 0.05010660 0.5340 0.5933667
reg668 -0.19089123 0.05068972 -3.7659 0.0001692 ***
smsa66 0.01853110 0.02051035 0.9035 0.3663331
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
$sigmav
[1] 0.4330127
$power
[1] 0.8714241
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.