[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
optim: curvefit_stat and fixed parameters
From: |
Markus Appel |
Subject: |
optim: curvefit_stat and fixed parameters |
Date: |
Fri, 30 May 2014 19:58:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
Hello,
my goal is to calculate covp and corp for an optimization with
nonlin_curvefit using curvefit_stat. After having some problems I tried
to put together a minimal working example to reproduce the error (which
may be a bug). I am not quite there yet, but encountered another problem:
The attached script uses nonlin_curvefit and curvefit_stat, one time
with a parameter vector and another time with a parameter struct. I fit
a polynomial with 3 parameters to some data, but added a 4th one on
which the model function does not depend (for demonstration). Declare
the 4th parameter fixed, and curvefit_stat (for parameter vector) gives:
error: __dfdp__: product: nonconformant arguments (op1 is 4x1, op2 is 3x1)
error: called from:
error: /home/mappel/octave/optim-1.3.0/private/__dfdp__.m at line 88, column 7
error: at line -1, column -1
error: at line -1, column -1
error: /home/mappel/octave/optim-1.3.0/private/__residmin_stat__.m at line
548, column 14
error: /home/mappel/octave/optim-1.3.0/curvefit_stat.m at line 61, column 7
error: /home/mappel/test/fit_test.m at line 19, column 6
or correspondingly (for parameter structure):
error: cell2struct: number of FIELDS does not match dimension
error: evaluating argument list element number 1
error: called from:
error: at line -1, column -1
error: at line -1, column -1
error: /home/mappel/octave/optim-1.3.0/private/__dfdp__.m at line 26, column 7
error: at line -1, column -1
error: at line -1, column -1
error: /home/mappel/octave/optim-1.3.0/private/__residmin_stat__.m at line
548, column 14
error: /home/mappel/octave/optim-1.3.0/curvefit_stat.m at line 61, column 7
error: /home/mappel/test/fit_test.m at line 31, column 7
Don't keep the 4th parameter fixed, everything works fine and covp/corp
contains NA for the 4th parameter which is reasonable. Try to declare
parameter 3 as fixed (on which the model function actually depends and
dfdp is not zero) and it works as expected, without error and more NA's
in covp/corp.
Is this a bug or am I not using these functions as intended?
Thanks,
Markus
PS: As the error logs show, I use optim 1.3.0 (just updated all
packages), this is on Ubuntu 12.04 with octave 4.1.0+ (sorry, forgot
changeset).
fit_test.m
Description: Text Data
- optim: curvefit_stat and fixed parameters,
Markus Appel <=