Last data update: 2014.03.03

R: Identifying Causal Effect for Multi-Component Intervention...
ImpactIV-packageR Documentation

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.

Details

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

Author(s)

Maintainer: Peng Ding <dingyunyiqiu@163.com>

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


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

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ImpactIV)
Loading required package: nnet
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ImpactIV/ImpactIV-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ImpactIV-package
> ### Title: Identifying Causal Effect for Multi-Component Intervention Using
> ###   IV
> ### Aliases: ImpactIV-package ImpactIV
> ### Keywords: instrumental variable causal effect
> 
> ### ** Examples
> 
> 
> 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)
# weights:  76 (54 variable)
initial  value 2471.762846 
iter  10 value 2245.988015
iter  20 value 2187.139335
iter  30 value 2148.406662
iter  40 value 2144.194207
iter  50 value 2143.574744
iter  60 value 2143.426822
final  value 2143.425341 
converged
> method2 = heter_IV2(Z = Z,A = A,M = M,Y = Y,X = X2, 
+                    polydegree = 1, step1 = method1, 
+                    truncate = 0.25, select ="AIC")
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>