Parameter Constraints in Nonlinear Model FittingI am fitting a bi-exponential growth model of the following form:

I would like to constrain the parameter estimates so that dmax1< dmax2 and rate1
Is there any way to do this in the Nonlinear platform?
Re: Parameter Constraints in Nonlinear Model FittingThanks for that reference @Byron_JMP . In this case, it's not a segmented model. The actual physical process is two reactions happening simultaneously at two different rates, producing the same output result. The measured output is the sum of the two reaction outputs, but each reaction happens in the same reaction system, so you can't measure them indepedently.
Re: Parameter Constraints in Nonlinear Model FittingI had wrote some JSL that was nearly identical to that, and it did solve the problem. Thanks for sharing.
Re: Parameter Constraints in Nonlinear Model FittingI wonder if it would be easier to process the estimates after the nonlinear fitting without contstraints. I assume that the dmax1 and rate1 parameter estimates will go together and the dmax2 and rate2 parameter estimates will go together even if the dmax1 and rate1 parameter estimates are not always first. Then to achieve the order that you want, you can simply swap the order in the data table after saving the estimates table. This example shows what I have in mind:
Names Default to Here( 1 );
dt = New Table( "Double Exponential Models",
Add Rows( 20 ),
New Column( "dmax1",
Values( J( 20, 1, Random Uniform() ) )
),
New Column( "rate1",
Values( J( 20, 1, Random Uniform() ) )
),
New Column( "dmax2",
Values( J( 20, 1, Random Uniform() ) )
),
New Column( "rate2",
Values( J( 20, 1, Random Uniform() ) )
)
);
Wait( 5 );
For Each Row(
If( :rate1 > :rate2,
temp = :dmax1;
:dmax1 = :dmax2;
:dmax2 = temp;
temp = :rate1;
:rate1 = :rate2;
:rate2 = temp;
);
);
Re: Parameter Constraints in Nonlinear Model FittingSue Walsh talked about this type of model in a paper at JMP Discovery a while back.
The notes in the slides about segmented models are a little sparse, but I think you'll be able to get the gist of how to set it up.
Re: Parameter Constraints in Nonlinear Model FittingThis is more a matter of convenience that mathematics. The actual problem is that I am fitting a non-linear model to several kinetic profiles generated as part of a DOE. The non-linear model I showed is the theoretical model that we believe describes the process, which consists to two separate reactions, one that is "slow" and another that is "fast". The slow reaction rate is approx 1/100 of the fast reaction rate.
The problem is that when I fit the non-linear model to each profile, sometimes the "rate1" parameter that estimated is the smallest, and other times the "rate1" parameter is the largest. JMP doesn't know that I want rate1 to be the slow rate. When I save the parameter estimates, I have to do some data processing to determine which rate is the slow rate and which rate is the fast rate. Ultimately I want to use the factors in the DOE to predict the slow reaction rate and the fast reaction rate.
Part of me thinks, though, that forcing this constraint may also make the model fits more stable? But maybe not. I'm not sure.
Re: Parameter Constraints in Nonlinear Model FittingIf you believe that assumption is true, then the best model should find such estimates without constraint, I think. The data are evidence against that assumption otherwise.
the custom model would remain the same. I think that you would have to introduce the constraint as a penalty to the loss function. The penalty is high when the constraint is violated.
Re: Parameter Constraints in Nonlinear Model Fittingis there some update for constraints in nonlinear fit?
there are min/max settings at the bottom of the report - but when I click on Go the fit result is outside of min-max.

Re: Parameter Constraints in Nonlinear Model FittingHi @hogi ,
Which dataset did you use for this?
Thanks,
Ben
Re: Parameter Constraints in Nonlinear Model FittingHi @Ben_BarrIngh ,
actually, I was trying to fit 2 peaks and tried to limit the fit range for the centers.
Difficult to fit the Peaks when the tails don't match to the fit curve ; )
While playing with the fit, I wondered if I can optimize the fit by restricting the range for the x1/x2 scan.
... and wondered if there is a way in the platform to restrict.
) dt = New Table( "spectra",
Add Rows( 200 ),
New Column( "X",
Formula( Row() )
),
New Column( "input",
Formula(
Parameter(
{h1 = 1, W = 40, h2 = 1},
(h1 * W ^ 2) / ((:X - 70) ^ 2 + W ^ 2) + (h2 * W ^ 2) / ((:X - 130)
^ 2 + W ^ 2)
)
)
),
New Column( "fit",
Formula(
Parameter(
{h1 = 1, W = 40, h2 = 1, x1 = 0, x2 = 200},
h1 * Exp( -(:X - x1) ^ 2 / (2 * W ^ 2) ) + h2 *
Exp( -(:X - x2) ^ 2 / (2 * W ^ 2) )
)
)
)
);
dt << Nonlinear( Y( :input ), X( :fit )
Re: Parameter Constraints in Nonlinear Model FittingHi @hogi ,
You need to go in through the parameter bounds (Red triangle) and set those up first before hitting go to stop it exceeding points. Although the Low/High should update in the plot table below, maybe worth reporting to support@jmp.com.
Does that resolve what you're trying to achieve?
Thanks,
Ben
Re: Parameter Constraints in Nonlinear Model FittingAh, wonderful, thanks 
can somebody mark @Ben_BarrIngh 's reply as "solution"?

Re: Parameter Constraints in Nonlinear Model Fitting@Ben_BarrIngh , add-on question:
when I use "By" to fit multiple spectra, is there a trick to set global constraints and the lock?

something like:
new column ("by",Nominal, set each value(mod(row(),3)));
Nonlinear( Y( :input ), X( :fit ), by(:by),
SendToByGroup( Bygroup Default,
Parameter Bounds(
h1( 0, 2 ),
x1( 0, 100),
h1( 0, 2 ),
x2( 100, 200)
) )
)
Re: Parameter Constraints in Nonlinear Model Fittingworkaround for the global constraints:
new column ("by",Nominal, set each value(mod(row(),3)));
nl = Nonlinear( Y( :input ), X( :fit ), by(:by) );
nl << Parameter Bounds(
h1( 0, 2 ),
x1( 0, 100 ),
h2( 0, 2 ),
x2( 100, 200 )
)
The Lock doesn't seem to be recorded.
One could set constraints with min=max.