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 at the end of May, and its replacement, statalist.org is already up and running.


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

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


From   "Benhoen2" <benhoen2@earthlink.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Using psmatch2 with a loop for each "neighborhood"
Date   Wed, 20 Oct 2010 17:48:56 -0400

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.)

Ben

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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