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: Fixing nlsur restrictive identification requirements

From   Alex Olssen <>
Subject   st: Fixing nlsur restrictive identification requirements
Date   Mon, 9 May 2011 10:46:31 +1200

Dear Statalist,

I have posted a couple of messages to the list pointing out that
-nlsur-   is using an
overly restrictive identification constraint that sometimes results in
failure to estimate
doe to error 2001 - fewer observations than parameters.

Who will be interested in this problem?  One group is people
estimating systems off
annual time series data.  For example in the AIDS demand model
estimation if we have
data on 5 expenditure shares (after dropping one equation) annually
for 40 years then
currently   -nlsur-  will not estimate a model with 8 regressors per
equation - any general
dynamic AIDS model will have at least this many regressors.  However,
such a system
should be able to be estimated.

I have implemented a very simple fix to this problem.  I would be very
happy to hear
your thoughts as to my solution.

Firstly I illustrate the problem and the solution using   -sysuse
auto-   and then I describe
the simple fix.  You cannot run this all at once as it will error
after the   -nlsur-   command
which is exactly the problem I intend to fix - copying to the do-file
editor and running line
by line will work fine.

** demonstrating nlsur's restrictive identification requirements
** showing that nlsur2 fixes the problem

sysuse auto, clear

** the identification problem requires relatively few observations
keep in 1/10

** it is well known that sur in a linear model without coefficient
** restrictions produces OLS equation by equation
** if we put a linear model into nlsur it should produce the same
** results as OLS equation by equation

nlsur (length = {priceL}*price + {dispL}*disp + {turnL}*turn +
{headL}*head + {trunkL}*trunk + {consL}) ///
	  (weight = {priceW}*price + {dispW}*disp + {turnW}*turn +
{headW}*head + {trunkW}*trunk + {consW})
** nlsur will not estimate this model

nlsur2 (length = {priceL}*price + {dispL}*disp + {turnL}*turn +
{headL}*head + {trunkL}*trunk + {consL}) ///
	   (weight = {priceW}*price + {dispW}*disp + {turnW}*turn +
{headW}*head + {trunkW}*trunk + {consW})
** nlsur2 will estimate the model

** comparing with OLS equation by equation we see that coefficient
** estimates are the same but the standard errors differ
** a finite sample correction is probably needed - and this sample
** is very finite
reg length price disp turn head trunk
reg weight price disp turn head trunk

The solution is simply to adjust line 516 of the file   nlsur.ado
On a windows computer the default location is
C:\Program Files\Stata11\ado\base\n\nlsur.ado

Change line 516 from

if r(N) < `np' {


if r(N)*`neqn' < `np' {

Kind regards,

Alex Olssen
*   For searches and help try:

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