Announcement

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

  • What does small change mean in the dydx command

    The following seems to be true:

    a) If after you run a regression (non-linear), you manually use the predict command for a particular independent variable and then make an epsilon change in that variable and get a new prediction, then the difference between the prediction s(divided by epsilon) is approximately the same result as using margins, dydx, but

    b) If after you run a regression and then use the margins command to get two predictions, the predictions need to be a unit (the number 1) difference in the independent variable to approximate the margins, dydx command.

    Two questions:

    1) Is this generally true, and

    2) Why is it true?

  • #2
    It depends on the type of variable. If the variable is continuous (entered with c. in the regression) then Stata calculates the marginal effect by treating the coefficient as a derivative (or, for non-linear regressions calculates the derivative) and reports that result. If the variable is discrete (entered with i. in the regression) Stata reports the difference between the values with the variable = 1 and the variable = 0 as the marginal effect.

    You will find a more detailed explanation if you read the PDF documentation that comes installed with your Stata. Open the chapter on -margins- and then click on the link to Methods and Formulas. From there click on the link for marginal effects.

    Comment


    • #3
      Clyde, It was two of your posts that generated my question. I know that for factor variables the change is 1 by definition, but my question related to continuous independent variables.

      Comment


      • #4
        OK, I may have misunderstood what you were asking in my original response.

        The marginal effect of x on y, where y = f(x) is just another name for the first derivative, dy/dx. So if you calculate y at a base value of x and then calculate y at a base value of x + delta x, then delta y/delta x will, if epsilon is sufficiently close to zero, be approximately dy/dx at the base value of x. That follows directly from the derivative being defined as the limit as delta x goes to zero of the Newton quotient. So that explains your first finding in a) in #1.

        Now let's look at the second one. We have to separately consider two cases. The first case is that f is a purely linear function of x. In this case, dy/dx = coefficient of x, and, in particular, it is independent of the value of x itself. If you calculate y at two values x and x + delta x, then delta y = (dy/dx) * delta x, exactly due to the linearity, and consequent constancy of dydx, we have presupposed here. It follows that for the difference in the calculated values of y to equal the marginal effect, we must have delta x = 1 since, as pointed out, the marginal effect is dy/dx.

        So your observation b) in #1 holds for linear functions, and this explains why.

        The second case is where f is a non-linear function of x. In this case, dy/dx will not be a constant: its value can change as x changes. Now if we calculate y at x and x + delta x we get delta y = integral from x to x + delta of f'(x) dx. The value of this can be pretty much anything depending on how much f'(x) varies over the range from x to x + delta, and how big delta is. In any event, this is not necessarily going to turn out to be equal to dy/dx except coincidentally.

        Comment

        Working...
        X