Announcement

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

  • returnweights option for sdid

    Hi all
    In the paper "On Synthetic Difference-in-Differences and Related Estimation Methods in Stata" section 4.5, Other Parameters, the authors mentioned that to obtain weights we can use returnweights option; however, it seem that this option is not available anymore. As a result, I am trying to get those using e(lambda)[1..time,1] and e(omgea)[1..Nc]. To generate the weight I am using following code:
    Code:
    matrix lambda = e(lambda)[1..12,1]
    matrix omega = e(omega)[1..5620,1]
    g weight = lambda * omega
    I get this error: matrix operators that return matrices not allowed in this context.
    I really appreciate it if you please help me to get those weights as mentioned in the paper

  • #2
    I managed to get weights using lambda * omega using the code below (then I merged all the weight datasets with the original dataset) for all control units for pre-intervention times. I think the weights of the treated units should be 1 but I am not sure about the weights of control units for post-intervention time.
    Code:
    matrix omega = e(omega)[1..5619,1]
    matrix lambda = e(lambda)[1..12,1]
    g weights = .
    forvalues b=1/12{
        matrix d`b' = lambda[`b',1] * omega
        preserve
        keep if id>=1811 & id<= 7429 & time==`b'
        svmat d`b'
        replace weights = d`b'
        keep id time weights
        save weight`b', replace
        restore
        
    }

    Comment

    Working...
    X