comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Amoeba and Tied Parameters
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Amoeba and Tied Parameters [message #94080] Fri, 13 January 2017 20:06 Go to next message
Maryam is currently offline  Maryam
Messages: 16
Registered: July 2012
Junior Member
Does anyone know how I can tie two parameters together when using Amoeba so that no matter how much they are changed, they are always equal? In other words, I am looking for something similar to .TIED in MPFIT but when using AMOEBA instead.

Thank you,
Maryam
Re: Amoeba and Tied Parameters [message #94081 is a reply to message #94080] Sat, 14 January 2017 07:43 Go to previous messageGo to next message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
On Friday, 13 January 2017 20:06:36 UTC-8, Maryam wrote:
> Does anyone know how I can tie two parameters together when using Amoeba so that no matter how much they are changed, they are always equal? In other words, I am looking for something similar to .TIED in MPFIT but when using AMOEBA instead.
>
> Thank you,
> Maryam

Hi Maryam,

If you are minimizing a function of 'n' parameters, and you want to tie one of them to be identical to another one (or computed as a function of another one), then you really only have 'n-1' parameters, making your minimization problem one dimension smaller.

For example, if your function to be minimized were originally computed based on p[0], p[1] and p[2], then you decide to tie p[2] to be equal to p[0], simply replace each p[2] in the function by p[0], and adjust your use of P0, SCALE, SIMPLEX, and the result of FUNCTION_VALUE to work with an 'n' of two rather than three.

Similarly, for example, if you knew that you want to tie p[2] to always be the square root of p[0], in your function you could compute it based on p[0], p[1] and a variable you compute as p2 = Sqrt(p[0]).

I hope this helps you out!

Cheers,
-Dick

Dick Jackson Software Consulting Inc.
Victoria, BC, Canada --- http://www.d-jackson.com
Re: Amoeba and Tied Parameters [message #94082 is a reply to message #94081] Sat, 14 January 2017 10:27 Go to previous messageGo to next message
Maryam is currently offline  Maryam
Messages: 16
Registered: July 2012
Junior Member
Hello Dick,

Thanks for your reply.

My function is actually not that simple. It takes my parameters as input and runs a code in R. It then takes the result of the simulation from the R code and compares it with the model by calculating the chi-squared value. Then it replaces my parameters with the new ones and calls the R code again. However, I need to make sure that some parameters are changed by the same amount by Amoeba and I don't believe I can simply do p[0]=p[2].
Re: Amoeba and Tied Parameters [message #94094 is a reply to message #94080] Tue, 17 January 2017 18:21 Go to previous message
Maryam is currently offline  Maryam
Messages: 16
Registered: July 2012
Junior Member
Hello All,

Just thought to post an update regarding making a parameter tied to another parameter when using the Amoeba fitting routine in case anyone encountered the same issue later. Thanks to Dick Jackson, we were able to fix this problem. Here is how we did it:

I have a very large parameter space (22 parameters), 4 of which are fixed (so I set scale to zero for those four). I also have 3 pairs of parameters that are free to change by Amoeba but they must change by the same amount (i.e. p[13] must always be equal to p[10], and p[17] must always be p[14], etc.) The problem is my function does not have a simple form. It calls an R code to run some simulation, takes the result of that simulation, makes a plot, compares it to some model and calculates the chi-squared value. So I could not simply just set those parameters equal to each other and pass all the parameters to Amoeba.

What Dick suggested was to start by reducing my parameter space as much as we could by creating a subset of parameters for the call to Amoeba() and the FUNC() routine, and expanding to the full set before the code takes in the 22 parameters that it needs to run the simulations. This way we would be passing fewer parameters to the fitting routine by defining a new COMMON block that takes that subset of parameters and passes them to the fitting routine as opposed to Amoeba treating the tied parameters differently and then setting them equal before the call to the simulation code.

I am very grateful for Dick's help; so thank you very much Dick.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: reform a transposed array
Next Topic: IDL 8.6 demo mode

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:24:06 PDT 2025

Total time taken to generate the page: 0.00449 seconds