Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: st: Using psmatch2 with a loop for each "neighborhood"

From   "Ariel Linden, DrPH" <>
To   <>
Subject   re: st: Using psmatch2 with a loop for each "neighborhood"
Date   Thu, 21 Oct 2010 09:39:50 -0400


You are asking for an exact match on one of the covariates but using a tool
(propensity score) which is likely but not always, capable of giving you an
exact match on one or more of the covariates. The beauty of propensity
scoring is that it acts as a summary score for many covariates - however it
doesn't guarantee that every match will be exact (as you've experienced
yourself with neighbourhood). On average they will, but not necessarily at
the individual match level.

Since you specifically want exact matches on certain covariates, you are
better off using algorithms that match on covariates and not on the
propensity score.

One excellent program is a user written program called -cem- that performs
coarsened exact matching that allows you to determine the "exactness" in the
matching you use for each covariate and allows you to perform exact matching
on variables as well. So in this case, you would use neighborhood(#0)which
would give you an exact match.

I hope this helps


Date: Wed, 20 Oct 2010 17:48:56 -0400
From: "Benhoen2" <>
Subject: st: Using psmatch2 with a loop for each "neighborhood"

Hello wise statalisters,

I have a set of data (home transaction data) that spans multiple
"neighborhoods".  I am hoping to use the psmatch2 command to allow me to
match like cases in each "neighborhood" that either have or do not have
energy efficiency (ee).  (This would be the same procedure appraisers would
use in picking a comparable home.) I have a set of basic questions and them
some more advanced questions about this process, which, I suspect, you will
make quick work of.  Also, I will admit, that I might be way out of my
league in using this command and looping to do this task.

Background:  The covariates (indepvars) that I am using to match the cases
on are number of sqft (sqft), number of acres (acre), age of the home (age),
and date of sale (sd).  The treatment (depvar) is ee.  The "neighborhood",
for the purposes of this email, is census block group (blkgrp). (FYI blkgrp
is an integer with consecutive values for each unique blkgrp in the
dataset). I tried the following:

. psmatch2 ee sqft acre age blkgrp

This produced a matched set (treated & non-treated) but in many cases this
matching was done with two homes in different neighborhoods.  I want
matching to be restricted to a neighborhood so that possible matches for
treated homes will only be drawn from the same neighborhood in which they
are located. (Ideally I would be able to create a spatial matrix so that
"nearest neighbors" could be delineated, but I do not have x/y coordinates
in the data.  Moreover, if I did, I do not understand currently how to use
psmatch2 to do that.  Another email...)

So here are the basic questions: Can psmatch2 be restricted to making
matches to the neighborhood without creating a loop?  If not, is there
another match command that can?  If so, how would I amend my command to
accommodate the "neighborhood" restriction?

Assuming this cannot be done in a "one-stop" way, I envisioned a loop, but
am such a novice that I wasn't able to get even anything basic to run. So
these are the advanced questions:  Can a loop be utilized for this purpose?
How can I step between blkgrps in the loop (e.g., do I use "foreach")?  Any
advice on how to save off _weight or _n1 for each blkgrp?  I     suspect I
will need to name them with a blkgrp prefix.  

If it matters I am running Stata SE 11.1 on a Windows 7 64 bit box.

Thanks, very much, for the help, and for tolerating such basic questions.
(I am learning a tremendous amount from you statlisters.)


*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index