Announcement

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

  • Giorgio Presidente below you can find a suggestion that uses the locals storing the number of state, free, control, and interaction variables - in prodest I save such locals here and there, you may easily find out their names and use them upfront without re-generating them. As you'll see, I am not an expert in Mata, so probably some Mata nerd might help you further in cleaning the code and making it more efficient.

    Best,

    Gabriele

    loc varnum: word count `state' `free'
    loc contrnum: word count `control'
    loc interactnum: word count `interactionvars'

    mata V = J(1, `varnum', 1) , J(1, `contrnum', 0), J(1, `interactnum', 1)
    mata Cc = vec(V)'

    Comment


    • Dear Gabriele,

      Is there any set up such that the (lp) prodest command + the ACF correction deliver (of course, conditionally to the specified options) the same results delivered by the acfest command with material inputs as proxy variable?
      I would like to implement the ACF methodology to estimate the production function and firms' productivity, and I am not sure what causes the differences between the results from the two commands and, therefore, I can't decide which one should be more suited.

      In terms of the acfest command:

      acfest depvar [if] [in], free(varlist) state(varlist) proxy(varname) [i(varname) t(varname) intmat(varlist) invest nbs(#) robust nodum second va overid]

      I write:

      acfest va, free(labor) state(capital age) proxy(materials) i(firm_id) t(year) nbs(100) va [robust second overid] --- (where the terms in the last brackets are eventually added in some models, to be confirmed)

      In terms of the prodest command:

      prodest depvar [if] [in], method(lp) free(varlist) proxy(varlist) state(varlist) [LP_options]

      I write:

      prodest va, method(lp) free(labor) proxy(materials) state(capital) control(age) acf valueadded reps(100) [poly(2)] --- (again, the second order polynomial rather than the default poly(3) is just a possibility to be confirmed)

      Maybe I am missing something from the available options, would you be able to help me understand how to match, if possible, the two commands, or, if matching the results is impossible, the reson for that?

      For instance, using:

      insheet using "https://raw.githubusercontent.com/GabrieleRovigatti/prodest/master/stata/data/prodest.csv", names clear

      acfest va, free(labor) state(capital) proxy(materials) i(firm_id) t(year) nbs(100) va
      predict omegaacfest, omega

      prodest va, method(lp) free(labor) proxy(materials) state(capital) acf valueadded reps(100) fsresiduals(fs_lpacf)
      predict omegaprodest, omega

      histogram omegaacfest
      (bin=34, start=3.6447482, width=.27814338)

      histogram omegaprodest
      (bin=34, start=6.0094843, width=.12201573)


      I get quite different coefficients and productivities. Maybe I did not get a fundamental difference between the two methods.

      I thank you very much in advance for your suggestions. Also thank you, and many compliments, for your work on the package!

      Enrichetta

      Comment


      • Dear Enrichetta,

        to my knowledge, the syntax that you proposed is rather similar, but with a couple of - potentially estimate-driving - differences: first, you could add the "age" variable among the state variables in prodest as well (unless I miss something); second, a source of - potentially big - difference between the two estimates could be the fact that the definition of "omega" differs across the two predicts: if I am not mistaken - and please note that I could - acfest's omega amounts to the difference between the outcome and the fitted parameters (i.e., y - beta_l*l - beta_k*k), whereas prodest's omega also subtracts the first-stage residuals (y - beta_l*l - beta_k*k - epsilon). Hence, to ensure a full comparison, you should use the residual option with prodest instead of omega.

        Finally, you surely know that the ACF method, in empirical applications, suffers from optimization issues that are rarely taken into account, but are nonetheless well-known and potentially estimate-driving (see discussions above for references to recent contributions on JAE, or refer to prodest companion paper for simulation studies on the topic). Since the two routines use different optimization functions, and rather different optimizers, even huge differences in the estimated parameters might be obtained with (in principle) equally-specified models.

        I hope to have clarified,

        Gabriele

        Comment


        • Dear Gabriele, thank you for your prompt reply! You have been extremely clear and helpful indeed.
          Grazie mille,
          Enrichetta

          Comment


          • Dear Gabriele,

            Thanks for your great work.

            I am trying to use acf correction methodology + translog specification to construct the firm-level markup variable.

            during the work, I found that the estimates vary evertime I run the same codes if I use acf option.

            for example, with the sample codes in help files.

            ************************************************** ************************************************** ****************************************

            . insheet using https://raw.githubusercontent.com/Ga...ta/prodest.csv, names clear
            (8 vars, 2,544 obs)

            . prodest log_y, free(log_lab1 log_lab2) state(log_k) proxy(log_materials) va met(lp) acf reps(50) id(id) t(year)
            .........10.........20.........30.........40...... ...50


            lp productivity estimator Cobb-Douglas PF
            ACF corrected
            Dependent variable: value added Number of obs = 2544
            Group variable (id): id Number of groups = 497
            Time variable (t): year
            Obs per group: min = 1
            avg = 5.1
            max = 11

            ------------------------------------------------------------------------------
            log_y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            log_lab1 | .5503839 .0605424 9.09 0.000 .4317231 .6690448
            log_lab2 | .4166615 .0910942 4.57 0.000 .2381201 .5952029
            log_k | .4741256 .0487641 9.72 0.000 .3785497 .5697015
            ------------------------------------------------------------------------------
            Wald test on Constant returns to scale: Chi2 = 75.72
            p = (0.00)

            . prodest log_y, free(log_lab1 log_lab2) state(log_k) proxy(log_materials) va met(lp) acf reps(50) id(id) t(year)
            .........10.........20.........30.........40...... ...50


            lp productivity estimator Cobb-Douglas PF
            ACF corrected
            Dependent variable: value added Number of obs = 2544
            Group variable (id): id Number of groups = 497
            Time variable (t): year
            Obs per group: min = 1
            avg = 5.1
            max = 11

            ------------------------------------------------------------------------------
            log_y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            log_lab1 | .5638517 .109842 5.13 0.000 .3485653 .7791381
            log_lab2 | .3208906 .1419238 2.26 0.024 .042725 .5990562
            log_k | .5253261 .1440259 3.65 0.000 .2430406 .8076116
            ------------------------------------------------------------------------------
            Wald test on Constant returns to scale: Chi2 = 11.53
            p = (0.00)

            . ************************************************** ************************************************** ****************************************

            What brings this pattern, and how can I fix the estimation results?

            This also happens when I use markupest packages.

            Thanks in advance for your answer.

            regards,

            Donghan

            Comment


            • Dear Gabriele,

              At first, thank you for providing the prodest command. But, I have one questions about this command. In old command -opreg-, we use exit(varname) denoting firm exiting. So we can deal with the selection bias between productivity shocks and probability of firm exiting from market by introducing firm survival probability model .

              But in -prodest- command, I do not know how to indicate firm exiting and deal with the problem selection bias. When I add attrition option, the output shows "No ID exits the sample. Running the estimation with no attrition". How can I use the -prodest- command control for selection bias in estimating tfp?

              Thank you and I really to hear from you,
              regards,
              Min Cheng

              Comment


              • Dear Min,

                I am glad that you found prodest useful.

                Unlike opreg, prodest deals with the attrition "automatically" - i.e., you do not need to specify an exit binary variable, as it is computed automatically checking whether or not the last observed entry for every individual is equal to the last date in the sample.

                An example may help: consider a panel with N firms observed at time t = 1, 2,...,T.When you specify the attrition option, prodest creates a variable exit that is 1 whenever the latest observed time of individual i (say, T_{i}) is different from the latest observed time T.

                The command prompts the message in your message whenever no ID in the estimation sample satisfies the above criterion (i.e., all i exit at T).

                I hope to have clarified,

                Gabriele

                Comment


                • Dear Gabriele

                  Thanks for your reply, -prodest- command has a more convenient way to handle sample selection bias than -opreg-. After I rearranged the data, att option has no error. Thanks again for your help!

                  regards,
                  Min Cheng

                  Comment


                  • Originally posted by dh shin View Post
                    Dear Gabriele,

                    Thanks for your great work.

                    I am trying to use acf correction methodology + translog specification to construct the firm-level markup variable.

                    during the work, I found that the estimates vary evertime I run the same codes if I use acf option.

                    for example, with the sample codes in help files.

                    ************************************************** ************************************************** ****************************************

                    . insheet using https://raw.githubusercontent.com/Ga...ta/prodest.csv, names clear
                    (8 vars, 2,544 obs)

                    . prodest log_y, free(log_lab1 log_lab2) state(log_k) proxy(log_materials) va met(lp) acf reps(50) id(id) t(year)
                    .........10.........20.........30.........40...... ...50


                    lp productivity estimator Cobb-Douglas PF
                    ACF corrected
                    Dependent variable: value added Number of obs = 2544
                    Group variable (id): id Number of groups = 497
                    Time variable (t): year
                    Obs per group: min = 1
                    avg = 5.1
                    max = 11

                    ------------------------------------------------------------------------------
                    log_y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                    log_lab1 | .5503839 .0605424 9.09 0.000 .4317231 .6690448
                    log_lab2 | .4166615 .0910942 4.57 0.000 .2381201 .5952029
                    log_k | .4741256 .0487641 9.72 0.000 .3785497 .5697015
                    ------------------------------------------------------------------------------
                    Wald test on Constant returns to scale: Chi2 = 75.72
                    p = (0.00)

                    . prodest log_y, free(log_lab1 log_lab2) state(log_k) proxy(log_materials) va met(lp) acf reps(50) id(id) t(year)
                    .........10.........20.........30.........40...... ...50


                    lp productivity estimator Cobb-Douglas PF
                    ACF corrected
                    Dependent variable: value added Number of obs = 2544
                    Group variable (id): id Number of groups = 497
                    Time variable (t): year
                    Obs per group: min = 1
                    avg = 5.1
                    max = 11

                    ------------------------------------------------------------------------------
                    log_y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                    log_lab1 | .5638517 .109842 5.13 0.000 .3485653 .7791381
                    log_lab2 | .3208906 .1419238 2.26 0.024 .042725 .5990562
                    log_k | .5253261 .1440259 3.65 0.000 .2430406 .8076116
                    ------------------------------------------------------------------------------
                    Wald test on Constant returns to scale: Chi2 = 11.53
                    p = (0.00)

                    . ************************************************** ************************************************** ****************************************

                    What brings this pattern, and how can I fix the estimation results?

                    This also happens when I use markupest packages.

                    Thanks in advance for your answer.

                    regards,

                    Donghan
                    hi all, I'm new member. Sorry, if my question seems to be so basic or not appropriate. I notice this question hasn't been answered yet. I also face the same issue. Every time I repeat the command, the result seems to change dramatically. Also any help about what the interaction variable refers to? What i mean is that for example, when the interaction variable show var_1_1 what input does this variable refers to?

                    Thanks

                    Comment


                    • Dear Riandy,

                      I copy/paste below the answer to Donghan sent directly to him by email

                      Dear Donghan,




                      I am glad that you found prodest useful.




                      Unfortunately, the issue that you describe is a rather well-known characteristic of the ACF method (see a recent contribution here for a full-fledged explanation of the reasons underlying these results, or the prodest companion paper here for an empirical application showing the problem). To fix the issue, I'd suggest to either use a different optimizer - see the available options by looking at prodest helpfile - or setting the seed to ensure reproducibility.




                      Best,




                      Gabriele

                      Comment


                      • Gabriele Rovigatti Ciao Gabriele,

                        If I include any variable in the control() option, I get all missing observations for estimated TFP.

                        Here is my code:

                        levelsof sector2dig,local(xsector)

                        foreach x of local xsector {

                        prodest va if sector2dig=="`x'", free(l) state(k) proxy(m) valueadded met(lp) control() endogenous(Lstock_emp2006 Lstock_emp2006_midskill) translog acf reps(50) poly(3) fsresiduals(fs_acf_op)

                        predict tfpACFFBR_s`x',resid

                        gen fs`x' = fs_acf_op

                        drop fs_acf_op
                        }

                        So essentially, I cannot use the "predict" option to get my TFP. Notably, the problem occurs only with the translog option. Any idea on why that happens?


                        Currently, I get around the problem by computing "manually" TFP, i.e. using the parameter estimates and subtracting predicted VA from actual VA. Is that procedure correct?

                        Thanks in advance for your help,

                        Best
                        Giorgio





                        Comment


                        • Ciao Giorgio,

                          tbh, I am not sure why you could not retrieve the TFP with predict - it might be due to the contemporaneous use of control() and endogenous(). Your solution, though, seems legit: the TFP you are looking for is (residuals) is in fact calculated as you describe. There is, however, a different definition of TFP (predict <newvar>, omega with prodest postestimation) which also subtract the first-stage residuals from the observed output, and is more broadly used.

                          I hope to have clarified,

                          Gabriele

                          Comment


                          • Hi,

                            a further improvement of the package could be an extension of the 'predict, parameters' that stores the firm-level marginal effects obtained by translog in separate objects. Then, one can also analyse and plot them.

                            best

                            Comment


                            • Dear Gabriele, may I ask why prodest generate much smaller number of ACF productivity than other methods like Levinsohn and Petrin and Wooldridge, please? The variables I'm using to generate these three versions of productivity are exactly the same, but L&P and Wooldridge methods give many more predicted productivity than the ACF version. Could you enlighten me, please? The version of prodes I use is the newest version, but I couldn't figure this out. Thank you very much.

                              * Levinsohn and Petrin method

                              * using turnover
                              gen prodest_lp_rev = .

                              foreach i of numlist 10(1)43 {
                              capture {
                              prodest lr if nace2 == `i', free(ll) state(lk) proxy(lm) met(lp) opt(dfp) reps(50) id(id) t(year)
                              predict temp if e(sample), resid
                              replace prodest_lp_rev = temp if nace2 ==`i'
                              drop temp
                              }
                              }

                              label var prodest_lp_rev "Prodest produced Levinsohn and Petrin method productivity, revenue"


                              * ACF

                              * using turnover
                              gen prodest_acf_rev = .

                              foreach i of numlist 10(1)43 {
                              capture {
                              prodest lr if nace2 == `i', free(ll) state(lk) proxy(lm) met(lp) acf opt(dfp) reps(50) id(id) t(year)
                              predict temp if e(sample), resid
                              replace prodest_acf_rev = temp if nace2 ==`i'
                              drop temp
                              }
                              }

                              label var prodest_acf_rev "Prodest produced Ackerberg, Caves and Frazer correction productivity, revenue"

                              Comment


                              • Originally posted by Philipp Steinbrunner View Post
                                Hi,

                                a further improvement of the package could be an extension of the 'predict, parameters' that stores the firm-level marginal effects obtained by translog in separate objects. Then, one can also analyse and plot them.

                                best
                                Dear Philipp,

                                thanks for the suggestion! I will add this as soon as I will release a newversion - that would be indeed very helpful.

                                Best,

                                Gabriele

                                Comment

                                Working...
                                X