Bookmark and Share

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


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

Re: st: Fixing nlsur restrictive identification requirements


From   "ABDULFATAH S, ADAM" <[email protected]>
To   [email protected]
Subject   Re: st: Fixing nlsur restrictive identification requirements
Date   Wed, 18 May 2011 02:40:51 -0700 (PDT)

Hi Alex,
I tried to use your modification to see if it works. But still the same 'cannot have fewer observations than parameters' error is being returned.
Thanks for your effort. It would be nice if it did work:)
Abdul

--- On Sun, 5/8/11, Alex Olssen <[email protected]> wrote:

> From: Alex Olssen <[email protected]>
> Subject: st: Fixing nlsur restrictive identification requirements
> To: [email protected]
> Date: Sunday, May 8, 2011, 3:46 PM
> 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/
> 

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index