Announcement

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

  • How to write the nonlinear least squares syntax when the equation involves taking minimum?

    Dear all,

    My data set contains variables Y and X1, X2, X3, and I would like to estimate the following model:

    Y= a + b * min {c1 * X1, c2 * X2, c3 * X3} + epsilon

    where a, b, and c1, c2, c3 are parameters to be estimated, and epsilon is the error term.

    I'm wondering how this can be done in Stata? How shall I write the -nl- syntax?

    Thanks!

  • #2
    At a guess

    Code:
     
    nl (Y = {a} + {b} * min({c1}*X1, {c2}*X2, {c3}*X3))
    The Laws of nl:

    1. Nonlinear models are difficult to fit.
    2. Nonlinear models are difficult to fit, even if you know Law 1.
    3. ...


    Comment


    • #3
      It worked. Thanks a lot, Nick. Now I'm regretting I should have tried it before posting the question since the answer is so straightforward...

      Comment


      • #4
        It never stops. All my mistakes and bugs are trivial too once I work out what they are.

        Comment

        Working...
        X