Announcement

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

  • Optimize() on a segment

    Hello,

    I would like to maximize my function of a specific segment, let's say [a,b]. Does anyone know how to do this in mata?

    Best regards,
    Olga

  • #2
    You could use Brent's method. I think there is a function in the user-written suite moremata available on SSC, and I've attached a Mata class implementation to a Statalist post some year's back.

    For a non-Mata solution, you could use the official but undocumented minbound.

    Comment


    • #3
      Dear Joseph,

      Thank you for your suggestion. I've tried looking up moremata and mm_root here but did not find anything relevant. Could please suggest in which context I can find your implementation?

      I did not specify in my initial post, but my function is multi-dimensional, and therefore I cannot use minbound (looks like it does one dimensional optimization only).

      Best regards,
      Olga Meshcheriakova

      Comment


      • #4
        In the output of the Stata command
        Code:
        search mm_root
        you will see
        Code:
        moremata from http://fmwww.bc.edu/RePEc/bocode/m
            'MOREMATA': module (Mata) to provide various functions / This package
            includes various Mata functions. kern(): various / kernel functions;
            kint(): kernel integral functions; kdel0(): / canonical bandwidth of
            kernel; quantile(): quantile / function; median(): median; iqrange():
        and by clicking on the link in the first line, you will see a larger description that confirms that mm_root is included in moremata.

        You should review Chapter 19 of the Getting Started with Stata PDF included in your Stata installation and accessible from Stata's Help menu. That will explain more about extending Stata's functionality by installing user-written packages.
        Last edited by William Lisowski; 03 Dec 2018, 06:56.

        Comment

        Working...
        X