Skip to content

Incorrect date labels and se calculation issue #123

@madridista25

Description

@madridista25

I'm doing SDID Estimator with R using Panel Data. I have historical data with the following form :

df1920trCORN
# A tibble: 192 × 7
   MONTH               CITY        PRODUCT RECEIPTS SHIPMENTS INDIVIDU  TREATMENT
   <dttm>              <chr>       <chr>      <dbl>     <dbl> <chr>         <dbl>
 1 1924-01-01 00:00:00 Chicago     CORN     7572000   4871000 Chicago_…         0
 2 1924-01-01 00:00:00 Duluth      CORN      549327         0 Duluth_C…         0
 3 1924-01-01 00:00:00 Milwaukee   CORN     1111560    981273 Milwauke…         0
 4 1924-01-01 00:00:00 Minneapolis CORN     1398940   1150010 Minneapo…         0
 5 1924-02-01 00:00:00 Chicago     CORN    13424000   4680000 Chicago_…         0
 6 1924-02-01 00:00:00 Duluth      CORN     2109283         0 Duluth_C…         0
 7 1924-02-01 00:00:00 Milwaukee   CORN     3362300   1003363 Milwauke…         0
 8 1924-02-01 00:00:00 Minneapolis CORN     3186480   1636480 Minneapo…         0
 9 1924-03-01 00:00:00 Chicago     CORN    12570000   5737000 Chicago_…         0
10 1924-03-01 00:00:00 Duluth      CORN     2637099         0 Duluth_C…         0

I'm using synthdid library to perform an econometric analysis. TREATMENT is a dummy variable (0 for non-treated observations, 1 for treated observations) My code is this:

setup = panel.matrices(as.data.frame(as_tibble(df1920trCORN)), unit=2, time=1, outcome=4,
                       treatment=7)

tau.hat = synthdid_estimate(setup$Y, setup$N0, setup$T0)
se = sqrt(vcov(tau.hat, method='placebo'))
sprintf('point estimate: %1.2f', tau.hat)
sprintf('95%% CI (%1.2f, %1.2f)', tau.hat - 1.96 * se, tau.hat + 1.96 * se)
plot(tau.hat)+
  labs(title="SDID Estimate", subtitle="Corn : 1920's", x="Date", y="Value")+
  theme_clean()

The function works perfectly but my date (period) labels are incorrect. In the plot, i have this result :
corn3

The date labels are in float format while in my data i have date with Date format. The result of the model is also misformatted for the dates

$estimate
[1] -5300965

$se
     [,1]
[1,]   NA

$controls
            estimate 1
Minneapolis      0.425
Milwaukee        0.378
Duluth           0.197

$periods
            estimate 1
-1391212800      0.465
-1446508800      0.318
-1388534400      0.131

$dimensions
          N1           N0 N0.effective           T1           T0 T0.effective 
       1.000        3.000        2.760       23.000       25.000        2.928 

Also, i don't have the standard error of the estimator.
Can you help me to solve the date problem and the standard error issue ?
Regards,
Constantin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions