Announcement

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

  • Estimating marginal cost using -margins-

    Dear all,

    I'm estimating a translog function of the following basic form:

    Code:
    reg ln_TOC ln_w1 ln_w2 c.ln_y1##c.ln_y2##c.ln_y3
    With y? being the output quantities, w? being the input prices, and TOC being the total operating cost.

    I then want to calculate the marginal cost. I know that I could do it manually by taking the first derivate and using the estimated coefficients. However, I'm estimating many different specifications of the cost function. Therefore, I was wondering if there is a way to use a Stata command. I need to store the marginal cost of every individual in a variable. Due to the interaction terms, the marginal cost will be different for every individual. The standard output of -margins, dydx(ln_y?)- is the average marginal effect over the entire sample, but I need to have it separately.

    I appreciate any suggestions. Thank you!

    Best wishes,
    Sebastian

  • #2
    Hi Sebastian,
    perhaps what you need is the option "gen" from margins:
    Code:
    sysuse auto, clear
    reg price c.mpg##c.mpg##c.mpg
    margins, dydx(mpg) gen(mfx)
    HTH

    Comment


    • #3
      Originally posted by FernandoRios View Post
      Hi Sebastian,
      perhaps what you need is the option "gen" from margins:
      Code:
      sysuse auto, clear
      reg price c.mpg##c.mpg##c.mpg
      margins, dydx(mpg) gen(mfx)
      HTH
      Indeed that's what I needed. Thank you a lot. Sometimes it is really simple. I'm wondering why this option is not described in the help documentation.

      Comment


      • #4
        It's not in the documentation because StataCorp has not committed to making this a regular feature of the -margins- command going forward. You will find it listed in the output for -help undocumented-, along with many other undocumented commands, some of which are amazingly useful! You can use these undocumented commands and options, with the caveat, that at some future time, Stata may discontinue them and previously written code using them will break.

        Comment

        Working...
        X