On Oct 28, 2013, at 12:57, Gelman, Laurent wrote:
> Hi everybody,
>
> Is it possible, when using the fit function, not only to give the initial values for the parameters, but also to force these to stay within a given range, e.g. never get negative or positive... ?
________________________________________________________________
Hi Laurent,
simply write your function such that it returns NaN (not a number) if it enters the forbidden range.
For this purpose, it's nice that the 'custom fit' function can also have a more complex form consisting of several statements.
Example:
if (b < 0) y = NaN ; else y = a + b*x + c*x*x;
If you use one of the built-in fit functions, note that the fit procedure usually gets less efficient when converting it to a 'custom' function. For the built-in functions, ImageJ splits off parameters that are mere factors and offsets and determines them by linear regression. This is not done for custom functions.
Michael
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html