Skip to main content
1-Visitor
January 16, 2013
Question

parameterize Minerr solve block.

  • January 16, 2013
  • 3 replies
  • 5388 views

I'm having trouble parameterizing a minerr solve block.

In the end I need this to iteratie through a series a guess values for parameter a inside the block.

Could anyone tell me if it is even possible to do what I want and if so how?

many thanks in advance.

3 replies

25-Diamond I
January 16, 2013

minerr is an iteratiive numeric approximation, it needs a guess value.

You may write

param:=1 (or whatever guess value you think is appropriate)

before param is used the first time (that is in a:=... in your case). Usually this is done before the token "Given".

That guess value may influence what solution minerr arrives at (if there are multiple) and sometimes it decides if you get a solution at all or nothing but "no solution found" error.

Werner

1-Visitor
January 16, 2013

defining param:= before the given statement doesn't work.

that will fix the value of param to the first definition and calling the function with a different argument value doesn't change the value of param anymore

12-Amethyst
January 16, 2013

Hi Arjen,

there are a number of issues that will stop this sheet from working.

1. resid() is returning a vector of results - it should return a single value that minerrccan try to minimise.

2. all the guess variables (b, d, e, f & g) should be defined outside the given ... minerr block

3. a must be defined inside the block, but with the boolean equals as it is defined by the value of param.

4. Minerr is not trying to minimse the residual using parameter a as this is defined so it should not appear in the minerr statement.

attached is modified to give a possible solution.

Hope this makes sense

Regards

Andy

1-Visitor
January 17, 2013

Hi everyone, thanks for all the great help.

Very nice to see how many are willing to help.

Most of the solutions so far involve fixating parameter a in the model and running the regression for the other parameters. However this doesn't always generate te best possible fit.

What I have seen so far is that if I manualy change the guess value for a better solutions are found compared to fixating a to that same value (or any other).

Is there no solution to parameterize the guess value for a?

19-Tanzanite
January 17, 2013

Arjen Walstra wrote:

Is there no solution to parameterize the guess value for a?

If you look at the method I used in file tempb.xmcd above you will see that 'a' is used directly as a parameter. It is then varied computationally rather than manually.

Alan

1-Visitor
January 17, 2013

Hi Alan,

I have seen you solutions. But in all solutions "a" is removed from the regression solve block and thus forced to a value. I do see that you are computing a long array of values for "a" and use the solve block to compute the other constants. However forcing "a" to a value is not giving me the same result as looping through an array of guess values for "a"

1-Visitor
January 17, 2013

Everyone many thanks for all the support.

The final adjustment suggested by Richard seems to do the trick.