MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Integraton & Minimization and complex number problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45849] Integraton & Minimization and complex number problem
  • From: mfific at hotmail.com (Mario Fific)
  • Date: Tue, 27 Jan 2004 04:50:45 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I have one integration and minimization problem. A function of
interest is defined as follows:

model[l_,h_,scale_,shape_,tt]=Integrate[{den[l, h,
t]*PDF[GammaDistribution[shape, scale], {tt - t}]}, {t, 0, tt}]

model[l_,h_,scale_,shape_,tt] is convolution function between first 
den[l, h, t] which is in my calculation cumulative distribution
function and probability density function GammaDistribution[shape,
scale]. So the convoluted function is strictly positive and should be
continuous and differentiable at all points. Now it is NOT possible to
get closed form for this convolution function, and as an output I get
some long expression. When I had plot this function for some parameter
values it turned out to be correct.


Now the problem I run into was when I try to use this
model[l_,h_,scale_,shape_,tt] function to fit actual data. I used
NMinimize on the function that is to be minimized (see bellow). This
is standard routine for minimization. Dat2 file is a data file.


squares =Plus @@ Table[((model[l, h, scale, shape, tt] /.tt ->
(dat2[[i,1]] -dat2[[i,2]]))^2, {i, Length[dat2]}];

nminsol=NMinimize[{squares}, {l, h, scale,
shape},Method->{"NelderMead"}]


The problem was that it did not converge and I got report that the 

"The function (145.080813 -(6.93321450269*10^-18 [maginaryI] did not
evaluate to a number at the point (h
->0.006370727396825097`,(l->0.128041641382088), (scale->
72.43025153),(shape-> 5.8088417556)"

(Note that I constrained parameters which is not presented in
NMinimize function! above)

I tried different methods for minimization but it did not work out.
When I paid close attention to the output of the ?table' in ?squares'
above, I found some complex number (real + imaginary). After some
further research I found that convoluted function
model[l_,h_,scale_,shape_,tt] behaves chaotically for some parameter
values, which was surprised for me, because both function that were
used to construct it were regular probability functions. I guess these
irregularities were because of mathematica used some numerical
integration in order to approximate complicated convolution function.

Also, I used "realonly" package in order to turn-off imaginary part of
the function output but it did not help. Obviously ?realonly' will not
prevent imaginary number when NMinimize is used.

I would appreciate any suggestion.


Mario Fific
Department of Cognitive Psychology
Indiana University


  • Prev by Date: Re: [Outer [Times, , ] ] Question
  • Next by Date: Integration, Minimization and complex numbers Problem
  • Previous by thread: RE: Problems with Plot in Mathematica 4.0, Combining Plots with Different Domains
  • Next by thread: Integration, Minimization and complex numbers Problem