Announcement

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

  • How to calculate standard error and t-statistics?

    Hi,

    I am trying to determine the Wald estimator for a difference-in-difference (DID) regression, which is defined as the ratio of the DID of the outcome variable to the DID of the instrument. However, I am struggling to answer the following questions:

    1) How to calculate the standard error of the Wald-estimator manually?
    2) How to calculate the t-statistics of the Wald-estimator manually?
    3) How to export the results on LaTex?

    Please find and attached a sample of the data (in Excel as, for some reason, I cannot upload it in .dta) and my log. The treatment dummy variable is dist_intervention5 and the time dummy is survey_year. The outcome variable is service_satisfaction and the instrument is property_demand.

    Thank you
    Attached Files

  • #2
    I am confused about your question because you didn't include any code and because you ask about a wald estimator but mention a time dummy variable.

    Almost certainly the best way to get the Wald estimator's SE is not manually, but with ivregress, as in
    Code:
    ivregress 2sls service_satisfaction  (dist_intervention5  = property_demand)
    If you must do it manually
    Code:
    * estimate reduced forcm
    reg y z
    estimates store rf
    
    * estimate first stage
    reg z x
    estimates store fs
    
    * use nlcom with seemingly unrelated regression
    suest rf fs
    nlcom [rf_mean]_b[z]/[fs_mean]_b[z]

    Comment


    • #3
      Hi Dan,

      Thank you for your help. I really appreciate it.

      Sorry for not including the codes on the forum - I wrote them in the log file.

      As per D'Haultfoeuille et de Chaisemartin in their paper Fuzzy Difference-in-Differences, the Wald estimator for Difference-in-Differences can be defined as

      1) DID on the outcome variable divided by DID on the instrument, where:

      dist_intervention1 - dummy variable for control/treatment group
      survey_year - dummy variable for time periods
      property_demand - the instrument

      As such, the stata code would then be (as in the log file):
      Code:
      regress service_satisfaction dist_intervention1##survey_year ///
              if !missing(service_satisfaction) & !missing(property_demand)
      mat b =e(b)
      local b1 `=b[1,8]'
      regress property_demand dist_intervention1##survey_year ///
              if !missing(service_satisfaction) & !missing(property_demand)
      mat b =e(b)
      local b2 `=b[1,8]'
      local b=`b1'/`b2'
      display `b'
      * if !missing(service_satisfaction) & !missing(property_demand) is to ensure that the sample size in both regressions is the same, to account for missing observations

      The problem is that, using this method, I don't know how to determine the standard error and t-statistic

      2) 2SLS of the outcome variable on the treatment dummy, time dummy and the instrument, with the instrument instrumented by dist_intervention1xsurvey_year

      I am not sure how to run a 2SLS using the definition above. I've tried the following codes but doesn't yield the same coefficient as method 1 and 3

      Code:
      ivregress 2sls service_satisfaction property_demand (did=dist_intervention1 survey_year)
      ***
      gen did=dist_intervention1*survey_year
      ivregress 2sls service_satisfaction (did=property_demand)

      3) Using D'Haultfoeuille et de Chaisemartin's command fuzzydid:

      Code:
      fuzzydid service_satisfaction dist_intervention1 survey_year property_demand, did
      ****

      When using method 1 and 3, I get the same coefficients, with method 3 providing me with the standard error and t-statistics (though there are not included in the ereturn list, so I am still struggling to export them). However, when including covariates, the two methods differ. I wrote to the writter of the fuzzydid command who informed me that their command includes the covariates more flexibly, allowing to vary over time and between groups as opposed to the linear regression with covariates where the coefficients are the same for both groups and time periods. As such, ideally I would like to run a 2sls with covariates and get the same coefficient as I would using method one, but don't know how to code it. It would not only provide the standard error and the t-statistic, but also allow me to export the results to LaTex. Your thoughts on this matter would be really appreciated.

      Please find attached the do-file containing the codes for method 1 and 3, with and without covariates, the log file and the data in Excel

      Thank you!


      Attached Files

      Comment

      Working...
      X