Gary King Homepage Previous: Conducting Analyses after Matching Up: Conducting Analyses after Matching Next: Examples

Quick Overview

The general syntax is as follows. First, we use match.data() to create the matched data from the MATCHIT output object (m.out) by excluding unmatched units from the original data, and including information produced by the particular matching procedure (i.e., primarily a new data set, but also information that may result such as weights, subclasses, or the distance measure).

> m.data <- match.data(m.out)
where m.data is the resulting matched data. Zelig analyses all use three commands -- zelig, setx, and sim. For example, the basic statistical analysis is performed first:
> z.out <- zelig(Y ~ treat + x1 + x2, model = mymodel, data = m.data)
where Y is the outcome variable, mymodel is the selected model, and z.out is the output object from zelig. This output object includes estimated coefficients, standard errors, and other typical outputs from your chosen statistical model. Its contents can be examined via summary(z.out) or plot(z.out), but the idea of Zelig is that these statistical results are typically only intermediate quantities needed to compute your ultimate quantities of interest, which in the case of matching are usually causal inferences. To get these causal quantities, we use Zelig's other two commands. Thus, we can set the explanatory variables at their means (the default) and change the treatment variable from a 0 to a 1:
> x.out <- setx(z.out, treat=0)
> x1.out <- setx(z.out, treat=1)
and finally compute the resulting estimates of the causal effects and examine a summary:
> s.out <- sim(z.out, x = x.out, x1 = x1.out)
> summary(s.out)



Gary King 2010-12-11