Announcement

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

  • ml program question: saving the parameter vectors during iterations

    I want to save each parameter vector that the trace option of ml max shows. The code below saves all the `b' vectors that the maximization process tries, but I only want to keep the parameter vectors that match with the iterations (the ones that the trace option displays, and not the ones in between each iteration). A program like the one below may have 10 iterations to the convergence but thousands of EST matrices get created till convergence. I just want the EST matrices that are associated with each displayed iterations (the parameter vectors displayed by the trace option). How should I edit the code to get that?

    Code:
    program mlprog
       args todo b lnf
       tempvar xb lnsigu2 lnsigw2
       mleval `xb' = `b', eq(1)
       mleval `lnsigu2' = `b', eq(2)
       mleval `lnsigw2' = `b', eq(3)
       .....
       mat EST$i = `b'
       global i = $i + 1
       .....
    end
    
    use data, clear
    global i = 1
    
    ml model ..... mlprog .....
    ml max, trace
    Last edited by Cyrus Levy; 29 Apr 2017, 22:17.

  • #2
    I can't see any solution other than writing the output in the log-file. I have read the documentation of ml and optimize() to see if there was a function that does what you want, but I was unable to find one. I can't see any way to tell your evaluator when the stepping is actually occurring.

    Comment


    • #3
      I suspect you could modify the mi ado file or one of the ado files it calls. If you can find where it writes the parameter values, you might add a write to a variable value.

      Comment

      Working...
      X