Announcement

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

  • How can I use xtscc, fe with sample weights?

    Hello!
    I'm fairly new to econometrics, so I'll appreciate any useful insights you can provide me.
    I'm dealing with panel data involving 30 companies from four different countries over a 10-year timeframe:

    19 companies from Country 1
    7 companies from Country 2
    3 companies from Country 3
    1 company from Country 4

    These companies constitute the entire target population. The dataset is an unbalanced panel dataset with 289 observations. The observations exhibit heteroskedasticity, autocorrelation, and cross-sectional dependence. Consequently, I have chosen to use "xtscc."
    I'm concerned that, since the sample is largely from Country 1, the results may not be representative of all four countries. I'm hesitant to drop some of the companies from Country 1, as I'm afraid I won't have enough observations for a meaningful analysis. To address the issue of having unequal number of companies from these countries and ensure the results are representative of all four countries, I plan to use sampling weights. However, I'm uncertain about how to run a fixed-effect regression with Driscoll and Kraay standard errors while incorporating sampling weights. The command 'xtscc depvar indpvar [pweight=weights], fe' doesn't seem to be working. Is there an alternative approach I can use for this analysis?

    I would greatly appreciate any helpful advice you can provide.
    Thank you for your time.

  • #2
    See instead ivreghdfe from https://github.com/sergiocorreia/ivreghdfe.

    Comment


    • #3
      Thank you Andrew for your reply.
      However, as I have mentioned in my post, I'm fairly new to econometrics and Stata in general. Therefore, I'm sorry to bother you, but could you please elaborate a bit more on what the code does? Alternatively, could you point me in the direction of materials I can read for further understanding? I did visit the link you provided, but unfortunately, I was unable to grasp what the site was describing.

      Comment


      • #4
        There is no code presented. You asked for a way to estimate a fixed effects model with probability weights and Driscoll and Kraay standard errors. I referred you to the ivreghdfe command. The link guides you on how to install this command. Below is an illustration:

        Code:
        webuse grunfeld, clear
        set seed 09242023
        xtscc invest mvalue kstock i.company, lag(4)
        ivreghdfe invest mvalue kstock, absorb(company) dkraay(5)
        gen weight = abs(rnormal())
        bys company: replace weight= weight[1]
        ivreghdfe invest mvalue kstock [pw=weight], absorb(company) dkraay(5)
        Res.:

        Code:
        . xtscc invest mvalue kstock i.company, lag(4)
        
        Regression with Driscoll-Kraay standard errors   Number of obs     =       200
        Method: Pooled OLS                               Number of groups  =        10
        Group variable (i): company                      F( 11,    19)     =   8587.74
        maximum lag: 4                                   Prob > F          =    0.0000
                                                         R-squared         =    0.9441
                                                         Root MSE          =   52.7680
        
        ------------------------------------------------------------------------------
                     |             Drisc/Kraay
              invest | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
              mvalue |   .1101238   .0206708     5.33   0.000     .0668594    .1533882
              kstock |   .3100653   .0348504     8.90   0.000     .2371226    .3830081
                     |
             company |
                  1  |          0  (empty)
                  2  |   172.2025   63.20408     2.72   0.013     39.91486    304.4902
                  3  |  -165.2751   35.62462    -4.64   0.000    -239.8383   -90.71196
                  4  |    42.4874   61.48941     0.69   0.498    -86.21143    171.1862
                  5  |  -44.32013   53.95807    -0.82   0.422    -157.2557     68.6154
                  6  |   47.13539   61.92153     0.76   0.456    -82.46786    176.7386
                  7  |   3.743212   63.31176     0.06   0.953    -128.7698    136.2563
                  8  |   12.75103   53.90353     0.24   0.816    -100.0703    125.5724
                  9  |  -16.92558   61.90166    -0.27   0.787    -146.4872    112.6361
                 10  |   63.72884   72.79653     0.88   0.392    -88.63606    216.0937
                     |
               _cons |  -70.29669   73.74369    -0.95   0.352     -224.644    84.05064
        ------------------------------------------------------------------------------
        
        
        . 
        . ivreghdfe invest mvalue kstock, absorb(company) dkraay(5)
        (MWFE estimator converged in 1 iterations)
        
        OLS estimation
        --------------
        
        Estimates efficient for homoskedasticity only
        Statistics robust to heteroskedasticity and clustering on year
        and kernel-robust to common correlated disturbances (Driscoll-Kraay)
          kernel=Bartlett; bandwidth=5
          time variable (t):  year
          group variable (i): company
        
        Number of clusters (year) =         20                Number of obs =      200
                                                              F(  2,    19) =    76.01
                                                              Prob > F      =   0.0000
        Total (centered) SS     =  2244352.228                Centered R2   =   0.7668
        Total (uncentered) SS   =  2244352.228                Uncentered R2 =   0.7668
        Residual SS             =  523478.1139                Root MSE      =    52.77
        
        ------------------------------------------------------------------------------
                     |               Robust
              invest | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
              mvalue |   .1101238   .0206708     5.33   0.000     .0668594    .1533882
              kstock |   .3100653   .0348504     8.90   0.000     .2371226    .3830081
        ------------------------------------------------------------------------------
        Included instruments: mvalue kstock
        Partialled-out:       _cons
                              nb: total SS, model F and R2s are after partialling-out;
                                  any small-sample adjustments include partialled-out
                                  variables in regressor count K
        ------------------------------------------------------------------------------
        
        Absorbed degrees of freedom:
        -----------------------------------------------------+
         Absorbed FE | Categories  - Redundant  = Num. Coefs |
        -------------+---------------------------------------|
             company |        10           0          10     |
        -----------------------------------------------------+
        
        . 
        . ivreghdfe invest mvalue kstock [pw=weight], absorb(company) dkraay(5)
        (sum of wgt is     1.4715e+02)
        (MWFE estimator converged in 1 iterations)
        
        OLS estimation
        --------------
        
        Estimates efficient for homoskedasticity only
        Statistics robust to heteroskedasticity and clustering on year
        and kernel-robust to common correlated disturbances (Driscoll-Kraay)
          kernel=Bartlett; bandwidth=5
          time variable (t):  year
          group variable (i): company
        
        Number of clusters (year) =         20                Number of obs =      200
                                                              F(  2,    19) =    77.60
                                                              Prob > F      =   0.0000
        Total (centered) SS     =  2707759.309                Centered R2   =   0.8339
        Total (uncentered) SS   =  2707759.309                Uncentered R2 =   0.8339
        Residual SS             =  449820.4125                Root MSE      =    48.91
        
        ------------------------------------------------------------------------------
                     |               Robust
              invest | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
              mvalue |   .1043863   .0244088     4.28   0.000     .0532981    .1554745
              kstock |   .3264568   .0409148     7.98   0.000     .2408211    .4120925
        ------------------------------------------------------------------------------
        Included instruments: mvalue kstock
        Partialled-out:       _cons
                              nb: total SS, model F and R2s are after partialling-out;
                                  any small-sample adjustments include partialled-out
                                  variables in regressor count K
        ------------------------------------------------------------------------------
        
        Absorbed degrees of freedom:
        -----------------------------------------------------+
         Absorbed FE | Categories  - Redundant  = Num. Coefs |
        -------------+---------------------------------------|
             company |        10           0          10     |
        -----------------------------------------------------+
        
        .

        Comment


        • #5
          Thank you so much for your valuable insight.

          Comment

          Working...
          X