Announcement

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

  • Solving nonlinear function in Stata

    Hi everyone,

    I'm trying to generate a variable (r) using an implicit expression. The equation is:
    (W - P + 20000)^(1-r) + (W - P)^(1-r) = 2*W^(1-r)

    W and P are both existing variables in my dataset, but I'm not sure how to generate r without making it the subject of the equation. Would such a problem require the use of nl or ml?

    Thanks!

  • #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.

    It is not clear to me (perhaps my ignorance of your area) what exactly you mean r to be. If it is a parameter, then nl or ml are the most promising approaches. However, you may need to transform the equation somehow to not have r on both sides of the equation. A brute force approach could do a loop over values for r that looked for the smallest error term.

    Comment

    Working...
    X