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 Dehejia and Wahba psid3 model > # > # Dehejia, Rajeev and Sadek Wahba. 1999.``Causal Effects in Non-Experimental Studies: Re-Evaluating the > # Evaluation of Training Programs.''Journal of the American Statistical Association 94 (448): 1053-1062. > # > > 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(DehejiaWahba) demo(DehejiaWahba) ---- ~~~~~~~~~~~~ > # Replication of Dehejia and Wahba psid3 model. > > # Dehejia, Rajeev and Sadek Wahba. 1999.``Causal Effects in > # Non-Experimental Studies: Re-Evaluating the # Evaluation of Training > # Programs.''Journal of the American Statistical Associati .... [TRUNCATED] > data(lalonde) > # > # Estimate the propensity model > # > glm1 <- glm(treat~age + I(age^2) + educ + I(educ^2) + black + + hisp + married + nodegr + re74 + I(re74^2) + re75 + I(re75^2) + + u74 + u75, family=binomial, data=lalonde) > # > #save data objects > # > X <- glm1$fitted > Y <- lalonde$re78 > Tr <- lalonde$treat > # > # one-to-one matching with replacement (the "M=1" option). > # Estimating the treatment effect on the treated (the "estimand" option which defaults ATT). > # > rr <- Match(Y=Y,Tr=Tr,X=X,M=1); > summary(rr) Estimate... 2153.3 AI SE...... 825.4 T-stat..... 2.6088 p.val...... 0.0090858 Original number of observations.............. 445 Original number of treated obs............... 185 Matched number of observations............... 185 Matched number of observations (unweighted). 346 > # > # Let's check for balance > # > mb <- MatchBalance(treat~age + I(age^2) + educ + I(educ^2) + black + + hisp + married + nodegr + re74 + I(re74^2) + re75 + I(re75^2) + + u74 + u75, data=lalonde, match.ou .... [TRUNCATED] ***** (V1) age ***** Before Matching After Matching mean treatment........ 25.816 25.816 mean control.......... 25.054 25.006 std mean diff......... 10.655 11.317 mean raw eQQ diff..... 0.94054 0.41618 med raw eQQ diff..... 1 0 max raw eQQ diff..... 7 9 mean eCDF diff........ 0.025364 0.010597 med eCDF diff........ 0.022193 0.0086705 max eCDF diff........ 0.065177 0.049133 var ratio (Tr/Co)..... 1.0278 1.0662 T-test p-value........ 0.26594 0.23472 KS Bootstrap p-value.. 0.53 0.57 KS Naive p-value...... 0.7481 0.7978 KS Statistic.......... 0.065177 0.049133 ***** (V2) I(age^2) ***** Before Matching After Matching mean treatment........ 717.4 717.4 mean control.......... 677.32 673.08 std mean diff......... 9.2937 10.275 mean raw eQQ diff..... 56.076 28.948 med raw eQQ diff..... 43 0 max raw eQQ diff..... 721 909 mean eCDF diff........ 0.025364 0.010597 med eCDF diff........ 0.022193 0.0086705 max eCDF diff........ 0.065177 0.049133 var ratio (Tr/Co)..... 1.0115 0.91516 T-test p-value........ 0.33337 0.31819 KS Bootstrap p-value.. 0.53 0.57 KS Naive p-value...... 0.7481 0.7978 KS Statistic.......... 0.065177 0.049133 ***** (V3) educ ***** Before Matching After Matching mean treatment........ 10.346 10.346 mean control.......... 10.088 10.480 std mean diff......... 12.806 -6.6749 mean raw eQQ diff..... 0.40541 0.16185 med raw eQQ diff..... 0 0 max raw eQQ diff..... 2 2 mean eCDF diff........ 0.028698 0.011561 med eCDF diff........ 0.012682 0.0086705 max eCDF diff........ 0.12651 0.052023 var ratio (Tr/Co)..... 1.5513 1.1917 T-test p-value........ 0.15017 0.45021 KS Bootstrap p-value.. < 2.22e-16 0.36 KS Naive p-value...... 0.062873 0.73726 KS Statistic.......... 0.12651 0.052023 ***** (V4) I(educ^2) ***** Before Matching After Matching mean treatment........ 111.06 111.06 mean control.......... 104.37 113.21 std mean diff......... 17.012 -5.466 mean raw eQQ diff..... 8.719 3.1098 med raw eQQ diff..... 0 0 max raw eQQ diff..... 60 60 mean eCDF diff........ 0.028698 0.011561 med eCDF diff........ 0.012682 0.0086705 max eCDF diff........ 0.12651 0.052023 var ratio (Tr/Co)..... 1.6625 1.2716 T-test p-value........ 0.053676 0.51046 KS Bootstrap p-value.. < 2.22e-16 0.36 KS Naive p-value...... 0.062873 0.73726 KS Statistic.......... 0.12651 0.052023 ***** (V5) black ***** Before Matching After Matching mean treatment........ 0.84324 0.84324 mean control.......... 0.82692 0.85946 std mean diff......... 4.4767 -4.4482 mean raw eQQ diff..... 0.016216 0.0086705 med raw eQQ diff..... 0 0 max raw eQQ diff..... 1 1 mean eCDF diff........ 0.0081601 0.0043353 med eCDF diff........ 0.0081601 0.0043353 max eCDF diff........ 0.016320 0.0086705 var ratio (Tr/Co)..... 0.92503 1.0943 T-test p-value........ 0.64736 0.57783 ***** (V6) hisp ***** Before Matching After Matching mean treatment........ 0.05946 0.05946 mean control.......... 0.10769 0.048649 std mean diff......... -20.341 4.5591 mean raw eQQ diff..... 0.048649 0.0057803 med raw eQQ diff..... 0 0 max raw eQQ diff..... 1 1 mean eCDF diff........ 0.024116 0.0028902 med eCDF diff........ 0.024116 0.0028902 max eCDF diff........ 0.048233 0.0057803 var ratio (Tr/Co)..... 0.58288 1.2083 T-test p-value........ 0.064043 0.41443 ***** (V7) married ***** Before Matching After Matching mean treatment........ 0.18919 0.18919 mean control.......... 0.15385 0.16667 std mean diff......... 8.9995 5.735 mean raw eQQ diff..... 0.037838 0.017341 med raw eQQ diff..... 0 0 max raw eQQ diff..... 1 1 mean eCDF diff........ 0.017672 0.0086705 med eCDF diff........ 0.017672 0.0086705 max eCDF diff........ 0.035343 0.017341 var ratio (Tr/Co)..... 1.1802 1.1045 T-test p-value........ 0.33425 0.46741 ***** (V8) nodegr ***** Before Matching After Matching mean treatment........ 0.70811 0.70811 mean control.......... 0.83462 0.69189 std mean diff......... -27.751 3.5572 mean raw eQQ diff..... 0.12432 0.014451 med raw eQQ diff..... 0 0 max raw eQQ diff..... 1 1 mean eCDF diff........ 0.063254 0.0072254 med eCDF diff........ 0.063254 0.0072254 max eCDF diff........ 0.12651 0.014451 var ratio (Tr/Co)..... 1.4998 0.96957 T-test p-value........ 0.0020368 0.49161 ***** (V9) re74 ***** Before Matching After Matching mean treatment........ 2095.6 2095.6 mean control.......... 2107.0 1624.3 std mean diff......... -0.23437 9.644 mean raw eQQ diff..... 487.98 467.33 med raw eQQ diff..... 0 0 max raw eQQ diff..... 8413 12410 mean eCDF diff........ 0.019223 0.019782 med eCDF diff........ 0.015800 0.018786 max eCDF diff........ 0.047089 0.046243 var ratio (Tr/Co)..... 0.7381 2.2663 T-test p-value........ 0.98186 0.22745 KS Bootstrap p-value.. 0.58 0.32 KS Naive p-value...... 0.97023 0.8532 KS Statistic.......... 0.047089 0.046243 ***** (V10) I(re74^2) ***** Before Matching After Matching mean treatment........ 28141434 28141434 mean control.......... 36667413 13117852 std mean diff......... -7.4721 13.167 mean raw eQQ diff..... 13311731 10899373 med raw eQQ diff..... 0 0 max raw eQQ diff..... 365146387 616156569 mean eCDF diff........ 0.019223 0.019782 med eCDF diff........ 0.015800 0.018786 max eCDF diff........ 0.047089 0.046243 var ratio (Tr/Co)..... 0.50382 7.9006 T-test p-value........ 0.51322 0.08604 KS Bootstrap p-value.. 0.58 0.32 KS Naive p-value...... 0.97023 0.8532 KS Statistic.......... 0.047089 0.046243 ***** (V11) re75 ***** Before Matching After Matching mean treatment........ 1532.1 1532.1 mean control.......... 1266.9 1297.6 std mean diff......... 8.2363 7.2827 mean raw eQQ diff..... 367.61 211.42 med raw eQQ diff..... 0 0 max raw eQQ diff..... 2110.2 8195.6 mean eCDF diff........ 0.050834 0.023047 med eCDF diff........ 0.061954 0.023121 max eCDF diff........ 0.10748 0.057803 var ratio (Tr/Co)..... 1.0763 1.4291 T-test p-value........ 0.38527 0.33324 KS Bootstrap p-value.. 0.04 0.15 KS Naive p-value...... 0.16449 0.60988 KS Statistic.......... 0.10748 0.057803 ***** (V12) I(re75^2) ***** Before Matching After Matching mean treatment........ 12654753 12654753 mean control.......... 11196530 8896263 std mean diff......... 2.6024 6.7076 mean raw eQQ diff..... 2840830 2887443 med raw eQQ diff..... 0 0 max raw eQQ diff..... 101657197 344942969 mean eCDF diff........ 0.050834 0.023047 med eCDF diff........ 0.061954 0.023121 max eCDF diff........ 0.10748 0.057803 var ratio (Tr/Co)..... 1.4609 3.559 T-test p-value........ 0.77178 0.37741 KS Bootstrap p-value.. 0.04 0.15 KS Naive p-value...... 0.16449 0.60988 KS Statistic.......... 0.10748 0.057803 ***** (V13) u74 ***** Before Matching After Matching mean treatment........ 0.70811 0.70811 mean control.......... 0.75 0.68458 std mean diff......... -9.1895 5.1608 mean raw eQQ diff..... 0.037838 0.017341 med raw eQQ diff..... 0 0 max raw eQQ diff..... 1 1 mean eCDF diff........ 0.020946 0.0086705 med eCDF diff........ 0.020946 0.0086705 max eCDF diff........ 0.041892 0.017341 var ratio (Tr/Co)..... 1.1041 0.95721 T-test p-value........ 0.33033 0.52298 ***** (V14) u75 ***** Before Matching After Matching mean treatment........ 0.6 0.6 mean control.......... 0.68462 0.62072 std mean diff......... -17.225 -4.2182 mean raw eQQ diff..... 0.081081 0.031792 med raw eQQ diff..... 0 0 max raw eQQ diff..... 1 1 mean eCDF diff........ 0.042308 0.015896 med eCDF diff........ 0.042308 0.015896 max eCDF diff........ 0.084615 0.031792 var ratio (Tr/Co)..... 1.1133 1.0194 T-test p-value........ 0.06803 0.46507 Before Matching Minimum p.value: < 2.22e-16 Variable Name(s): educ I(educ^2) Number(s): 3 4 After Matching Minimum p.value: 0.08604 Variable Name(s): I(re74^2) Number(s): 10 > > proc.time() user system elapsed 2.500 0.056 2.565