Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: nnmatch error in PSM
From
Katherine Picho <[email protected]>
To
[email protected]
Subject
Re: st: nnmatch error in PSM
Date
Thu, 12 Sep 2013 16:07:23 -0400
Thank you sooo much, Joe!
Best,
On Thu, Sep 12, 2013 at 2:55 PM, Joe Canner <[email protected]> wrote:
> Katherine,
>
> -psmatch2- creates several new variables that should help you with this:
>
> _weight: weight of matched controls
> _id: an identifier created by the program (you can probably specify one instead if you wish)
> _n1: ID of nearest neighbor
> _nn: # of matched neighbors
>
> In the case of a 1:1 match you can save all cases with _weight==1. The _id and _n1 variables can be used to see exactly who matched with whom if necessary.
>
> Regards,
> Joe
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Katherine Picho
> Sent: Thursday, September 12, 2013 2:38 PM
> To: [email protected]
> Subject: Re: st: nnmatch error in PSM
>
> Hello again Ariel, Joe
>
> (and anyone else who knows about psmatch2)
>
> I'm using stata12 IC.
>
> I have 3500 observations in my treatment and 10k control observations.
> I want to conduct 1:1 matching to get the best matches for my 3500
> treatments this pool of 10,000 controls, and then save the new dataset (a subset of the original) that would contain only the 1:1 matched cases (thus ending up with a total sample of 7k observations; 1/2 trtment, 1/2 ctrl).
>
> My question is:
>
> I have looked at the psmatch2 detailed syntax but do not see any options for creating such a new dataset from the original. Does it exist and am I missing something, or this feature not yet available?
> thanks!
>
> Katherine.
>
>
> On Thu, Sep 12, 2013 at 1:30 PM, Katherine Picho <[email protected]> wrote:
>> Hi Ariel
>>
>> Im only 2 days new to the stata list (& still familiarizing myself
>> with the etiquette) so if my reference to stata as 'STATA' proved
>> offensive to you and everyone else on the listserv, I apologize. your
>> correction is duly noted.
>>
>> I am using stata12 IC, and I obtained nnmatch by typing ssc install
>> nnmatch in stata 12.
>>
>> thank you for your recommendations and for the link above. I will take
>> a look and follow your leads.
>>
>> Best,
>>
>> On Thu, Sep 12, 2013 at 11:20 AM, Ariel Linden, DrPH
>> <[email protected]> wrote:
>>> Katherine,
>>>
>>> Posters to the Statalist are asked to indicate which program they are
>>> using and where they got it from. In this case, you reference
>>> -nnmatch- which is a user written program found at http://www.stata-journal.com/software/sj4-3.
>>>
>>> This is not intended to be an academic exercise or "busy-work". In
>>> fact, it serves an important purpose. In Stata v13, there is a
>>> built-in program - teffects nnmatch- that is based on the original
>>> -nnmatch- but with some differences. Thus, others on this list have
>>> no idea which of these programs you are referring to (let alone that
>>> you did not indicate which version of Stata you are using (other than stating IC).
>>>
>>> Moreover, as a note of reference, it is "Stata" not "STATA".
>>>
>>> As to your problem, you should review your memory settings. In Stata
>>> v13, the settings are as follows (they are slightly different than in
>>> prior
>>> versions):
>>>
>>> set maxvar # [, permanently]
>>> set niceness # [, permanently]
>>> set min_memory amt [, permanently]
>>> set max_memory amt [, permanently]
>>> set segmentsize amt [, permanently]
>>>
>>> As for -psmatch2- (http://fmwww.bc.edu/RePEc/bocode/p), it can indeed
>>> perform matching with and without replacement. Note that -nnmatch-
>>> performs variable matching whereas -psmatch2- will allow you to
>>> perform both variable matching and propensity score matching.
>>>
>>> I hope this helps
>>>
>>> Ariel
>>>
>>> Date: Wed, 11 Sep 2013 10:25:25 -0400
>>> From: Katherine Picho <[email protected]>
>>> Subject: st: nnmatch error in PSM
>>>
>>> Hi all
>>>
>>> I'm currently attempting propensity score matching with nearest
>>> neighbor using the nnmatch.
>>>
>>> However, at some point in running my ado file, STATA returns an error
>>> message: "Insufficient memory to create more variables:Either
>>> increase memory or decrease m"
>>>
>>> I only have about 290 variables in the current dataset (21k observations).
>>> I'm only matching using 3 variables. I'm using STATA IC and the max #
>>> var is 2048 (which is way more that I could ever use for this
>>> specific purpose).
>>>
>>> Even when I reduce the dataset to only 40 variables, and still match
>>> on the 3 variables of interest, the problem/ error code remains the
>>> same.
>>> I have 3615 treatment observations that I'd like to match from a pool
>>> of about 16,500 controls (so theoretically this should not be a
>>> problem)
>>> My matching variables are categorical
>>>
>>> the nnmatch command that I run (where I run into trouble) is:
>>>
>>> nnmatch Depvar trtmt pscore, tc(att) m(1) keep(matched_att) replace
>>>
>>> this is where it generates the error message.
>>>
>>> I tried to remedy potential memory problems like- compressing the
>>> data/ variables. expanding the memory. (help query, within stata
>>> itself), etc, Nothing works. A search on the statalist archives
>>> indicates that a few people have run into the same problems using
>>> nnmatch-- but none of the queries I found had received any responses
>>> on how to fix the problem.
>>>
>>> If anyone here has run into a similar issue that they were able to
>>> fix, please let me know. Thanks!
>>>
>>> Katherine
>>> *
>>>
>>>
>>>
>>>
>>> *
>>> * For searches and help try:
>>> * http://www.stata.com/help.cgi?search
>>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>>> * http://www.ats.ucla.edu/stat/stata/
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/