Giter Site home page Giter Site logo

Comments (6)

jonathandroth avatar jonathandroth commented on September 25, 2024

from honestdid.

lzy318 avatar lzy318 commented on September 25, 2024

Thanks for your prompt response, I re-run the codes with fixed grid but the problem persists. Here is my code:

honest.twfe <- createSensitivityResults_relativeMagnitudes(betahat = beta.twfe,
                                                           sigma = vcov.twfe,
                                                           numPrePeriods = 12,
                                                           numPostPeriods = 1,
                                                           l_vec = c(1),
                                                           Mbarvec = c(0,0.25,0.5,0.75,1),
                                                           grid.ub = 0.8,
                                                           grid.lb = -0.8)

      lb    ub method Delta    Mbar
   <dbl> <dbl> <chr>  <chr>   <dbl>
1 0.0553 0.175 C-LF   DeltaRM  0   
2 0.0569 0.174 C-LF   DeltaRM  0.25
3 0.0521 0.177 C-LF   DeltaRM  0.5 
4 0.0360 0.191 C-LF   DeltaRM  0.75
5 0.0200 0.209 C-LF   DeltaRM  1   

Let me know if you need the data to replicate this issue. And I am still confused about the difference between the confidence interval when Mbar equals to zero and the confidence interval given by constructOriginalCS(). They should be similar right? But in my case they are not.

from honestdid.

jonathandroth avatar jonathandroth commented on September 25, 2024

from honestdid.

lzy318 avatar lzy318 commented on September 25, 2024

Thanks for the quick reply, this is the link to the data.

https://drive.google.com/file/d/14IoDrnCulGmUfCyBJkqmNp-iObSIgw_3/view?usp=sharing

Here is the code for the event study.

`rm(list = ls())
library(HonestDiD)
library(fixest)
load("example.RData")
twfe.est <- feols(general_sharetotal_A_all ~ i(Time_to_Treatment, treat, ref = -1) + cand_H_all + cand_B_all| district_final + cycle,
data = data.twfe, cluster = "district_final")

beta.twfe <- twfe.est$coeftable[c(4:16),1]
vcov.twfe <- summary(twfe.est)$cov.scaled[c(4:16),c(4:16)]

honest.twfe <- createSensitivityResults_relativeMagnitudes(betahat = beta.twfe,
sigma = vcov.twfe,
numPrePeriods = 12,
numPostPeriods = 1,
l_vec = c(1),
Mbarvec = c(0,0.25,0.5,0.75,1),
grid.ub = 0.8,
grid.lb = -0.8)
honest.twfe
original.twfe <- constructOriginalCS(betahat = beta.twfe,
sigma = vcov.twfe,
numPrePeriods = 12,
numPostPeriods = 1,
l_vec = c(1))
original.twfe`

from honestdid.

jonathandroth avatar jonathandroth commented on September 25, 2024

Hmm, that is weird. I am able to replicate your strange result. However, if I include the second post-treatment coefficient and then tell it I'm only interested in the first one (l_vec = c(1,0)), then I get the expected result that the CI for M=0 is nearly identical to the original CI, and the CIs expand as M increases.

library(fixest)
load("~/Downloads/example.RData")
twfe.est <- feols(general_sharetotal_A_all ~ i(Time_to_Treatment, treat, ref = -1) + cand_H_all + cand_B_all| district_final + cycle,
                  data = data.twfe, cluster = "district_final")

beta.twfe <- twfe.est$coeftable[c(4:17),1]
vcov.twfe <- summary(twfe.est)$cov.scaled[c(4:17),c(4:17)]

honest.twfe <- createSensitivityResults_relativeMagnitudes(betahat = beta.twfe,
                                                           sigma = vcov.twfe,
                                                           numPrePeriods = 12,
                                                           numPostPeriods = 2,
                                                           l_vec = c(1,0),
                                                           Mbarvec = c(0,0.25,0.5,0.75,1),
                                                           grid.ub = 0.8,
                                                           grid.lb = -0.8)

IIRC, HonestDiD has a special subroutine for the case without nuisance parameters (i.e. only one post-treatment period), and I'm wondering if there is a bug there. @mcaceresb when you have some RA time, could you look into this please?

CCing @asheshrambachan since I think you wrote this code initially and may have a better idea where the bug is.

from honestdid.

mcaceresb avatar mcaceresb commented on September 25, 2024

@jonathandroth The critical values are different.

  1. The least-favorable critical value is larger here when using the "no-nuisance" parameter logic.

  2. If the least-favorable CV is not rejected, the next critical value is obtained from the generalized normal, which is also different.

    • This no-nuisance call uses the values returned from .VLoVUpFN for the lower and upper bounds, whereas this nuisance call uses the values from .lp_dual_fn; I'm not quite sure why but they end up being rather different, but they do.

from honestdid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.