Announcement

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

  • Regression separately for each industry

    Hi dear Profs and colleagues,

    I am going to estimate TFP for each industry separately. Data:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(year NPC_FIC) float(CAE_2 log_y log_k lnmaterials log_lab)
    2010 500008310 56 11.074808 10.925884 11.266246         0
    2011 500008310 56  10.80645 10.660196         .         0
    2013 500008310 56 10.290517 10.838875  9.275587         0
    2014 500008310 56 10.672716 10.702727 10.825533         0
    2015 500008310 56 10.649037 10.442463  9.741929         0
    2010 500027353 56  11.77071 11.009853 11.910075 1.0986123
    2011 500027353 56 11.717815 11.195581         .  .6931472
    2012 500027353 56 11.493213 11.097713         .         0
    2013 500027353 56  11.29796 11.284694  10.23167         0
    2014 500027353 56 11.522272 10.902225 11.623674         0
    2015 500027353 56 11.632777 11.040006  10.62239  .6931472
    2016 500027353 56 11.759942  10.86754  10.91029  .6931472
    2017 500027353 56  11.96535 10.957486 11.245886 1.0986123
    2018 500027353 56 11.902343 11.069276 11.001667 1.0986123
    2010 500049799 10 11.863244 12.526605 10.456385 1.0986123
    2011 500049799 10  11.54864 12.515446         .  .6931472
    2012 500049799 10 11.232775  12.74003         .  .6931472
    2013 500049799 10 11.275455 12.664285  8.756804 1.0986123
    2014 500049799 10 11.269477 12.699335  9.918517 1.0986123
    2015 500049799 10  11.59814 12.360273   9.04157  1.609438
    2016 500049799 10 11.716307  12.39719 9.3204975  1.609438
    2017 500049799 10 11.962924 12.371113  9.697294 1.7917595
    2018 500049799 10 10.717458 12.705137  8.676226         0
    2010 500050215 56  10.83058   9.65509 11.073888  .6931472
    2011 500050215 56 10.510695  9.780246         .  .6931472
    2010 500135017 55 12.565253 11.753516 12.662325 2.0794415
    2011 500135017 55 12.450398 11.647133         . 2.0794415
    2012 500135017 55 12.139992 10.778436         .   1.94591
    2013 500135017 55  11.88397  10.78808 10.765712 1.7917595
    2014 500135017 55 11.872953 10.697565 11.922363 1.7917595
    2015 500135017 55 11.999178 10.758796 10.988786 1.7917595
    2016 500135017 55 12.162277  10.58633 11.312615  1.609438
    2017 500135017 55 12.356546   10.6763 11.637093  1.609438
    2018 500135017 55 12.482655 11.849655 11.539842 1.7917595
    2019 500135017 55 12.609866  11.96744  11.70076 1.3862944
    2020 500135017 55 12.185753  11.54637 11.185262 1.3862944
    2010 500139105 47  10.12691 10.864503  9.764585  .6931472
    2011 500139105 47  9.977667 10.778602         .         0
    2012 500139105 47  9.615405 10.541545         .         0
    2013 500139105 47  9.822657 10.795793  8.411635         0
    2014 500139105 47  9.643291  10.62823  9.400371         0
    2010 500205042 56 11.847976  10.72867 11.987343  1.609438
    2011 500205042 56 12.205242  10.91438         . 2.0794415
    2012 500205042 56 11.871956 10.778436         .  1.609438
    2013 500205042 56 11.902898  10.78808 10.784653 1.7917595
    2014 500205042 56 11.938154 10.697565  11.98757 2.0794415
    2015 500205042 56 11.978162 10.758796 10.967772 1.7917595
    2016 500205042 56 12.132475  10.58633  11.28281 1.7917595
    2017 500205042 56 12.250051   10.6763 11.530596 1.7917595
    2018 500205042 56 12.239155  10.78808 11.338487   1.94591
    2010 500206942 47 11.012033 11.638924 10.424974 1.0986123
    2011 500206942 47 10.919623 11.564075         . 1.0986123
    2012 500206942 47    10.733  11.29941         .  .6931472
    2013 500206942 47  10.49709 11.122058   8.72287  .6931472
    2014 500206942 47 10.288852 10.953977  9.682573         0
    2015 500206942 47 10.227562 10.936975  8.714582         0
    2016 500206942 47  10.10696 10.843084  8.754652         0
    2017 500206942 47 10.057281  10.79927  8.835141         0
    2018 500206942 47 10.098272 10.829134  8.694993         0
    2019 500206942 47  9.981421 10.719472  8.611775         0
    2010 500251226 47 10.689692 11.820528  10.17441  .6931472
    2011 500251226 47 10.902813 11.839066         .  .6931472
    2012 500251226 47  11.24379  12.00739         .  .6931472
    2013 500251226 47 10.814685 11.846386  9.040474 1.0986123
    2014 500251226 47 10.872655 11.833994 10.266294  .6931472
    2015 500251226 47  10.84681  11.82692  9.180595  .6931472
    2016 500251226 47  10.85354 11.853354  9.347876  .6931472
    2017 500251226 47 10.799657  11.80381   9.42417  .6931472
    2018 500251226 47 10.739348 11.781363  9.182611  .6931472
    2019 500251226 47  10.96599 11.930787  9.442993  .6931472
    2020 500251226 47 10.903605  11.90687  9.175542  .6931472
    2010 500265754 47 10.349134  9.489713  9.273022         0
    2011 500265754 47 10.472063  9.634824         .         0
    2012 500265754 47 10.423263  9.660077         .         0
    2013 500265754 47   8.76061  10.03732  7.349588         0
    2014 500265754 47  9.328923 10.383967  9.086072         0
    2013 500301113 56 11.241786 10.436113  10.17548  .6931472
    2014 500301113 56 11.054788  10.05363  11.15619  .6931472
    2016 500301113 56 10.830856   9.75464 10.084136 1.0986123
    2017 500301113 56 10.905552 10.161264 10.238066  .6931472
    2018 500301113 56 10.817115  9.627734 10.018467         0
    2019 500301113 56 10.736115  9.800679  9.971493         0
    2010 500321035 25 12.073917 11.276228 10.667027 1.0986123
    2011 500321035 25 11.904663 11.198406         . 1.0986123
    2012 500321035 25 12.061388 11.258717         . 1.0986123
    2013 500321035 25 11.899154 11.163878  9.234751 1.0986123
    2014 500321035 25  11.62529 11.021902 10.128515  .6931472
    2015 500321035 25 11.825748 11.063978   9.26917  .6931472
    2016 500321035 25 11.470373  10.60075  9.220348  .6931472
    2018 500321035 25 11.546021  10.99375  9.099193         0
    2019 500321035 25 11.381244 10.543893  9.113893         0
    2014 500331816 56 11.209317  10.05363 11.310687         0
    2010 500369375 47 11.670322   12.6072 11.022923  .6931472
    2011 500369375 47 11.847568 12.535297         .  .6931472
    2012 500369375 47 11.566438  12.44148         .         0
    2010 500392001 25  11.07234 10.384833  9.811321  .6931472
    2011 500392001 25 10.580175 10.542865         .  .6931472
    2013 500392001 25 10.776056 10.584106  8.519679         0
    2014 500392001 25 10.570137  10.49255  9.481566         0
    2015 500392001 25 10.945635 10.397116  8.534858         0
    end
    ------------------ copy up to and including the previous line ------------------

    Listed 100 out of 274919 observations

    When I run this code:
    Code:
     xtset NPC_FIC year
    
    Panel variable: NPC_FIC (unbalanced)
     Time variable: year, 2010 to 2020, but with gaps
             Delta: 1 unit
    
    . gen tfp_op_output=.
    (274,919 missing values generated)
    
    . gen tfp_op_va=.
    (274,919 missing values generated)
    
    . 
    . set more off 
    
    . local indus "3 6 7 9 10 11 12 13"
    
    . 
    . foreach industry of local indus{
      2.          
    .          di "********** INDUSTRIA `industry' "
      3.           prodest log_y  if CAE_2==`industry', free(log_lab) state(log_k) proxy(lnmaterials) va met(lp) att re
    > ps(50) id(NPC_FIC) t(year)
      4.           predict out_lp, resid
      5.           replace tfp_op_output=ln(out_lp) 
      6.           drop out_lp
      7. }
    ********** INDUSTRIA 3 
    year must have multiple distinct nonmissing values
    r(459);
    
    end of do-file
    Is there anyone who could assist me in seeing what the problem is? If the code is missing or the issue is in dataset. Thank you so much.

    Cheers,
    Paris

  • #2
    Paris:
    I fail to get what you're after.
    That said (and with a substantive bit of guess-work), I'd go:
    Code:
    . xtset NPC_FIC year
    
    Panel variable: NPC_FIC (unbalanced)
     Time variable: year, 2010 to 2020, but with gaps
             Delta: 1 unit
    
    . bysort CAE_2: xtreg log_y log_k log_lab, fe
    
    ------------------------------------------------------------------------------------------------------------------------------------------
    -> CAE_2 = 10
    
    Fixed-effects (within) regression               Number of obs     =          9
    Group variable: NPC_FIC                         Number of groups  =          1
    
    R-squared:                                      Obs per group:
         Within  = 0.7422                                         min =          9
         Between =      .                                         avg =        9.0
         Overall = 0.7422                                         max =          9
    
                                                    F(2,6)            =       8.64
    corr(u_i, Xb) =      .                          Prob > F          =     0.0171
    
    ------------------------------------------------------------------------------
           log_y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           log_k |   -1.00419   .8123983    -1.24   0.263    -2.992057    .9836771
         log_lab |    .350835   .2216006     1.58   0.164    -.1914022    .8930722
           _cons |   23.69296   10.38328     2.28   0.063    -1.713999    49.09992
    -------------+----------------------------------------------------------------
         sigma_u |          .
         sigma_e |  .22531034
             rho |          .   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(0, 6) = .                           Prob > F =      .
    
    ------------------------------------------------------------------------------------------------------------------------------------------
    -> CAE_2 = 25
    
    Fixed-effects (within) regression               Number of obs     =         14
    Group variable: NPC_FIC                         Number of groups  =          2
    
    R-squared:                                      Obs per group:
         Within  = 0.5711                                         min =          5
         Between = 1.0000                                         avg =        7.0
         Overall = 0.7618                                         max =          9
    
                                                    F(2,10)           =       6.66
    corr(u_i, Xb) = 0.7117                          Prob > F          =     0.0145
    
    ------------------------------------------------------------------------------
           log_y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           log_k |      .4882   .2737894     1.78   0.105    -.1218407    1.098241
         log_lab |     .23173   .1446211     1.60   0.140    -.0905058    .5539659
           _cons |   5.995513   2.918154     2.05   0.067    -.5065403    12.49757
    -------------+----------------------------------------------------------------
         sigma_u |  .42608895
         sigma_e |  .17589909
             rho |   .8543924   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(1, 10) = 14.88                      Prob > F = 0.0032
    
    ------------------------------------------------------------------------------------------------------------------------------------------
    -> CAE_2 = 47
    
    Fixed-effects (within) regression               Number of obs     =         34
    Group variable: NPC_FIC                         Number of groups  =          5
    
    R-squared:                                      Obs per group:
         Within  = 0.3614                                         min =          3
         Between = 0.8476                                         avg =        6.8
         Overall = 0.1940                                         max =         11
    
                                                    F(2,27)           =       7.64
    corr(u_i, Xb) = -0.7919                         Prob > F          =     0.0023
    
    ------------------------------------------------------------------------------
           log_y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           log_k |  -.6481316   .3414379    -1.90   0.068    -1.348704    .0524412
         log_lab |   .9562244   .2531165     3.78   0.001     .4368722    1.475577
           _cons |   17.39304   3.762073     4.62   0.000     9.673905    25.11218
    -------------+----------------------------------------------------------------
         sigma_u |  1.2249521
         sigma_e |  .31284565
             rho |  .93876775   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(4, 27) = 6.81                       Prob > F = 0.0006
    
    ------------------------------------------------------------------------------------------------------------------------------------------
    -> CAE_2 = 55
    
    Fixed-effects (within) regression               Number of obs     =         11
    Group variable: NPC_FIC                         Number of groups  =          1
    
    R-squared:                                      Obs per group:
         Within  = 0.6313                                         min =         11
         Between =      .                                         avg =       11.0
         Overall = 0.6313                                         max =         11
    
                                                    F(2,8)            =       6.85
    corr(u_i, Xb) =      .                          Prob > F          =     0.0185
    
    ------------------------------------------------------------------------------
           log_y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           log_k |    .378081   .1021634     3.70   0.006     .1424918    .6136702
         log_lab |   .0296618   .2382423     0.12   0.904    -.5197259    .5790495
           _cons |   7.964975   1.225918     6.50   0.000     5.138002    10.79195
    -------------+----------------------------------------------------------------
         sigma_u |          .
         sigma_e |  .17927439
             rho |          .   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(0, 8) = .                           Prob > F =      .
    
    ------------------------------------------------------------------------------------------------------------------------------------------
    -> CAE_2 = 56
    
    Fixed-effects (within) regression               Number of obs     =         32
    Group variable: NPC_FIC                         Number of groups  =          6
    
    R-squared:                                      Obs per group:
         Within  = 0.3197                                         min =          1
         Between = 0.6360                                         avg =        5.3
         Overall = 0.7239                                         max =          9
    
                                                    F(2,24)           =       5.64
    corr(u_i, Xb) = 0.6609                          Prob > F          =     0.0098
    
    ------------------------------------------------------------------------------
           log_y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           log_k |   .1225892    .199262     0.62   0.544    -.2886673    .5338456
         log_lab |   .3297077   .1024579     3.22   0.004     .1182451    .5411704
           _cons |   9.836956   2.104131     4.68   0.000     5.494243    14.17967
    -------------+----------------------------------------------------------------
         sigma_u |   .3881417
         sigma_e |  .17816116
             rho |  .82597477   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(5, 24) = 8.81                       Prob > F = 0.0001
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      I guess the error message is arising from prodest -- which you should explain as community-contributed. I have not used it but the error message leads me to suppose that you should be looking at the number of distinct values of year for each industry.

      Code:
      egen tag = tag(CAE_2 year) 
      egen distinct = total(tag), by(CAE_2) 
      
      tabdisp CAE_2, c(distinct)
      will on this guess show up an industry where you don't have enough data.

      Another take on the same problem

      Code:
      bysort CAE_2 (year) : gen same = year[1] == year[_N] 
      
      tab CAE_2 if same
      follows from this FAQ https://www.stata.com/support/faqs/d...ions-in-group/

      Comment


      • #4
        Dear Carlo & Nick,

        prodest is a comprehensive Stata module for production function estimation based on the control function approach by Gabriele Rovigatti. It has an improvement over the previous approaches, Olley-Pakes (OP 1996), Levinshon-Petrin (LP 2003), Wooldridge (WRDG 2009) and Ackerberg-Caves-Frazer (ACF 2015).

        Let me re-state the problem. This is the code to estimate for the whole industries (all together) which works perfectly. It runs prodest one time including all industries and for all predictions.
        Code:
          
          prodest log_y, free(log_lab) state(log_k) proxy(lnmaterials) va met(lp) att reps(50) id(NPC_FIC) t(year) predict out_lp, resid


        Now I am going to estimate for each industry separately, could you please adjust the above code for each industry?
        I mean I wish to run prodest command 8 times, each time including only a single value from the list of industries in the local macro --indus, and creating industry-specific predictions. So what would be the syntax in this case? Thank you for your ideas.

        Comment


        • #5
          Why would the bys solution proposed by Carlo not work here?

          Comment


          • #6
            Jared,
            Mainly because, I am not sure - xtreg ..., fe - does the -prodest -job ...
            Please explain if you disagree.

            Comment


            • #7
              I made specific suggestions in #3 which you don’t address. The error message you cite surely implies that you check out why it arises.

              Comment


              • #8
                Prof Nick,

                Code:
                . egen tag = tag(CAE_2 year) 
                
                . egen distinct = total(tag), by(CAE_2) 
                
                . tabdisp CAE_2, c(distinct)
                
                ----------------------
                    CAE_2 |   distinct
                ----------+-----------
                       10 |         11
                       11 |         11
                       13 |         11
                       14 |         11
                       15 |         11
                       16 |         11
                       17 |         11
                       18 |         11
                       19 |         11
                       20 |         11
                       21 |         11
                       22 |         11
                       23 |         11
                       24 |         11
                       25 |         11
                       26 |         11
                       27 |         11
                       28 |         11
                       29 |         11
                       30 |         11
                       31 |         11
                       32 |         11
                       33 |         11
                       41 |         11
                       42 |         11
                       43 |         11
                       45 |         11
                       46 |         11
                       47 |         11
                       55 |         11
                       56 |         11
                       62 |         11
                       63 |         11
                       68 |         11
                       69 |         11
                       70 |         11
                       71 |         11
                       72 |         11
                       73 |         11
                       74 |         11
                       75 |         11
                       77 |         11
                       78 |         11
                       79 |         11
                       80 |         11
                       81 |         11
                       82 |         11
                ----------------------
                
                . 
                end of do-file
                
                . do "C:\Users\35193\AppData\Local\Temp\STD3874_000000.tmp"
                
                . bysort CAE_2 (year) : gen same = year[1] == year[_N] 
                
                . tab CAE_2 if same
                no observations

                Comment


                • #9

                  Code:
                  Panel variable: NPC_FIC (unbalanced)
                  Time variable: year, 2010 to 2020, but with gaps
                  Delta: 1 unit
                  
                  . gen tfp_lp_output=.
                  (361,965 missing values generated)
                  
                  .
                  . set more off
                  
                  . local indus "10 11 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 41 42 43 45 46 47 55 56 6
                  > 2 63 68 69 70 71 72 73 74 75 78 79 80 81 82"
                  
                  .
                  . foreach industry of local indus{
                  2.
                  . di " `industry' "
                  3. prodest log_y if CAE_2==`indus', free (log_lab) state (log_k) proxy ( lnmaterials) va met (lp
                  > ) att reps (50) id (NPC_FIC) t (year)
                  4. predict out_lp, resid
                  5. replace tfp_lp_output=ln(out_lp)
                  6. drop out_lp
                  7. }
                  10
                  invalid '11' 
                  r(198);
                  
                  end of do-file
                  
                  r(198);
                  Code:
                  * Example generated by -dataex-. For more info, type help dataex
                  clear
                  input float(year CAE_2 ln_energy lnmaterials log_y log_k log_lab)
                  2010 56 10.273595 11.266246 11.074808 10.925884  10.93852
                  2011 56         .         .  10.80645 10.660196  10.93852
                  2013 56   8.30872  9.275587 10.290517 10.838875  10.93491
                  2014 56  9.836126 10.825533 10.672716 10.702727  10.93491
                  2015 56  8.722838  9.741929 10.649037 10.442463  10.93491
                  2016 56  8.887875  9.947309 10.694034 10.638208  10.93491
                  2017 56  8.837932  9.940253 10.557738 10.482205  10.93491
                  2018 56  8.902118 10.064003 10.862646 10.507858  10.93491
                  2019 56  9.206332 10.339158 11.154148  11.10125  10.93491
                  2011 47         .         .  9.813234 10.397268 10.774446
                  2010 56  10.94707 11.910075  11.77071 11.009853  10.93491
                  2011 56         .         . 11.717815 11.195581  10.93491
                  2012 56         .         . 11.493213 11.097713  10.93491
                  2013 56  9.327511  10.23167  11.29796 11.284694  10.93491
                  2014 56 10.700802 11.623674 11.522272 10.902225  10.93491
                  2015 56  9.699224  10.62239 11.632777 11.040006  10.93491
                  2016 56  9.949506  10.91029 11.759942  10.86754  10.93491
                  2017 56   10.2613 11.245886  11.96535 10.957486  10.93491
                  2018 56  9.971663 11.001667 11.902343 11.069276  10.93491
                  2019 56  9.599328 10.677728 11.544685  11.12535  10.93491
                  2010 10  9.347517 10.456385 11.863244 12.526605 9.2791195
                  2011 10         .         .  11.54864 12.515446 9.2791195
                  2012 10         .         . 11.232775  12.74003 9.2791195
                  2013 10  7.689117  8.756804 11.275455 12.664285 9.2791195
                  2014 10  8.812205  9.918517 11.269477 12.699335 9.2791195
                  2015 10  7.919176   9.04157  11.59814 12.360273 9.2791195
                  2016 10  8.167966 9.3204975 11.716307  12.39719 9.2791195
                  2017 10  8.548487  9.697294 11.962924 12.371113 9.2791195
                  2018 10  7.383268  8.676226 10.717458 12.705137 9.2791195
                  2019 10  2.736221 4.4375963  5.976351 12.529753 9.2791195
                  2020 10   3.78419  5.391352   7.07327 12.768929 9.2791195
                  2010 56  9.977333 11.073888  10.83058   9.65509 10.934944
                  2011 56         .         . 10.510695  9.780246 10.934944
                  2012 56         .         . 10.081926  9.912397 10.934944
                  2012 46         .         .   8.94468  10.16227 10.751927
                  2013 46  6.330315  7.815835  9.226607    10.342 10.751927
                  2014 46  7.261426  8.787003  9.030017  10.16881 10.751927
                  2015 46  6.195617  7.762381  9.065546 10.167735 10.751927
                  2016 46  6.419919  8.015435  9.160099  10.23853 10.751927
                  2017 46  6.653504  8.226238  9.242711 10.317846 10.751927
                  2018 46  5.338918  6.923107  8.120886  9.611731 10.751927
                  2013 41 1.6739764  4.376456  5.733341  8.443762 10.623763
                  2010 47  7.681906  9.322133  9.472936 10.493272 10.774153
                  2011 47         .         .  9.325453 10.399464 10.774153
                  2013 47  6.185751   7.67105  9.082052 10.242208 10.774153
                  2014 47  7.146772  8.672486  8.915432 10.091252 10.774153
                  2015 47  6.157566   7.72439  9.027618  10.14073 10.774153
                  2010 69  7.133396  9.744272 10.388133  9.556409 11.144756
                  2010 55  11.66028 12.662325 12.565253 11.753516 10.917105
                  2011 55         .         . 12.450398 11.647133 10.917105
                  2012 55         .         . 12.139992 10.778436 10.917105
                  2013 55  9.877782 10.765712  11.88397  10.78808 10.917105
                  2014 55 11.013628 11.922363 11.872953 10.697565 10.917105
                  2015 55  10.06564 10.988786 11.999178 10.758796 10.917105
                  2016 55 10.351838 11.312615 12.162277  10.58633 10.917105
                  2017 55  10.65251 11.637093 12.356546   10.6763 10.917105
                  2018 55 10.515143 11.539842 12.482655 11.849655 10.917105
                  2019 55  10.61645  11.70076 12.609866  11.96744 10.917105
                  2020 55  10.10078 11.185262 12.185753  11.54637 10.917105
                  2010 47  8.290135  9.764585  10.12691 10.864503 10.773734
                  2011 47         .         .  9.977667 10.778602 10.773734
                  2012 47         .         .  9.615405 10.541545 10.773734
                  2013 47   6.92625  8.411635  9.822657 10.795793 10.773734
                  2014 47  7.875282  9.400371  9.643291  10.62823 10.773734
                  2015 47  6.482289  8.049168 9.3524475  10.38056 10.773734
                  2016 47  6.539384  8.134774 9.2791195 10.326923 10.773734
                  2017 47  6.742506  8.315345  9.331761 10.383627 10.773734
                  2018 47   6.57833   8.16178  9.359364 10.391116 10.773734
                  2019 47  6.422319   8.03971  9.206634 10.358124 10.773734
                  2014 15  6.217461  7.788567  8.224432  10.59988  9.629116
                  2015 15  5.180225   6.73293  8.294049 10.596985  9.629116
                  2018 15  5.126985  6.719227  8.121778 10.589912  9.629116
                  2010 47  7.280396   8.92099  9.071882 10.196157 10.760283
                  2011 47         .         .    9.1935 10.304342 10.760283
                  2012 47         .         .  9.067624 10.242314 10.760283
                  2013 47  6.413095   7.89804  9.309009 10.400772 10.760283
                  2014 47  7.584337  9.109731  9.352708 10.401745 10.760283
                  2015 47     6.793  8.359902  9.663071 10.627625 10.760283
                  2016 47  6.652863  8.248553  9.392829 10.413823 10.760283
                  2017 47  6.949266  8.522082  9.538421 10.541967 10.760283
                  2018 47  6.869462  8.453199  9.650786 10.620546 10.760283
                  2019 47  6.871091 8.4884405  9.655218  10.68093 10.760283
                  2010 56 11.024325 11.987343 11.847976  10.72867  10.93491
                  2011 56         .         . 12.205242  10.91438  10.93491
                  2012 56         .         . 11.871956 10.778436  10.93491
                  2013 56  9.896731 10.784653 11.902898  10.78808  10.93491
                  2014 56  11.07884  11.98757 11.938154 10.697565  10.93491
                  2015 56 10.044626 10.967772 11.978162 10.758796  10.93491
                  2016 56 10.322025  11.28281 12.132475  10.58633  10.93491
                  2017 56 10.546003 11.530596 12.250051   10.6763  10.93491
                  2018 56 10.308474 11.338487 12.239155  10.78808  10.93491
                  2019 56 10.162307  11.24069  12.10765 10.844178  10.93491
                  2010 47  9.009791 10.424974 11.012033 11.638924 10.769327
                  2011 47         .         . 10.919623 11.564075 10.769327
                  2012 47         .         .    10.733  11.29941 10.769327
                  2013 47   7.41028   8.72287  10.49709 11.122058 10.769327
                  2014 47  8.356689  9.682573 10.288852 10.953977 10.769327
                  2015 47  7.282387  8.714582 10.227562 10.936975 10.769327
                  2016 47  7.287704  8.754652  10.10696 10.843084 10.769327
                  2017 47  7.373611  8.835141 10.057281  10.79927 10.769327
                  end

                  I guess the problem is something related to the line which indicates to -each industy-

                  Comment


                  • #10
                    So, #3 is not enlightening, but why you got the error message doesn't appear to be explained yet.

                    Meanwhile, you have changed your code around. The immediate problem is that you need

                    Code:
                     
                     prodest log_y if CAE_2==`industry'
                    and so on.

                    Comment


                    • #11
                      Originally posted by Nick Cox View Post

                      Code:
                      prodest log_y if CAE_2==`industry'
                      .
                      You are right. This time nothing happened with this:
                      Code:
                      . foreach industry of local indus{
                        2.            
                      .           prodest log_y  if CAE_2==`industry', free (log_lab) state (log_k) proxy ( lnmaterials) va met (lp) att reps (50) id (NPC_FIC) t(year)
                        3.           predict out_lp, resid
                        4.           replace tfp_lp_output=ln(out_lp)
                        5.           drop out_lp
                        6. }
                      
                      end of do-file
                      when I run for the whole Industry:
                      Code:
                       prodest log_y, free (log_lab) state (log_k) proxy ( lnmaterials) va met (lp) att reps (50) id (NPC_FIC) t(year)
                      .........10.........20.........30.........40.........50
                      
                      
                      lp productivity estimator                       Cobb-Douglas PF
                      
                      Dependent variable: value added                 Number of obs      =    290891
                      Group variable (id): NPC_FIC                    Number of groups   =     98873
                      Time variable (t): year
                                                                      Obs per group: min =         1
                                                                                     avg =       2.9
                                                                                     max =         9
                      
                      ------------------------------------------------------------------------------
                             log_y | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
                      -------------+----------------------------------------------------------------
                           log_lab |  -.3490436   .0062739   -55.63   0.000    -.3613401    -.336747
                             log_k |   .3204766   .0088053    36.40   0.000     .3032185    .3377346
                      ------------------------------------------------------------------------------
                      Wald test on Constant returns to scale: Chi2 = 8575.99
                                                                p = (0.00)
                      It works.
                      Probably I should ask Gabriele, I guess he is still active in the community.




                      Last edited by Paris Rira; 26 Feb 2023, 13:27.

                      Comment

                      Working...
                      X