![Statalist](/includes/images/head_statalist.jpg) |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: boundary constraints within nl
I'm pasting in the same response I put in last time for the same sort of
question. The strategy is this... assume that Stata will fit a
parameter going from minus infinity to plus infinity. You sustitute a
form directly in place of that parameter that takes an unbounded input,
and places bounds on it.
In your case it is simple... just exponentiate:
nl (y = ({a}+{b}* x) * (1-x))
becomes
nl (y = (exp({a})+exp({b})* x) * (1-x))
The estimates for a and b will actually be the logs of the parameters of
interest. After the estimate, use -nlcom- to retrieve your parameters
and standard errors.
Paul
Here's the last email on the same subject...
An easy way to impose b>0 is to substitute b=exp(c). c is
unconstrained, and would have a range from minus to plus infinity, but
b would be greated than 0.
Likewise, for k substitute k=((k2-k1)/(1+exp(m))+k1. m is
unconstrained, but k would fall between k1 and k2.
I use these tricks all the time and they work very well. To get back
estimates and standard errors for b and k, use nlcom.
P
Olga Lyashevska wrote:
Dear all,
We have a negative exponential growth model.
y=a exp(-kx)+b
Is there is a way to impose constrains on model parameters such as b>0
and
k1<k<k2?
Thank you in advance,
Olga
Marc Keuschnigg wrote:
Hey,
I am estimating non linear least squares models (nl) using equations
like: nl (y = ({a}+{b}* x) * (1-x)).
My question is, how do I impose parameter restrictions like a >=0 and
b >=0?
I could log-transform the parameters, but I don't know how to do it
technically within the nl command.
Thanks for helping,
Marc
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
--
E. Paul Wileyto, Ph.D.
Assistant Professor of Biostatistics
Tobacco Use Research Center
School of Medicine, U. of Pennsylvania
3535 Market Street, Suite 4100
Philadelphia, PA 19104-3309
215-746-7147
Fax: 215-746-7140
[email protected]
http://mail.med.upenn.edu/~epw/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/