Announcement

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

  • npregress does not work for model with dummy variables for industries and regions

    I am using the new npregress command in Stata 15 to estimate an empirical model based on cross-section data for 759 firms. My dependent variable is continuous , my independent variables include six continuous variables and five indicator variables, plus dummy variables for 20 industries and 5 regions. When I do not include the dummy variables for industries and regions, using

    npregress kernel share_indir c.log_firm_size c.firm_age i.new_product i.product_upgrade i.quality_certification c.share_university c.contract_enforceability i.multinational i.free_trade_zone c.direct_imports c.indirect_imports, reps(100) seed(2109) imaic

    everything is fine. However, wenn I augment the empirical model by including the dummy variables for industries and regions and run

    npregress kernel share_indir c.log_firm_size c.firm_age i.new_product i.product_upgrade i.quality_certification c.share_university c.contract_enforceability i.multinational i.free_trade_zone c.direct_imports c.indirect_imports i.indd* i.regiond*, reps(100) seed(2109) imaic

    I get the following output only


    Bootstrap replications (100)
    ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 100
    insufficient observations to compute bootstrap standard errors
    no results will be saved
    r(2000);

    Does anybody have an idea what goes wrong here?

    Am I right when I guess is that this might be related to the fact that some of the industries do only have a small number of firms (between one and 12)?

    Any help is greatly appreciated.

    All the best,
    Joachim

  • #2
    Joachim:
    welcome to the list.
    I would move one step aside and check whether:
    Code:
    i.indd* i.regiond*,
    were coded correctly.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo,
      thanks for your immediate reply. Yes, I am sure that both variables are coded correctly.
      All the best,
      Joachim

      Comment


      • #4
        Joachim:
        does adding -strata- option in your -bootstrap- code change anything?
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Carlo:
          thanks for this recommendation. I will check this and come back with any results. However, one run of the empirical models takes hours. Therefore, I will collect any other ideas and let the PC running over the weekend.
          Best,
          Joachim

          Comment


          • #6
            Hello Joachim,

            If possible, send us your data and do-file to technical support ( [email protected] ) and I will look into it. On the meantime, I would use the noisily option of the bootstrap and limit the replications to 2. For example,

            Code:
            sysuse auto
            regress mpg price i.rep78 i.foreign in 50/58, vce(bootstrap, reps(2) seed(111) noisily)
            What this does is show what is happening at each bootstrap replication. You can then see what is wrong. For instance:

            Without the noisily option

            Code:
            . sysuse auto
            (1978 Automobile Data)
            
            . regress mpg price i.rep78 i.foreign in 50/58, vce(bootstrap, reps(2) seed(111))
            (running regress on estimation sample)
            
            Bootstrap replications (2)
            ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
            xx
            insufficient observations to compute bootstrap standard errors
            no results will be saved
            r(2000);
            With the noisily option

            Code:
            . regress mpg price i.rep78 i.foreign in 50/58, vce(bootstrap, reps(2) seed(111) noisily)
            bootstrap: First call to regress with data as is:
            
            . regress mpg price i(1 2 3 4 5)b1.rep78 i(0 1)b0.foreign in 50/58
            note: 1b.rep78 identifies no observations in the sample
            note: 5.rep78 omitted because of collinearity
            
                  Source |       SS           df       MS      Number of obs   =         8
            -------------+----------------------------------   F(5, 2)         =      0.46
                   Model |  106.075524         5  21.2151047   Prob > F        =    0.7886
                Residual |  91.4244765         2  45.7122382   R-squared       =    0.5371
            -------------+----------------------------------   Adj R-squared   =   -0.6202
                   Total |       197.5         7  28.2142857   Root MSE        =    6.7611
            
            ------------------------------------------------------------------------------
                     mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                   price |  -.0017116   .0013584    -1.26   0.335    -.0075561     .004133
                         |
                   rep78 |
                      1  |          0  (empty)
                      2  |    -.38849   12.79008    -0.03   0.979    -55.41975    54.64277
                      3  |  -4.445417   8.359682    -0.53   0.648    -40.41422    31.52339
                      4  |  -2.214231   6.174337    -0.36   0.754    -28.78026     24.3518
                      5  |          0  (omitted)
                         |
                 foreign |
                Foreign  |   6.690581   9.797151     0.68   0.565    -35.46316    48.84432
                   _cons |   31.52914   13.09483     2.41   0.138    -24.81336    87.87164
            ------------------------------------------------------------------------------
            
            Bootstrap replications (2)
            . regress mpg price i(1 2 3 4 5)b1.rep78 i(0 1)b0.foreign
            note: 1b.rep78 identifies no observations in the sample
            note: 2.rep78 identifies no observations in the sample
            note: 5.rep78 omitted because of collinearity
            note: 0b.foreign identifies no observations in the sample
            note: 1.foreign omitted because of collinearity
            
                  Source |       SS           df       MS      Number of obs   =         8
            -------------+----------------------------------   F(3, 4)         =         .
                   Model |     111.875         3  37.2916667   Prob > F        =         .
                Residual |           0         4           0   R-squared       =    1.0000
            -------------+----------------------------------   Adj R-squared   =    1.0000
                   Total |     111.875         7  15.9821429   Root MSE        =         0
            
            ------------------------------------------------------------------------------
                     mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                   price |   .0002148          .        .       .            .           .
                         |
                   rep78 |
                      1  |          0  (empty)
                      2  |          0  (empty)
                      3  |  -12.36641          .        .       .            .           .
                      4  |  -11.10524          .        .       .            .           .
                      5  |          0  (omitted)
                         |
                 foreign |
               Domestic  |          0  (empty)
                Foreign  |          0  (omitted)
                         |
                   _cons |   34.01439          .        .       .            .           .
            ------------------------------------------------------------------------------
            collinearity in replicate sample is not the same as the full sample, posting missing values
            . regress mpg price i(1 2 3 4 5)b1.rep78 i(0 1)b0.foreign
            note: 1b.rep78 identifies no observations in the sample
            note: 5.rep78 omitted because of collinearity
            note: 1.foreign omitted because of collinearity
            
                  Source |       SS           df       MS      Number of obs   =         8
            -------------+----------------------------------   F(4, 3)         =     55.87
                   Model |  335.495926         4  83.8739814   Prob > F        =    0.0038
                Residual |  4.50407442         3  1.50135814   R-squared       =    0.9868
            -------------+----------------------------------   Adj R-squared   =    0.9691
                   Total |         340         7  48.5714286   Root MSE        =    1.2253
            
            ------------------------------------------------------------------------------
                     mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                   price |  -.0034311   .0002887   -11.88   0.001      -.00435   -.0025122
                         |
                   rep78 |
                      1  |          0  (empty)
                      2  |  -12.26473    1.54129    -7.96   0.004     -17.1698   -7.359661
                      3  |  -15.37421   1.206514   -12.74   0.001    -19.21387   -11.53454
                      4  |  -7.679877   1.133483    -6.78   0.007    -11.28713   -4.072627
                      5  |          0  (omitted)
                         |
                 foreign |
                Foreign  |          0  (omitted)
                   _cons |   50.57918   1.948916    25.95   0.000     44.37686     56.7815
            ------------------------------------------------------------------------------
            collinearity in replicate sample is not the same as the full sample, posting missing values
            insufficient observations to compute bootstrap standard errors
            no results will be saved
            r(2000);

            Comment


            • #7
              Dear Enrique,

              many thanks. As suggested by you I will send you the data and some code and I hope to learn what goes wrong in my application.

              Meanwhile, I worked with what I think might be a workaround. I demeaned the left-hand side variable by industry and region using

              * share_indir demeaned by industry and region

              regress share_indir i.indd* i.regiond*
              predict dem
              gen share_indir_dem = share_indir - dem
              drop dem

              an then estimated the model with share_indir_dem as the dependent variable. Results are of the same order of magnitude as results for OLS and marginal effects from an application of a fractional logit model estimated by glm. Given that both the number of industries and the number of regions are fixed when the number of firms in the sample increases this approach to "absorb" industries and regions seem to make sense to me. Furthermore, this approach deals with the "curse of dimensionality" - an empirical model with many dummy variables for industries and regions might easily take more than a day on a usual computer. But I am an applied guy with a rather limited understanding of theoretical econometrics only, so I would love to learn what others think of my workaround.

              All the best,
              Joachim

              Comment


              • #8
                Hello,
                I am using npregress to examine the relationship between diet quality and income plus a set of covariates that are either zero or one (e.g. higher education, Immigration status,...). However, after running npregress, the coefficients and SE of dummy variables are dropped.
                I centered the dummies with center.ado, however, the problem is still there.
                Can anyone help me out in this case please?
                Thanks,
                Seyed

                Comment

                Working...
                X