Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: how to speed up lenghty formulas??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84151] Re: how to speed up lenghty formulas??
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 11 Dec 2007 15:31:56 -0500 (EST)
  • References: <fjkpjb$hn2$1@smc.vnet.net>


Hi Arek,

the problem is your awfully complicated function. I see two way of 

approach. Either you help mathematica a bit that it needs fewer function 

evaluation or you approximate the function by a simplier one.

If you know approximately values for a0,a1,b1, you can specify 

intervalls for a1,a2,b1. e.g.: NMinmize[...,{{a0,a0low,a0high},{a1,...}}]

You may also approximate your function by e.g. "FunctionInterpolation" 

what evaluates fast. If the values found by this way are not accurate 

enough for you, you may at least use them as starting values.

hope this helps, Daniel



Arkadiusz.Majka at gmail.com wrote:

> DearAll,

> 

> I have a general problem with lenghty formula

> 

> E.g for  a data set X

> 

> X=Table[Random[NormalDistribution[0,5],{100}]];

> 

> I define function h:

> 

> 

>  h[0] := Variance[X];

> h[1] := a0+ h[0];

> h[t_] := h[t] = a0 + a1*X[[t - 1]]^2 + b1*h[t - 1]

> 

> and H which is the collection of h in all times up to the length of

> data set X

> 

> H = Table[h[i], {i, 2, Length[X]}];

> 

> Next I define a function:

> 

> logLike = Total[-Log[H] - (Drop[X, 1]^2/H)];

> 

> which I want to minimize in order to find a0,a1,b1

> 

> NMinimize[{-logLike, a0> 0 && 1 >a1 > 0 && 1 > b1> 0 && a1+ b1 <1},

> {a0, a1, b1}]

> 

> 

> It works but takes a lot of time and does not scale at all (i.e. when

> I add an element to X the computational time increases very much)

> 

> 

> The form of logLike and NMinimize function is only an example of how

> to deal with very long function but with only a few arguments (here 3)

> to obtain fast results. Instead of NMinimize you can try to

> contourplot logLike function or do whatever you want - its time

> consuming.

> 

> I know that there existing a solution ,i.e to speed up such

> computation. The example above is a parameter estimation of GARCH

> process which in TimeSeries packet runs very fast. But how did

> developers do so???

> 

> Thanks for any help,

> 

> Arek

> 




  • Prev by Date: Re: Vertical tick labels in BarChart
  • Next by Date: Re: ContourPlotOnSurface
  • Previous by thread: how to speed up lenghty formulas??
  • Next by thread: Re: how to speed up lenghty formulas??