Announcement

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

  • moptimize for simultaneous equations

    Hi,

    I am trying to jointly estimate two equations using moptimize, but I am having some troubles.

    Let's say that my log likelihood function is llf=llf1+llf2, where 1 and 2 denote the first and the second equation, respectively.

    The second equation employs a set of covariates, let's say X2, and a covariate Z=f(beta1hat) that is a function of the estimated coefficients in equation 1.

    Inside the evaluator gf0, I specify the independent variables of the second equation as:

    (Z(beta1hat),moptimize_util_xb(M, b, 2))

    where moptimize_util_xb represents X2.

    If I remove Z(beta1hat) from the independent variables of the second equation, I can jointly estimate llf.

    However, if I use Z(), I have a "conformability error". Note that I am sure that my definition of Z() is correct since I used it in a two-step estimator procedure without any problem.

    Any help is greatly appreciated.

    Many thanks.

    Simone


  • #2
    I think the problem is when I define the independent variables in the second equation: X2 plus Z(). Is there a way to tell Mata to take one independent variable, that is Z, from inside the evaluator function? Something like: moptimize_init_eq_indepvars(M, 2,(X2,Z)) where Z represents the variable defined inside the evauator.

    Many thanks.

    Comment

    Working...
    X