Announcement

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

  • Estimating Total Factor Productivity for panel data in Stata

    Hi,
    I am a new STATA 15 user. I am doing my assignment on estimating the Total Factor Productivity for panel data in STATA using different methods, such as OLS, Olley and Pake, Ackerberg, Levinsohn and Petrin, and Woodridge. I have some questions as following:
    1) I am wondering that it is acceptable to apply the user-developed command such as opreg, levpet, acfest or prodest directly.

    2) When I try to run levpet, it always shows the error "repeated time values within panel" even if there is no error when I declare it as panel data. I also checked the duplicates.

    3) My data is as this picture. I need to estimate TFP by sub-sectors, for example, isic2=25. When I ran an OLS:

    regress va k l m if isic==25
    predict TFP_25, resid

    I found that the residuals (TFP_25) are calculated for all of the sub-sectors, not only the isic2=25.

    Kindly help me to solve these issues. Thank you so much.


    Last edited by Yen Ng; 27 Nov 2019, 01:45.

  • #2
    Yen:
    as this is not your first post, I should already be aware of:
    - questions concerning class/home assignments are deprecated on this forum;
    - posting scheenshots is also deprecated, as they're impossible to elaborate on.
    All that said:
    1) it's perfectly legal to use community-contributed commands
    2) see -xtset- entry in Stata .pdf manual;
    3) see -regress postestimation- entry in Stata .pdf manual.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo,
      Thanks so much for your comment. It is actually my first post. I tried to edit it, and somehow it made my posts become 3.
      For the screenshots, I have just deleted it. Thank you for the notice and I will be more cautious before posting a question.
      I will follow your advice and come back for the results.
      Best regards,
      Yen

      Comment


      • #4
        Hi Carlo,
        I am sorry for this late reply.
        For the second question. It did not show any error when I ran xtset, also there was no duplication.
        However, I found a solution, posted by Brian Poi, using this code:

        Code:
        gen newid = group(id)
        I run the levpet command using the newid as panel identifier and it worked. Poi explained that "the panel identifier variable took on values with more than about 7 digits. The code generates a temporary panel variable of storage type float".

        For the regression for each sector, I tried to use loop, but stata did not run, neither showed any error. Please advise.
        Code:
        levelsof isic2, local(levels)  foreach x of local levels{ capture reg lnva lnm lnk lnl if isic2==`x' predict lnTFP_`x'_OLS, resid
        Thank you so much Carlo.

        Yen

        Comment

        Working...
        X