R version 2.5.0 (2007-04-23) Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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. Natural language support but running in an English locale 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. > # Replication of Guido Imbens lalonde_exper_04feb2.m file > # See http://elsa.berkeley.edu/~imbens/estimators.shtml > # with balance checks > > library(Matching) Loading required package: rgenoud ## rgenoud (Version 5.1-14, Build Date: 2007-08-04) ## See http://sekhon.berkeley.edu/rgenoud for additional documentation. Loading required package: MASS ## ## Matching (Version 4.5-2, Build Date: 2007/08/22) ## See http://sekhon.berkeley.edu/matching for additional documentation. ## Please cite software as: ## Jasjeet S. Sekhon. 2007. ``Multivariate and Propensity Score Matching ## Software with Automated Balance Optimization: The Matching package for R.'' ## Journal of Statistical Software. ## Information on package 'Matching' Description: Package: Matching Version: 4.5-2 Date: 2007/08/22 Title: Multivariate and Propensity Score Matching with Balance Optimization Author: Jasjeet Singh Sekhon Maintainer: Jasjeet Singh Sekhon Description: Provides functions for multivariate and propensity score matching and for finding optimal balance based on a genetic search algorithm. A variety of univariate and multivariate metrics to determine if balance has been obtained are also provided. Depends: R (>= 2.0.0), rgenoud (>= 2.12), MASS (>= 7.2-1), graphics, grDevices, stats Suggests: snow (>= 0.2-1) License: GPL3 as long as authorship of this code is made clear URL: http://sekhon.berkeley.edu/matching Packaged: Wed Aug 22 19:54:15 2007; sekhon Built: R 2.5.0; x86_64-unknown-linux-gnu; 2007-08-22 19:57:42; unix Index: balanceMV Multivariate Tests for Balance balanceUV Univariate Balance Tests GenMatch Genetic Matching GerberGreenImai Gerber and Green Dataset used by Imai ks.boot Bootstrap Kolmogorov-Smirnov lalonde Lalonde Dataset Match Multivariate and Propensity Score Matching Estimator for Causal Inference MatchBalance Tests for Univariate and Multivariate Balance Matchby Grouped Multivariate and Propensity Score Matching qqstats QQ Summary Statistics summary.balanceMV Summarizing output from balanceMV summary.balanceUV Summarizing output from balanceUV summary.ks.boot Summarizing output from ks.boot summary.Match Summarizing output from Match summary.Matchby Summarizing output from Matchby > library(help=Matching) > demo(AbadieImbens) demo(AbadieImbens) ---- ~~~~~~~~~~~~ > # Replication of Guido Imbens lalonde_exper_04feb2.m file > # See http://elsa.berkeley.edu/~imbens/estimators.shtml > # > # Note that the implications of the 'exact' options differ between the > # two programs > > data(lalonde) > X <- lalonde$age > Z <- X; > V <- lalonde$educ; > Y <- lalonde$re78/1000; > T <- lalonde$treat; > w.educ=exp((lalonde$educ-10.1)/2); > res <- matrix(nrow=1,ncol=3) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=1,Var.calc=0, + sample=TRUE); > summary(rr) Estimate... 1.7852 AI SE...... 0.68672 T-stat..... 2.5996 p.val...... 0.0093332 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 5251 > res[1,] <- cbind(1,rr$est,rr$se) > X <- cbind(lalonde$age, lalonde$educ, lalonde$re74, lalonde$re75) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=1,Var.calc=0, + sample=TRUE); > summary(rr) Estimate... 1.7144 AI SE...... 0.74013 T-stat..... 2.3164 p.val...... 0.020539 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 733 > res <- rbind(res,cbind(2,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=3,BiasAdj=FALSE,Weight=1,Var.calc=0, + sample=TRUE); > summary(rr) Estimate... 1.5363 AI SE...... 0.66193 T-stat..... 2.3209 p.val...... 0.02029 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 1670 > res <- rbind(res,cbind(4,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATT",M=1,BiasAdj=FALSE,Weight=1,Var.calc=0, + sample=TRUE); > summary(rr) Estimate... 1.7269 AI SE...... 0.83663 T-stat..... 2.0641 p.val...... 0.039005 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 185 Matched number of observations (unweighted). 327 > res <- rbind(res,cbind(5,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATC",M=1,BiasAdj=FALSE,Weight=1,Var.calc=0, + sample=TRUE); > summary(rr) Estimate... 1.7055 AI SE...... 0.8201 T-stat..... 2.0796 p.val...... 0.037558 Original number of observations.............. 445 Original number of control obs............... 260 Matched number of observations............... 260 Matched number of observations (unweighted). 406 > res <- rbind(res,cbind(6,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=2,Var.calc=0, + sample=TRUE); > summary(rr) Estimate... 1.5926 AI SE...... 0.68473 T-stat..... 2.3259 p.val...... 0.020024 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 729 > res <- rbind(res,cbind(7,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=3,Var.calc=0, + Weight.matrix=diag(4), sample=TRUE); > summary(rr) Estimate... 1.7144 AI SE...... 0.74013 T-stat..... 2.3164 p.val...... 0.020539 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 733 > res <- rbind(res,cbind(8,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=X,V=V,estimand="ATE",M=1,BiasAdj=TRUE,Weight=1,Var.calc=0, + sample=TRUE); > summary(rr) Estimate... 1.6309 AI SE...... 0.74523 T-stat..... 2.1885 p.val...... 0.028636 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 733 > res <- rbind(res,cbind(9,rr$est,rr$se)) > Z <- cbind(lalonde$married, lalonde$age) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=TRUE,Weight=1,Var.calc=0,sample=TRUE); > summary(rr) Estimate... 1.7197 AI SE...... 0.74361 T-stat..... 2.3126 p.val...... 0.020743 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 733 > res <- rbind(res,cbind(10,rr$est,rr$se)) > V <- lalonde$age > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=1,Var.calc=0,exact=TRUE, + sample=TRUE); > summary(rr) Estimate... 1.3693 AI SE...... 0.40423 T-stat..... 3.3874 p.val...... 0.00070554 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 169 Matched number of observations (unweighted). 378 Number of obs dropped by 'exact' or 'caliper' 276 > res <- rbind(res,cbind(11,rr$est,rr$se)) > V <- cbind(lalonde$married, lalonde$u74) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=1,Var.calc=0,exact=TRUE, + sample=TRUE); > summary(rr) Estimate... 1.3693 AI SE...... 0.40423 T-stat..... 3.3874 p.val...... 0.00070554 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 169 Matched number of observations (unweighted). 378 Number of obs dropped by 'exact' or 'caliper' 276 > res <- rbind(res,cbind(12,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=1,Var.calc=0,sample=FALSE); > summary(rr) Estimate... 1.7144 AI SE...... 0.74338 T-stat..... 2.3062 p.val...... 0.021098 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 733 > res <- rbind(res,cbind(13,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=1,Var.calc=3,sample=TRUE); > summary(rr) Estimate... 1.7144 AI SE...... 0.69627 T-stat..... 2.4623 p.val...... 0.013806 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 445 Matched number of observations (unweighted). 733 > res <- rbind(res,cbind(14,rr$est,rr$se)) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V,estimand="ATE",M=1,BiasAdj=FALSE,Weight=1,Var.calc=0, + weights=w.educ,sample=TRUE); > summary(rr) Estimate... 3.1470 AI SE...... 1.0709 T-stat..... 2.9386 p.val...... 0.0032973 Original number of observations (weighted)... 661.147 Original number of observations.............. 445 Original number of treated obs (weighted).... 322.71 Original number of treated obs............... 185 Matched number of observations............... 661.147 Matched number of observations (unweighted). 1155 > res <- rbind(res,cbind(15,rr$est,rr$se)) > V <- lalonde$age > Z <- cbind(lalonde$married, lalonde$age) > X <- cbind(lalonde$age, lalonde$educ, lalonde$re74, lalonde$re75) > weight <- w.educ > Weight.matrix <- diag(4) > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V, + sample=FALSE, M=3, estimand="ATT", BiasAdj=TRUE, Weight=3, exact=TRUE,Var.calc=3, + weights=w.educ, Weight.matrix=Weight.matrix); > summary(rr) Estimate... 3.1657 AI SE...... 0.26566 T-stat..... 11.916 p.val...... < 2.22e-16 Original number of observations (weighted)... 661.147 Original number of observations.............. 445 Original number of treated obs (weighted).... 322.71 Original number of treated obs............... 185 Matched number of observations............... 60.015 Matched number of observations (unweighted). 130 Number of obs dropped by 'exact' or 'caliper' 152 Weighted #obs dropped by 'exact' or 'caliper' 262.694 > res <- rbind(res,cbind(75,rr$est,rr$se)) > V <- lalonde$married; > Z <- cbind(lalonde$age, lalonde$re75); > X <- cbind(lalonde$age, lalonde$educ, lalonde$re74); > rr <- Match(Y=Y,Tr=T,X=X,Z=Z,V=V, + sample=TRUE, M=3, estimand="ATE", BiasAdj=TRUE, Weight=2, exact=TRUE,Var.calc=0, + weights=w.educ); > summary(rr) Estimate... 3.5046 AI SE...... 0.57461 T-stat..... 6.099 p.val...... 1.0672e-09 Original number of observations (weighted)... 661.147 Original number of observations.............. 445 Original number of treated obs (weighted).... 322.71 Original number of treated obs............... 185 Matched number of observations............... 135.212 Matched number of observations (unweighted). 305 Number of obs dropped by 'exact' or 'caliper' 366 Weighted #obs dropped by 'exact' or 'caliper' 525.935 > res <- rbind(res,cbind(76,rr$est,rr$se)) > cat("\nResults:\n") Results: > print(res) [,1] [,2] [,3] [1,] 1 1.785191 0.6867167 [2,] 2 1.714407 0.7401292 [3,] 4 1.536303 0.6619304 [4,] 5 1.726913 0.8366296 [5,] 6 1.705509 0.8200959 [6,] 7 1.592617 0.6847298 [7,] 8 1.714407 0.7401292 [8,] 9 1.630915 0.7452336 [9,] 10 1.719687 0.7436085 [10,] 11 1.369289 0.4042281 [11,] 12 1.369289 0.4042281 [12,] 13 1.714407 0.7433846 [13,] 14 1.714407 0.6962724 [14,] 15 3.146960 1.0709149 [15,] 75 3.165660 0.2656573 [16,] 76 3.504580 0.5746139 > > proc.time() user system elapsed 1.584 0.100 1.765