[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Feiveson, Alan H. (JSC-SK311)" <alan.h.feiveson@nasa.gov> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Maximize a function that contains an integral |

Date |
Tue, 3 Mar 2009 16:30:21 -0600 |

Bob - Try looking at http://www.stata.com/meeting/3nasug/abstracts.html Al Feiveson -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Bob Hammond Sent: Tuesday, March 03, 2009 4:24 PM To: statalist@hsphsun2.harvard.edu Subject: st: Maximize a function that contains an integral All, I want to find the maximum of a function that contains an integral without an analytical solution. The difficulty is that the argument of the maximization is the lower bound of the integral. Consider the following trivial example: find the x that maximizes f(x), where f(x) is the integral of z (with respect to z) from a lower bound of x to an upper bound of 0. Computing the integral by hand shows that x* = 0 (because f(x) = -0.5x^2) but I would like to know how to code this without invoking the analytical solution. Note that I cannot simply differentiate f(x) with respect to x and use a root finder (e.g., mm_root) to find the optimum because my f'(x) also contains an integral. I've used Stata's integ command to great effect in similar applications but do not know how to embed it into my problem of maximizing f(x). It occurred to me that I could use ml instead of Mata but I'm not sure how that would be done since the argument of the optimization problem is the lower bound of the integration. The most promising approach that I've found seems to be "Quadrature on sparse grids": http://sparse-grids.de/#Stata which contains a Mata function nwspgr() in a zip file. I've spent some time with this function and it's very accurate but I cannot figure out how to manipulate the integration bounds such that the lower bound is a variable that I can feed in from an optimizer such as Mata's optimize. I will contact the authors of nwspgr() but I wanted to check a few things before doing so: 1. Is there an existing Mata equivalent to integ (which easily allows manipulation of the integration bounds)? 2. Relative to using Mata and (possibly) nwspgr(), would it be simpler to use integ and ml? If so, I would appreciate any tips. Thanks, Bob -- ------------------------------------------------------------------------ Bob Hammond Department of Economics North Carolina State University Office: (919) 513-2871 Fax: (919) 515-7873 http://www4.ncsu.edu/~rghammon/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: RE: Maximize a function that contains an integral***From:*Bob Hammond <robert_hammond@ncsu.edu>

**Re: st: RE: Maximize a function that contains an integral***From:*Maarten buis <maartenbuis@yahoo.co.uk>

**References**:**st: Maximize a function that contains an integral***From:*Bob Hammond <robert_hammond@ncsu.edu>

- Prev by Date:
**Re: st: ENDESA** - Next by Date:
**Re: st: AW: can I get standardized coefficients by standardize variables first?** - Previous by thread:
**st: Maximize a function that contains an integral** - Next by thread:
**Re: st: RE: Maximize a function that contains an integral** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |