Setting bounds on parameters in nlsys

User ForumSetting bounds on parameters in nlsys
laurafish asked 3 years ago


I use command "nlsys" to match some moments in my project. I wonder if I can set the bound for the guesses of parameters. I know that option is available in "optmat" with  command "name.bounds={0.5 1}. Is there a similar command in "nlsys"?

Thank you!


2 Answers
RonSchoenberg answered 3 years ago

Bounds on parameters can be placed using a math transformation. To constrain a parameter to be between a and b, use a logit transformation. First write a proc

proc logit(p,a,b);

   local y;
   y = (b - a) / (1 + exp(-p)) + a;

This will constrain p to be between b and a, i.e., if p = -inf, y = a, and if p = + inf, y = b;

Imbed logit(x,a,b) wherever that parameter shows up in your equation. For example, suppose you have a parameter list, p[1:3].

p[1]*x^2 + logit(p[2],0,1)*x + p[3] = 0;

This will constrain the parameter p[2] to be between zero and one.

RonSchoenberg answered 3 years ago

Also, your parameter estimate is the result of the call to logit(p,a,b);  Thus

p2hat = logit(p[2],0,1);