Announcement

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

  • optimize_couldn't find feasible value

    Dear listers,

    I'm trying to solve this problem with mata language.Please see the attached.

    My code for solving this is as follows.


    mata:

    mata clear
    function linregeval(transmorphic M, real rowvector b, real colvector lnf)
    {
    real scalar rho
    p1 = moptimize_util_xb(M,b,1)
    p2 = moptimize_util_xb(M,b,2)
    y1 = moptimize_util_depvar(M,1)
    y2 = moptimize_util_depvar(M,2)
    n =rows(X)
    W = st_data(., "splag")
    I = I(100)
    K = (y11:-(y2:-rho:*p2))
    T= -(n:/2):*ln(3.141592):- (n:/2):*ln(1:/n):*K'*K + ln(I:- rho:*W)

    lnf = T
    }

    M = moptimize_init()
    moptimize_init_search_random(M, on)
    moptimize_init_evaluator(M, &linregeval())
    moptimize_init_depvar(M, 1, "test")
    moptimize_init_depvar(M, 2, "y1")
    moptimize_init_eq_indepvars(M, 1, "wealth")
    moptimize_init_eq_indepvars(M, 2, "wealth")
    moptimize(M)
    moptimize_result_display(M)
    end

    when I run this code, I get two errors first- conformability- I assume that this is ln(I:- rho:*W), so I removed this part.

    but after that I got an error that 'couldn't find feasible values'. How to sort this out?

    Any thought would be very welcome!

    Kind regards,

    Kim
    Attached Files
Working...
X