Announcement

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

  • Kr20

    Hello!

    I installed KR 20, and run the following code. But an error message appears.

    . kr20 cf1-cf4
    variable tempTot2 already defined
    r(110);

    Could you please let me know how to solve this problem? By the way, I use StataNow 18.

    Thanks in advance.


  • #2


    *ols

    Code:
        
     . regress sales_log c.year##i.sector [pweight=mult] if  year< 2017, robust
    (sum of wgt is 49,147.85246381)
    
    Linear regression                    Number of obs    =     16,436
                                                    F(3, 16432)       =      59.23
                                                    Prob > F           =     0.0000
                                                    R-squared         =     0.0234
                                                    Root MSE          =     1.4645
    
    -------------------------------------------------------------------------------
                  |               Robust
    Sales_log | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
             year |   .0116959   .0103872     1.13   0.260    -.0086641    .0320559
        15.industry |   12.56344    36.6089     0.34   0.731    -59.19398    84.32085
                  |
    industry#c.year |
              15  |   -.006477   .0181834    -0.36   0.722    -.0421184    .0291645
                  |
            _cons |  -19.77848   20.91297    -0.95   0.344    -60.77018    21.21322
    -------------------------------------------------------------------------------
    
    . margins sector, dydx(year)
    
    Average marginal effects                                Number of obs = 16,436
    Model VCE: Robust
    
    Expression: Linear prediction, predict()
    dy/dx wrt:  year
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    year         |
       industry |
             14  |   .0116959   .0103872     1.13   0.260    -.0086641    .0320559
             15  |          .  (not estimable)
    ------------------------------------------------------------------------------
    * didregress

    Code:
    . didregress (sales_log export_earnings_log domestic_demand_log) (did) ///
    >     [pweight=mult], group(industry) time(year)
    (sum of wgt is 66,419.35949187)
    
    Number of groups and treatment time
    
    Time variable: year
    Control:       did = 0
    Treatment:     did = 1
    -----------------------------------
                 |   Control  Treatment
    -------------+---------------------
    Group        |
          industry |         1          1
    -------------+---------------------
    Time         |
         Minimum |      2011       2017
         Maximum |      2011       2017
    -----------------------------------
    
    Difference-in-differences regression                    Number of obs = 23,324
    Data type: Repeated cross-sectional
    
                                                     (Std. err. adjusted for 2 clusters in sector)
    ----------------------------------------------------------------------------------------------
                                 |               Robust
               Sales_log | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -----------------------------+----------------------------------------------------------------
    ATET                         |
                             did |
                       (1 vs 0)  |  -.0309762   .0002102  -147.34   0.004    -.0336474   -.0283049
    ----------------------------------------------------------------------------------------------
    Note: ATET estimate adjusted for covariates, group effects, and time effects.
    
    
    . estat ptrends
    
    Parallel-trends test (pretreatment time period)
    H0: Linear trends are parallel
    
     F(1, 1) = 36183.37
    Prob > F =   0.0033

    Comment


    • #3
      Thank you for your reply.
      I am not sure what you meant, but I have solved problem.
      If I run the follwoing code (i.e., ssc install kr20) everytime I use kr20 varlist, it worked.
      Thanks,

      Miyuki

      Comment

      Working...
      X