Learn R Programming

ImpactIV (version 1.0)

ImpactIV-package: Identifying Causal Effect for Multi-Component Intervention Using IV

Description

In this package, you can find two functions proposed in Ding, Geng and Zhou (2011) to estimate direct and indirect causal effects with randomization and multiple-component intervention using instrumental variable method.

Arguments

Details

Package:
ImpactIV
Type:
Package
Version:
1.0
Date:
2010-12-12
License:
GPL (>=2)
LazyLoad:
yes

References

Ding, P., Geng, Z. and Zhou, X. H. (2011). Identifying Causal Effect for Multi-Component Intervention Using Instrumental Variable Method: with A Case Study of IMPACT Data. Technical Report.

See Also

homo_IV1, heter_IV2

Examples

Run this code

data(impact)
Z=impact$Z
A=impact$A
M=impact$M
Y=scale(impact$Y)
X=as.matrix(impact[,5:12])
##continuos variables of X
Xcon = X[, c(1,4,6,8)]
##discrete variables of X
Xdis = X[, c(2,3,5,7)]
##X^2
X2 = cbind(X, poly(Xcon, degree = 2, raw = TRUE), 
           Xcon*Xdis[,1], Xcon*Xdis[,2], Xcon*Xdis[,3], Xcon*Xdis[,4])

method1 = homo_IV1(Z = Z,A = A,M = M,Y = Y,X = X)
method2 = heter_IV2(Z = Z,A = A,M = M,Y = Y,X = X2, 
                   polydegree = 1, step1 = method1, 
                   truncate = 0.25, select ="AIC")

Run the code above in your browser using DataLab