Giter Site home page Giter Site logo

Comments (9)

jonathandroth avatar jonathandroth commented on September 25, 2024

from honestdid.

Randol340 avatar Randol340 commented on September 25, 2024

Thank you very much for your reply! I've prepared the data and code and sent them to you via email. Thank you again for your help!

from honestdid.

mcaceresb avatar mcaceresb commented on September 25, 2024

@Randol340 I didn't get any errors when I ran your code. How are you running it? Maybe the output of

library(here)
library(dplyr)
library(did)
library(haven)
library(ggplot2)
library(fixest)
library(HonestDiD)
library(data.table)
library(did2s)
sessionInfo()

will be informative. Incidentally, you can post a MWE here since you only need to define betahat and V from data (but you don't need the underlying data to post betahat and V).

from honestdid.

Randol340 avatar Randol340 commented on September 25, 2024

Thank you very much!! Here is the output of running the codes above:

R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.0.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] did2s_0.7.0       data.table_1.14.6 HonestDiD_0.2.2   fixest_0.11.1     ggplot2_3.4.0    
[6] haven_2.5.1       did_2.1.2         dplyr_1.1.0       here_1.0.1       

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10         lattice_0.20-45     tidyr_1.2.1         zoo_1.8-11         
 [5] rprojroot_2.0.3     digest_0.6.31       foreach_1.5.2       utf8_1.2.3         
 [9] gmp_0.7-1           slam_0.1-50         R6_2.5.1            backports_1.4.1    
[13] evaluate_0.19       pillar_1.8.1        rlang_1.0.6         rstudioapi_0.14    
[17] car_3.1-1           Matrix_1.5-1        rmarkdown_2.19      osqp_0.6.0.8       
[21] readr_2.1.3         stringr_1.5.0       bit_4.0.5           munsell_0.5.0      
[25] broom_1.0.2         compiler_4.2.2      numDeriv_2016.8-1.1 xfun_0.36          
[29] pkgconfig_2.0.3     BMisc_1.4.5         CVXR_1.0-11         Rglpk_0.6-4        
[33] htmltools_0.5.4     tidyselect_1.2.0    tibble_3.1.8        codetools_0.2-18   
[37] fansi_1.0.4         tzdb_0.3.0          withr_2.5.0         ggpubr_0.5.0       
[41] grid_4.2.2          nlme_3.1-160        gtable_0.3.1        lifecycle_1.0.3    
[45] magrittr_2.0.3      scales_1.2.1        cli_3.6.0           stringi_1.7.12     
[49] carData_3.0-5       dreamerr_1.2.3      ggsignif_0.6.4      Rmpfr_0.9-1        
[53] ellipsis_0.3.2      generics_0.1.3      vctrs_0.5.2         sandwich_3.0-2     
[57] Formula_1.2-4       iterators_1.0.14    tools_4.2.2         forcats_0.5.2      
[61] bit64_4.0.5         glue_1.6.2          purrr_1.0.1         hms_1.1.2          
[65] abind_1.4-5         fastmap_1.1.0       yaml_2.3.6          colorspace_2.0-3   
[69] rstatix_0.7.1       ECOSolveR_0.5.4     knitr_1.41      

What do you mean "didn't get any errors"? Does the commend createSensitivityResults give the expected plot? Thank you very much!

from honestdid.

mcaceresb avatar mcaceresb commented on September 25, 2024

@Randol340 Mmm... nothing odd at a glance.

And I meant that I don't see the error you report here. Here's a MWE I can run without issue (unzip the archive for the files I use):

betahat_V.zip

library(HonestDiD)

.loadmat <- function(inf) {
    con <- file(inf, 'rb')
    on.exit(close(con))
    nr <- readBin(con, "int", size=4)
    nc <- readBin(con, "int", size=4)
    mat <- matrix(readBin(con, "numeric", nr * nc, size=8), ncol=nc, nrow=nr, byrow=TRUE)
    flush(con)
    return(mat)
}

betahat               <- .loadmat("betahat.bin")
V                     <- .loadmat("V.bin")
npre                  <- 14
npost                 <- 29
method                <- NULL
baseVec1              <- basisVector(index = 1, size = npost)
monotonicityDirection <- NULL
biasDirection         <- NULL
alpha                 <- 0.05
parallel              <- FALSE

robust_ci <- createSensitivityResults(
  betahat               = betahat,
  sigma                 = V,
  numPrePeriods         = npre,
  numPostPeriods        = npost,
  method                = method,
  l_vec                 = baseVec1,
  monotonicityDirection = monotonicityDirection,
  biasDirection         = biasDirection,
  alpha                 = alpha,
  parallel              = parallel
)

from honestdid.

Randol340 avatar Randol340 commented on September 25, 2024

Sorry for the late reply and thank you very much! I successfully get the following results!!

Sensitivity analysis using relative magnitudes restrictions:
image

Sensitivity Analysis Using Smoothness Restrictions:
image

Following the documentation, the results I get mean that 1) a significant result is robust to allowing for violations of parallel trends up to 0.5 times as big as the max violation in the pre-treatment period, and 2) we can reject a null effect unless we are willing to allow for the linear extrapolation across consecutive periods to be off by more than 0.08 percentage points.

Could you help me in understanding the interpretations better: what are "max violation in the pre-treatment period" and "linear extrapolation across consecutive periods"? Especially, how do you think that help speak to the parallel pretend assumption in our setting?

Also attach the Gardner estimates event study for your reference:
image

Thank you so much for your help!!!

from honestdid.

jonathandroth avatar jonathandroth commented on September 25, 2024

from honestdid.

Randol340 avatar Randol340 commented on September 25, 2024

Hi Jon,

Thank you so much for your and Mauricio's continuous support! We really appreciate it!

Best regards,
Randol

from honestdid.

jonathandroth avatar jonathandroth commented on September 25, 2024

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.