forum.alglib.nethttp://forum.alglib.net/ alglib parameter estimationhttp://forum.alglib.net/viewtopic.php?f=2&t=398 Page 1 of 1

 Author: amlwwalker [ Fri Jul 08, 2011 9:47 am ] Post subject: alglib parameter estimation Hi I am new to using alglib, and I want to use the following code, but for my own equation of parameter estimation, therefore I have replaced the function and x and y data points with mine, however I cannot get it to successfully compute.Please can anyone see my mistake?ThanksAlex WalkerCode:#include "stdafx.h"#include #include #include #include "interpolation.h"using namespace alglib;void function_debt_func(const real_1d_array &c, const real_1d_array &x, double &func, void *ptr){    //    // this callback calculates f(c,x)=c[0]*(1+c[1]*(pow(x[0]-1999,c[2])-1))    //    //func = c[0]*(1+c[1]*(pow(x[0]-1999,c[2])-1));    func = (1/(c[0]*c[1]))*(c[2]-asinh(sinh(c[2])*exp(c[0]*x[0]*2*pi())));}int main(int argc, char **argv){    real_2d_array x = "[1,2,3,4,5]";    real_1d_array y = "[1.9, 1.7, 1.45, 1.3, 1.2]";    real_1d_array c = "[1, 1, 1]";    double epsf = 0;    double epsx = 1.0e-5;    real_1d_array bndl = "[-inf, -10, 0.1]";    real_1d_array bndu = "[+inf, +10, 2.0]";    real_1d_array s = "[1, 1, 1]";    ae_int_t maxits = 0;    ae_int_t info;    lsfitstate state;    lsfitreport rep;    double diffstep = 1.0e-5;    lsfitcreatef(x, y, c, diffstep, state);    lsfitsetcond(state, epsf, epsx, maxits);    lsfitsetbc(state, bndl, bndu);    lsfitsetscale(state, s);    alglib::lsfitfit(state, function_debt_func);    lsfitresults(state, info, c, rep);    printf("%d\n", int(info)); // EXPECTED: 2    printf("%s\n", c.tostring(-2).c_str()); // EXPECTED: [4.142560E+12, 0.434240, 0.565376]    return 0;}My function is the line func = ...

 Author: Sergey.Bochkanov [ Fri Jul 08, 2011 1:45 pm ] Post subject: Re: alglib parameter estimation First error I saw is that you initialize 2D array X with 1-dimensional array [1,2,3,4,5]. It should be [[1],[2],[3],[4],[5]].Maybe there are other errors, but right now I can't test your code. Try to fix it and compile one more time

 Author: amlwwalker [ Sat Jul 09, 2011 6:14 pm ] Post subject: Re: alglib parameter estimation Thanks that did actually get it to compute.Please can you just help me understand a couple of lines, because I have no real way of checking whether the parameters it estimates are correct, this line:real_1d_array s = "[1, 1, 1]";i think scales the starting value of the parameter estimations, is this correct? How do you decide on the scaling factor?

 Author: Sergey.Bochkanov [ Sat Jul 09, 2011 7:04 pm ] Post subject: Re: alglib parameter estimation Yes, these coefficients are scaling factors. You can read http://www.alglib.net/optimization/scaling.php which briefly discusses this question. If you still has questions (for example, what will be correct scales for your problem), feel free to ask them.

Author:  amlwwalker [ Sun Jul 10, 2011 12:32 am ]
Post subject:  Re: alglib parameter estimation

I think it is solving correcly for the data I am giving it now, thank you. This is part of a bigger 'thing' I am trying to understand, I wandered whether you maybe able to shed some light on it. I am trying to learn parameter estimation, but cant follow through this paper:
I have attached an image of part of a freely available paper I was reading. It shows the equations for least squares minimization of some equations based on empirical data.

I am not completely confident I understand the required steps, and therefore just wanted to talk it through with others, see what you say and see if it sparks any ideas to solve these.

As I understand it, the first equation (eqn 40) is minimizes using levenberg marquardt for a, b and c0. k is 1,2,3,4..... t_k is times stored, the rest of the equation is trying to model the time it will take (whatever that time may be).

Ok so using levenberg marquardt estimate a, b and c0.
But the the next equation (eqn 41) says that he freezes beta to be ab^2, and uses golden section method to 'refine' a and b?

Did the leveneberg marquardt not do a good enough job because I thought we found and ab that way?

the author also give the sub equations for c0. Why? I thought we estimated c0?

Ok so however it has been done, we have a good estimate for a, b and c0.
Eqn 42. Same thing again except now for nu, phi, omega^2.

How is it explaining to solve this?
"robus linear estimation"? "Directly minimizing"? Is that how? Why cant we use levenberg marquardt again?

I just would like discussion, Im not after just the answer, I would like to understand when to use what, and why...

Thanks guys

By the way, that is the whole chapter I havent left anything out except the chapter title

 Attachments: parameter estimation.JPG [ 109.49 KiB | Viewed 4369 times ]

 Page 1 of 1 All times are UTC Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/