Announcement

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

  • Translog cost function using foreach and one_id program

    Hi,

    I have a panel of 270 firms with quarterly observations ranging from year 2000 to 2019.

    I want to run the following trans-log cost function for each of the firm using foreach and one_id program. Can anyone inform me of the correct syntax please as mine did not work and gave errors for all groups.

    lnTC = a+ a1lnW12 +1/2 a2lnW3+ a3lnW12 *lnW3+ a4lnTA + 1/2a5(lnTA)2 +a6lnTA*lnW12+ a7lnTA*lnW3 + e

    where, a denotes alpha (coefficients) in the above equation. TC=total cost, W12 and W3 are the prices of labor and capital, TA = total assets, e is the error term

    Regards
    Last edited by Aamina Khurraa; 11 Feb 2020, 08:00.

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions- provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    Have you googled translog stata? There might be a program for it. Otherwise, nl should do it. However, with 10 observations per firm and 8 parameters, I can't see that you would get meaningful estimates. As for looping over all the firms, I'm sure there is an efficient way to do it, but inefficiently, you can delete so you only have one observation per firm, write out the id's, use word or something to turn the id's into a list and do a forvalues loop over the list.

    Comment


    • #3
      The user-written rangestat program might be able to do what you want as well.

      Comment


      • #4
        Hi Phil

        Thanks for your reply.

        Unfortunately the rangestat is entirely a different thing. The number of observations as you mentioned in #2 are not 10 per firm, they are quarterly data as mentioned in #1.

        Anyways I did manage to run the for each loop.

        My only concern now is that what does the number 1/2 or 0.5 means in the below regression equation. Do I have to incorporate this fraction while running regression, for which I don't see any way around. I have tried to put 0.5 with the independent variable (lnTA)2 ut can't run the simple reg command in stata with this.

        lnTC = a+ a1lnW12 + a2lnW3+ a3lnW12 *lnW3+ a4lnTA + 1/2a5(lnTA)2 +a6lnTA*lnW12+ a7lnTA*lnW3 + e

        Comment


        • #5
          My only concern now is that what does the number 1/2 or 0.5 means in the below regression equation.
          You need to multiply the variable by 0.5. See how I do this in #5 of the link below:

          https://www.statalist.org/forums/for...ata-estimation

          Comment


          • #6
            Thanks Andrew. this worked for me.

            Comment

            Working...
            X