Re: Choosing parameters.
- From: Daniel Carrera <dcarrera math toronto edu>
- To: Morten Welinder <terra diku dk>
- Cc: <gnumeric-list gnome org>
- Subject: Re: Choosing parameters.
- Date: Fri, 24 May 2002 10:34:54 -0400 (EDT)
It all comes down to user interface. So far we have no clue about how
to specify your arbitrary function. Once that is figured out, getting
initial values for paramters should be trivial.
If you select reasonable ranges for the paramters, what are the chances
that a random point (or one of ten random points) will lead to
convergence?
If the initial guess is reasonable, the chances of converging to the right
values are good. However, how close "reasonable" is depends on the
function. For instance, the function 'a*sin(b*x)+c' changes rapidly with
values of 'b', but is more tolerant with 'a' and 'c'.
Allow me to demonstrate:
I made a dataset with 'y(x) = 1*sin(2*x)+1', x values from 0 to pi. I
also added some random variations to y.
Say that I only know that the form of the dataset is
'y(x) = a*sin(b*x) + c' and I want to find the best (a,b,c) values given
my (x,y) dataset.
1) First try:
==========
If the initial guess of (a,b,c) is (4,1.6,-2), the program arrives at the
the correct estimate:
(a,b,c) == (0.82060313 2.0045228 1.06970489)
If you graph '1*sin(2*x)+1', '4*sin(1.6*x)+1' and '0.8*sin(2*x)+1' you
will see that this is very good convergence.
2) Second try:
===========
If the initial guess is (a,b,c) = (1,1,1), the program arrives at:
(a,b,c) == (16.3355999, -0.03256876, 1.68292832)
This is the wrong answer.
Now, before concluding that something went wrong, please plot these
functions:
1*sin(2*x)+1
sin(x)+1
16.3*sin(-0.03*x)+1.7
Make sure that your plot goes from 0 to pi.
You will see that this is exactly what you would expect a computer to do.
Starting from the position that it did, the best the computer could do was
find the *diagonal line* which best approximates a sine function.
The problem is simply that sin(b*x) is very senstitive to changes in b.
This is the reason why I suggest helping the user see a plot of his
initial guess against the dataset. If you look at the numbers you might
think that "1" is close to "2". But when you look at the plot you can see
how far it truly is.
Cheers,
Daniel.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]