MathGroup Archive 2003

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

Search the Archive

Re: Re: Minimisation Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40829] Re: [mg40813] Re: [mg40803] Minimisation Problem
  • From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
  • Date: Mon, 21 Apr 2003 06:54:12 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I had to do some guessing because you didn't use Mathematica notation 
to state your problem.  I also think you left out some parentheses in 
defining AltChiSq.

Here's the functional form and some example data with a known p:

fFun = p*(0.4 + 3.8*Exp[-Abs[Cos[#1]]^ 0.75]) & ;

{x, y} = Transpose[Table[
      {a, fFun[a] + 0.1*Random[]},
      {a, 0, Pi/4, 0.1}]] /. p -> 1.213;
f = fFun /@ x;

Here's the error function:

ClearAll[altChiSq]
altChiSq[d:{_?VectorQ, _?VectorQ}] :=
  Simplify[altChiSq[Transpose[d]]]
altChiSq[d:{{_, _}..}] := Plus @@ altChiSq /@ d
altChiSq[{y_, f_}] :=  2*(f - y) + (2*y + 1)*
    Log[(2*y + 1)/(2*f + 1)]

d = D[altChiSq[{y, f}], p]
FindRoot[d == 0, {p, 1.}]

or

FindMinimum[altChiSq[{y, f}], {p, 1.}]

Bobby



-----Original Message-----
From: sean kim <shawn_s_kim at yahoo.com>
To: mathgroup at smc.vnet.net
Subject: [mg40829] [mg40813] Re: [mg40803] Minimisation Problem

hello.

i'm doing something similar myself.( sim8ilar in respects to the
minimization) and none of the minimization techniques available
throught mathematica works for me. ( ie, findmin, nminimze etc.)

your scenario sounds liek you could benefit from writing a gradeisnt
descent routine.

perturb the parameter p by a little increment i. call that parameter
p_i for increment. then look at what happens to the f(x, p)

>      f(x,p) = p(0.4 + 3.8Exp[-|Cos[x]|^0.75])

define a new function that is a square of sum of difference between
your theoretical function over x, p and x, p_1. ie

newf = (f(x,p) - f(x, p_i))^2

if this function is decreased that means your getting close to the
minimum for the difference function. then you want to make the
incrememnts in that direction.

if this function is increasing then that will mean your are moving away
from the minum. then change the direction of the incrememnt vector.

i hope this helps a bit.

sean








--- Mike Costa <run_mc2000 at yahoo.com> wrote:
> Dear All,
>
> I have a little minimization problem. I'm essentially
> trying to fit data points to a curve, which, in
> particular, means minimising the chi-square function
> in order to obtain the desired parameters. However,
> the curve-fitting aspect is not important for now. The
> main problem boils down to this: given f(x, p), the
> theoretical function, with x being the simulated data
> points and p being the parameter(s) of interest, and
> y(x) being the actual obtained function value given
> the simulated data set x, the usual chi-square method
> of determining p consists of minimising the chi-square
> function
>
>       ChiSq = Sigma[(f(x,p) - y(x))^2/y(x)]
>
> where Sigma represents the sum over all the data
> points(I realise that there are other definitions for
> chi-square, but let's use this for now). The little
> twist is this: I want instead to minimise the
> ALTERNATIVE CHI-SQUARE
>
>  AltChiSq = Sigma[2(f-y)+(2y+1)Log[2y+1/2f+1]]
>
> where again Sigma represents the sum over all the data
> points. I want to minimise AltChiSq to get the
> parameter p.
>
> In my situation, the theoretical function f only has
> one parameter that needs to be estimated
>
>      f(x,p) = p(0.4 + 3.8Exp[-|Cos[x]|^0.75]),
>
> p being a kind of normalising factor. I would like to
> know if there are any intrinsic functions in
> Mathematica that can directly minimise a function like
> AltChiSQ above. I recognise that the usual methods for
> minimising functions like FindMinimum and such will
> not work here due to the number of terms that Sigma
> sums over (among other reasons). Is there any other
> way to use FindMinimum in order to handle the function
> AltChiSq? Or maybe, is there some way to somehow
> change the default chi-square function that
> Linear/NonLinearFit uses in order to instead minimise
> AltChiSq? If these strategies lead to nowhere, can
> anyone give a general strategy of how to tackle this
> minimisation problem in Mathematica?
>
> Any suggestions would be greatly appreciated. Thanks.
>
> __________________________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo
> http://search.yahoo.com
>


=====
when riding a dead horse,  some dismount.

while others...
buy a new whip.

which one might you be?

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com


  • Prev by Date: Re: Solving for a function in an Integral
  • Next by Date: Re: curve fitting
  • Previous by thread: Re: Minimisation Problem
  • Next by thread: Re: Plot backwards ==> SOLVED, THANK YOU.