Announcement

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

  • Using non-linear regression to remedy serial correlation in Stata

    Hi!

    I am trying to run a non-linear regression in Stata using the nl command. The reason I am running the regression is that my data exhibits serial correlation - AR(1). I use the following command.

    nl (m = {b0}+ {b1}*lagm + {b2}*y + {b3}r ({b10}){b4}lagy + ({b10}){b5}lagy + ({b10}){b6}*lag2m), initial(b0 0 b1 0.9 b2 0.09 b3 -0.0055 b4 0 b5 0 b6 0.5 b10 0), if A>2

    However, I get the error

    "error #198 occurred in evaluating expression invalid '(' starting values invalid or some RHS variables have missing values"

    I have tried to change the initial values several times and I have, as you can see, made sure that missing values are no problem for the lagged variables.

    Best,

  • #2
    I don't understand what you exactly want to do and I get a different error than yours. Yet, your error may arise because you have omitted sometimes the * for a multiplication (I assume).
    This line should work:
    Code:
    nl (m = {b0}+ {b1}*lagm + {b2}*y + {b3}*r *({b10} ) * {b4} * lagy + ({b10}) * {b5} * lagy + ({b10}) * {b6}*lag2m), initial(b0 0 b1 0.9 b2 0.09 b3 -0.0055 b4 0 b5 0 b6 0.5 b10 0), if A>2
    Best,

    Aljar

    Comment

    Working...
    X