Package MatchIt. April 18, 2017

Similar documents
Package fastdummies. January 8, 2018

Package vinereg. August 10, 2018

Package MatchingFrontier

Package datasets.load

Package strat. November 23, 2016

Package bisect. April 16, 2018

Package glmnetutils. August 1, 2017

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package CMatching. R topics documented:

Package raker. October 10, 2017

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package ECctmc. May 1, 2018

Package postgistools

Package robotstxt. November 12, 2017

Journal of Statistical Software

Package canvasxpress

Package modmarg. R topics documented:

Package censusapi. August 19, 2018

Package CausalGAM. October 19, 2017

Package epitab. July 4, 2018

Package OLScurve. August 29, 2016

WhatIf: Software for Evaluating Counterfactuals 1

Package nngeo. September 29, 2018

Package quickreg. R topics documented:

Package InformativeCensoring

Package RODBCext. July 31, 2017

Package avirtualtwins

Package spark. July 21, 2017

Package rpst. June 6, 2017

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package optimus. March 24, 2017

Package SAMUR. March 27, 2015

Package sure. September 19, 2017

Package QCAtools. January 3, 2017

Package bife. May 7, 2017

Package apastyle. March 29, 2017

Package simsurv. May 18, 2018

Package sigqc. June 13, 2018

Package clipr. June 23, 2018

Package anesrake. April 28, 2018

Package PTE. October 10, 2017

Package repec. August 31, 2018

Package mdftracks. February 6, 2017

Package comparedf. February 11, 2019

Package splithalf. March 17, 2018

Package kirby21.base

Package BiocManager. November 13, 2018

Package samplesizecmh

Package CorporaCoCo. R topics documented: November 23, 2017

Package oasis. February 21, 2018

Package barcoder. October 26, 2018

Package permuco. February 14, Type Package

Package CALIBERrfimpute

Package bayesdp. July 10, 2018

Package lumberjack. R topics documented: July 20, 2018

Package bestnormalize

Package simr. April 30, 2018

Package MOST. November 9, 2017

Package oaxaca. January 3, Index 11

Package panelview. April 24, 2018

Package readxl. April 18, 2017

Package clusterpower

Package sparsereg. R topics documented: March 10, Type Package

Package packcircles. April 28, 2018

Package ClusterBootstrap

Package colf. October 9, 2017

Package spcadjust. September 29, 2016

Package omu. August 2, 2018

Package svalues. July 15, 2018

Package TestDataImputation

Package Cubist. December 2, 2017

Package PCADSC. April 19, 2017

Package phrasemachine

Package nonlinearicp

Package truncreg. R topics documented: August 3, 2016

Package Rtsne. April 14, 2017

Package chunked. July 2, 2017

Package manet. September 19, 2017

Package tiler. June 9, 2018

Package cobalt. August 14, 2018

Package gtrendsr. August 4, 2018

Package ompr. November 18, 2017

Package deductive. June 2, 2017

Package texteffect. November 27, 2017

Package areal. December 31, 2018

Package auctestr. November 13, 2017

Package coga. May 8, 2018

Package BiDimRegression

Package clustvarsel. April 9, 2018

Package rprojroot. January 3, Title Finding Files in Project Subdirectories Version 1.3-2

Package rbounds. February 20, 2015

Package inca. February 13, 2018

Package validara. October 19, 2017

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package fst. December 18, 2017

Package messaging. May 27, 2018

Package IATScore. January 10, 2018

Package githubinstall

Package fcr. March 13, 2018

Package GFD. January 4, 2018

Transcription:

Version 3.0.1 Date 2017-04-18 Package MatchIt April 18, 2017 Title Nonparametric Preprocessing for Parametric Casual Inference Selects matched samples of the original treated and control groups with similar covariate distributions -- can be used to match exactly on covariates, to match on propensity scores, or perform a variety of other matching procedures. The package also implements a series of recommendations offered in Ho, Imai, King, and Stuart (2007) <DOI:10.1093/pan/mpl013>. Maintainer Kosuke Imai <kimai@princeton.edu> Depends R (>= 2.6) Imports MASS, Matching, rgenoud Suggests cem, nnet, optmatch, rpart, mgcv, WhatIf, R.rsp, testthat VignetteBuilder R.rsp LazyLoad yes LazyData yes License GPL (>= 2) URL http://gking.harvard.edu/matchit RoxygenNote 5.0.1 NeedsCompilation no Author Daniel Ho [aut], Kosuke Imai [aut, cre], Gary King [aut], Elizabeth Stuart [aut], Alex Whitworth [ctb] Repository CRAN Date/Publication 2017-04-18 13:04:21 UTC 1

2 get_matches R topics documented: get_matches......................................... 2 help.matchit......................................... 3 is.matchit.......................................... 3 lalonde............................................ 4 match.data.......................................... 4 matchit........................................... 5 user.prompt......................................... 8 Index 9 get_matches Get matches from matchit object Get the resulting matches from a matchit model object. This function allows the user to extract the matches from the original dataset used in model building or from a new dataset that has a matching set of key column(s) (id_cols). get_matches(object, model_frame, id_cols = NULL, newdata = NULL) object model_frame id_cols newdata The 'matchit' class model object The 'data.frame' class object used in creation of object. A string indicating the ID for the datset used in the call to matchit. This can be used in combination with newdata to return the base dataset. Defaults to NULL. A new data.frame object to extract matched observations from. Used in conjunction with id_cols. Defaults to NULL. Value If newdata is NULL, a subset of model_frame containing the rows corresponding to the matched treatement and control observations with weights appended. If newdata is not NULL, an equivalent subset of newdata is returned.

help.matchit 3 help.matchit HTML Help for Matchit Commands and Models The help.matchit command launches html help for Matchit commands and supported methods. The full manual is available online at http://gking.harvard.edu/matchit. help.matchit(object) object a character string representing a Matchit command or model. help.matchit("command") will take you to an index of Matchit commands and help.matchit("method") will take you to a list of matching methods. The following inputs are currently available: exact, nearest, subclass, full, optimal. Author(s) Daniel Ho <<daniel.ho@yale.edu>>; Kosuke Imai <<kimai@princeton.edu>>; Gary King <<king@harvard.edu>>; Elizabeth Stuart<<estuart@jhsph.edu>> See Also The complete document is available online at http://gking.harvard.edu/matchit. is.matchit Checks matchit Class Function that checks if the target object is a matchit object. is.matchit(object) object any R object Value Returns TRUE if its argument has class "matchit" among its classes and FALSE otherwise.

4 match.data lalonde Data from National Supported Work Demonstration and PSID, as analyzed by Dehejia and Wahba (1999). This is a subsample of the data from the treated group in the National Supported Work Demonstration (NSW) and the comparison sample from the Current Population Survey (CPS). This data was previously analyzed extensively by Lalonde (1986) and Dehejia and Wahba (1999). data(lalonde) Format A data frame with 313 observations (185 treated, 429 control). There are 10 variables measured for each individual. "treat" is the treatment assignment (1=treated, 0=control). "age" is age in years. "educ" is education in number of years of schooling. "black" is an indicator for African-American (1=African-American, 0=not). "hispan" is an indicator for being of Hispanic origin (1=Hispanic, 0=not). "married" is an indicator for married (1=married, 0=not married). "nodegree" is an indicator for whether the individual has a high school degree (1=no degree, 0=degree). "re74" is income in 1974, in U.S. dollars. "re75" is income in 1975, in U.S. dollars. "re78" is income in 1978, in U.S. dollars. References Lalonde, R. (1986). Evaluating the econometric evaluations of training programs with experimental data. American Economic Review 76: 604-620. Dehejia, R.H. and Wahba, S. (1999). Causal Effects in Nonexperimental Studies: Re-Evaluating the Evaluation of Training Programs. Journal of the American Statistical Association 94: 1053-1062. match.data Output Matched Data Sets match.data outputs matched data sets from matchit(). match.data(object, group="all", distance = "distance", weights = "weights", subclass = "subclass")

matchit 5 object group distance weights subclass The output object from matchit. This is a required input. This argument specifies for which matched group the user wants to extract the data. Available options are "all" (all matched units), "treat" (matched units in the treatment group), and "control" (matched units in the control group). The default is "all". This argument specifies the variable name used to store the distance measure. The default is "distance". This argument specifies the variable name used to store the resulting weights from matching. The default is "weights". This argument specifies the variable name used to store the subclass indicator. The default is "subclass". Value Returns a subset of the original data set sent to matchit(), with just the matched units. The data set also contains the additional variables distance, weights, and subclass. The variable distance gives the estimated distance measure, and weights gives the weights for each unit, generated in the matching procedure. The variable subclass gives the subclass index for each unit (if applicable). See the http://gking.harvard.edu/matchit/ for the complete documentation and type demo(match.data) at the R prompt to see a demonstration of the code. Author(s) Daniel Ho <daniel.ho@yale.edu>; Kosuke Imai <kimai@princeton.edu>; Gary King <king@harvard.edu>; Elizabeth Stuart <estuart@jhsph.edu> See Also Please use help.matchit to access the matchit reference manual. The complete document is available online at http://gking.harvard.edu/matchit. matchit MatchIt: Matching Software for Causal Inference matchit is the main command of the package MatchIt, which enables parametric models for causal inference to work better by selecting well-matched subsets of the original treated and control groups. MatchIt implements the suggestions of Ho, Imai, King, and Stuart (2004) for improving parametric statistical models by preprocessing data with nonparametric matching methods. MatchIt implements a wide range of sophisticated matching methods, making it possible to greatly reduce the dependence of causal inferences on hard-to-justify, but commonly made, statistical modeling assumptions. The software also easily fits into existing research practices since, after preprocessing with MatchIt, researchers can use whatever parametric model they would have used without MatchIt, but produce inferences with substantially more robustness and less sensitivity

6 matchit to modeling assumptions. Matched data sets created by MatchIt can be entered easily in Zelig (http://gking.harvard.edu/zelig) for subsequent parametric analyses. Full documentation is available online at http://gking.harvard.edu/matchit, and help for specific commands is available through help.matchit. matchit(formula, data, method = "nearest", distance = "logit", distance.options = list(), discard = "none", reestimate = FALSE,...) formula data method distance This argument takes the usual syntax of R formula, treat ~ x1 + x2, where treat is a binary treatment indicator and x1 and x2 are the pre-treatment covariates. Both the treatment indicator and pre-treatment covariates must be contained in the same data frame, which is specified as data (see below). All of the usual R syntax for formula works. For example, x1:x2 represents the first order interaction term between x1 and x2, and I(x1^2) represents the square term of x1. See help(formula) for details. This argument specifies the data frame containing the variables called in formula. This argument specifies a matching method. Currently, "exact" (exact matching), "full" (full matching), "genetic" (genetic matching), "nearest" (nearest neighbor matching), "optimal" (optimal matching), and "subclass" (subclassification) are available. The default is "nearest". Note that within each of these matching methods, MatchIt offers a variety of options. This argument specifies the method used to estimate the distance measure. The default is logistic regression, "logit". A variety of other methods are available. distance.options This optional argument specifies the optional arguments that are passed to the model for estimating the distance measure. The input to this argument should be a list. discard reestimate This argument specifies whether to discard units that fall outside some measure of support of the distance score before matching, and not allow them to be used at all in the matching procedure. Note that discarding units may change the quantity of interest being estimated. The options are: "none" (default), which discards no units before matching, "both", which discards all units (treated and control) that are outside the support of the distance measure, "control", which discards only control units outside the support of the distance measure of the treated units, and "treat", which discards only treated units outside the support of the distance measure of the control units. This argument specifies whether the model for distance measure should be reestimated after units are discarded. The input must be a logical value. The default is FALSE.... Additional arguments to be passed to a variety of matching methods.

matchit 7 Details The matching is done using the matchit(treat ~ X,...) command, where treat is the vector of treatment assignments and X are the covariates to be used in the matching. There are a number of matching options, detailed below. The full syntax is matchit(formula, data=null, discard=0, exact=false, replace A summary of the results can be seen graphically using plot(matchitobject), or numerically using summary(matchitobject). print(matchitobject) also prints out the output. Value call formula model match.matrix discarded distance weights subclass q.cut treat X nn The original matchit call. The formula used to specify the model for estimating the distance measure. The output of the model used to estimate the distance measure. summary(m.out$model) will give the summary of the model where m.out is the output object from matchit. An n 1 by ratio matrix where the row names, which can be obtained through row.names(match.matrix), represent the names of the treatment units, which come from the data frame specified in data. Each column stores the name(s) of the control unit(s) matched to the treatment unit of that row. For example, when the ratio input for nearest neighbor or optimal matching is specified as 3, the three columns of match.matrix represent the three control units matched to one treatment unit). NA indicates that the treatment unit was not matched. A vector of length $n$ that displays whether the units were ineligible for matching due to common support restrictions. It equals TRUE if unit i was discarded, and it is set to FALSE otherwise. A vector of length n with the estimated distance measure for each unit. A vector of length n that provides the weights assigned to each unit in the matching process. Unmatched units have weights equal to 0. Matched treated units have weight 1. Each matched control unit has weight proportional to the number of treatment units to which it was matched, and the sum of the control weights is equal to the number of uniquely matched control units. The subclass index in an ordinal scale from 1 to the total number of subclasses as specified in subclass (or the total number of subclasses from full or exact matching). Unmatched units have NA. The subclass cut-points that classify the distance measure. The treatment indicator from data (the left-hand side of formula). The covariates used for estimating the distance measure (the right-hand side of formula). A basic summary table of matched data (e.g., the number of matched units) Author(s) Daniel Ho <daniel.ho@yale.edu>; Kosuke Imai <kimai@princeton.edu>; Gary King <king@harvard.edu>; Elizabeth Stuart<estuart@jhsph.edu>

8 user.prompt References Daniel Ho, Kosuke Imai, Gary King, and Elizabeth Stuart (2007). Matching as Nonparametric Preprocessing for Reducing Model Dependence in Parametric Causal Inference. Political Analysis 15(3): 199-236. http://gking.harvard.edu/files/abs/matchp-abs.shtml See Also Please use help.matchit to access the matchit reference manual. The complete document is available online at http://gking.harvard.edu/matchit. user.prompt Pause in demo files Use user.prompt while writing demo files to force users to hit return before continuing. user.prompt() Author(s) See Also Olivia Lau <olau@fas.harvard.edu> readline Examples ## Not run: user.prompt() ## End(Not run)

Index Topic datasets lalonde, 4 Topic documentation help.matchit, 3 Topic environment matchit, 5 Topic file user.prompt, 8 Topic methods match.data, 4 get_matches, 2 help.matchit, 3 is.matchit, 3 lalonde, 4 match.data, 4 MatchIt (matchit), 5 Matchit (matchit), 5 matchit, 2, 5 user.prompt, 8 9