Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Nonlinear least squares restrictions

From   tshmak <>
To   "" <>
Subject   st: RE: Nonlinear least squares restrictions
Date   Thu, 6 Jun 2013 15:25:02 +0800

Hi Gareth, 

I think this is a linear regression rather than a nonlinear regression problem. 

Naively, we can just create a variable called year, run: 

reg y i.year##X, nocons

This would result in a different intercept and slope for each year. 

To make the average of b = 1, simply divide the year-specific slopes by the average of the slopes, the average being your estimate of B. 

The only problem of this approach is that your slopes across years would not meet at the boundary. To constraint the slopes to meet, you need to use splines. The best place to start is probably Roger Newson's -bspline- package. Dr. Newson has also written a few informative articles explaining their use in Stata Journal. 


ps. I think the reason -nl- fails on this problem is that the problem is not identified unless you can somehow constraint the b to average 1, and I'm not sure you can do that in -nl-. 

-----Original Message-----
From: [] On Behalf Of G. Anderson
Sent: 05 June 2013 19:24
Subject: st: Nonlinear least squares restrictions


Using daily data, I am trying to estimate a relationship of the form y=a 
+bBX +u

Where a is a scalar which can vary across years, b is a scalar which can 
vary across years, X is a vector of data and B is a vector of parameters 
which is fixed across years.

Therefore I am trying to estimate a, b and B. I want to normalise b so that 
on average it is equal to 1 across years.

I have tried experimenting using the nonlinear regression function but so 
far to no avail- is this type of restriction possible in Stata?

Many Thanks, 


*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index