Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Fixing nlsur restrictive identification requirements


From   Alex Olssen <alex.olssen@gmail.com>
To   statalist@hsphsun2.harvard.edu
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' {

to

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



Kind regards,

Alex Olssen
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index