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

From |
Bob Hammond <robert_hammond@ncsu.edu> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Wed, 04 Mar 2009 14:09:58 -0500 |

All,

Bob >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cap mata: mata drop g() cap mata: mata drop h() mata: real colvector g(real matrix x){ return( x:^4 ) } real colvector h(real matrix x){ return( normalden(x) )

b = 2 // upper bound of integration D = 1 // dimensions of integration k = 25 // accuracy level of approximation nw = nwspgr("KPU", D, k) x = nw[.,1..D]:*(b-a) :+ a w = nw[.,D+1] trueval = (1/5)*b^5 - (1/5)*a^5 approx = g(x)'*w*(b-a) error = sqrt((approx - trueval):^2):/trueval

trueval = normal(b) - normal(a) approx = h(x)'*w*(b-a) error = sqrt((approx - trueval):^2):/trueval

end >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Feiveson, Alan H. (JSC-SK311) wrote:

Bob - Try looking at http://www.stata.com/meeting/3nasug/abstracts.htmlAl 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.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.

-- ------------------------------------------------------------------------ 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/

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

**st: RE: Maximize a function that contains an integral***From:*"Feiveson, Alan H. (JSC-SK311)" <alan.h.feiveson@nasa.gov>

- Prev by Date:
**st: Biased estimates?** - Next by Date:
**st: 64 bit MySQL 5.1 ODBC driver for Mac OS 10.5.6** - Previous by thread:
**Re: st: RE: Maximize a function that contains an integral** - Next by thread:
**st: Nonlinear model using maximum likelihood** - Index(es):

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