Announcement

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

  • Quadrature in version 11

    Hi all. Is there a user written program that does Gauss-Legendre quadrature in version 11? My function f(x) is defined over (0,1) and cannot be integrated analytically. I need to evaluate the area under the curve for several sub-intervals, say, [0,.25), [.25,.75), [.75,1].

    Thanks in advance.

  • #2
    If you search integrate Stata lists several matches, one of which is described as follows (taken from the help file found by following the link on the search results)

    integrate is an implementation of three numerical integration algorithms: Gauss-Legendre quadrature; Gauss-Hermite quadrature ; and Gauss-Laguerre. Gauss-Legendre quadrature is used for the definite integrals, Gauss-Hermite quadrature is used for the indefinite integral between -infinity and +infinity; and Gauss-Laguerre quadrature is used for the indefinite integral is between 0 and +infinity. Any limits can be chosen and the command will select a combination of quadrature techniques to calculate the result. The current command does not attempt to look at numerical errors but the user can alter the number of quadrature points to inspect any numerical instabilities.

    This command has been primarily written in the MATA language but is a Stata command. The function can be any single line expression and the integration is with respect to x. The text from the option function() will be used to create a new function in Mata which is then passed to the integration algorithm.

    Comment


    • #3
      Thanks William. Unfortunately -integrate- is written for version 12. It is looking like I may have to write the code from scratch, using -integrate- as a guide..

      Comment

      Working...
      X