Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Propensity score matching code r(198)

    Hi there , I'm practicing propensity scores and propensity score matching.

    with regards to data:
    I used this data:

    webuse cattaneo2


    Research question:
    Does alochol effect birth weight in kids?
    Matching on: maternal age, maternal education, maternal smoking.

    Problem is with propensity score matching code -
    A. why does it give me the error below?


    psmatch2 $treatment $xlist , outcome($ylist) pscore(myscore) neighbor(5) common bw(0.06)
    You cannot specify both a varlist AND a propensity score
    r(198);

    If pscore(x) - x = varname containing propensity scores why is stata giving me the error above

    B. Why does attnd work and this is not the recommended way on stata?

    TO GIVE YOU A BACKGROUN THIS IS THE CODE I USED;
    ___

    **Creating macros
    global treatment alcohol //intervention/treatment
    global ylist bweight //outcome
    global xlist mage medu msmoke //variables to match on t

    *Creating a regression with the dummy variable for treatment (intervention which has to be 1 or 0)

    reg $ylist $treatment
    //y vairable (outcome variable) followed by treatment

    *Creating a regression but now controlling for cofounding
    reg $ylist $treatment $xlist

    //Estimate propensity scores
    pscore $treatment $xlist,pscore(myscore)blockid(myblock)comsup

    probit regression

    *****MATCHING *****

    Now I looked for stata help which says that neighbour hood matching should have this format


    With this example:
    psmatch2 depvar [indepvars] [if exp] [in range] , [outcome(varlist) pscore(varname) neighbor(integer k>1)
    caliper(real) common trim(real) odds index logit ties warnings quietly ate]

    Stata given this example: psmatch2 training age gender, n(5) logit


    NOW i tried:

    psmatch2 $treatment $xlist , outcome($ylist) pscore(myscore) neighbor(5) common bw(0.06)

    eRROR given
    You cannot specify both a varlist AND a propensity score
    r(198);

    $treatment - Alcohol
    $xlist - variables to match on
    $ylist - b weight - outcome
    myscore - already calculated propensity scores.

    Why does it give me the above error?

    Also:

    I have also used:
    attnd $ylist $treatment $xlist, pscore(myscore)

    This also gave me my propenisty scores between 0.1253 - 0.209.

    Questions:
    1. Why do I get the above error using the technique recommended by stata
    2. Why does attnd work and this is not the recommended way on stata?

  • #2
    David Radwin just wondering if you could help here.

    I also tried the following the code without : pscore(myscore) neighbor(5) common bw(0.06)
    psmatch2 $treatment $xlist , outcome($ylist)

    And I obtained a result, but why does stata give me an error r(198) when I use the code below

    psmatch2 $treatment $xlist , outcome($ylist) pscore(myscore) neighbor(5) common bw(0.06)



    Comment


    • #3
      I think the error message "You cannot specify both a varlist AND a propensity score" sums it up. The user-written program psmatch2 (Leuven & Sianesi, available from SSC) will create propensity scores from the covariates or uses existing propensity scores from an existing variable specified in the pscore() option, but it does not do both at once.

      The solution is to delete one component or the other, namely
      Code:
      psmatch2 $treatment $xlist , outcome($ylist) neighbor(5) common bw(0.06)
      or
      Code:
      psmatch2 $treatment, outcome($ylist) pscore(myscore) neighbor(5) common bw(0.06)
      David Radwin
      Senior Researcher, California Competes
      californiacompetes.org
      Pronouns: He/Him

      Comment

      Working...
      X