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]

From |
"ABDULFATAH S, ADAM" <bihiabdul@yahoo.com> |

To |
statalist@hsphsun2.harvard.edu |

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 <alex.olssen@gmail.com> wrote: > From: Alex Olssen <alex.olssen@gmail.com> > Subject: st: Fixing nlsur restrictive identification requirements > To: statalist@hsphsun2.harvard.edu > 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/

**References**:**st: Fixing nlsur restrictive identification requirements***From:*Alex Olssen <alex.olssen@gmail.com>

- Prev by Date:
**st: Interaction in Generalized Ordered Logistic regression_gologit2 (ORs and CIs)** - Next by Date:
**st: increasing variance when adding covariates (xtmelogit)** - Previous by thread:
**st: Fixing nlsur restrictive identification requirements** - Next by thread:
**st: Test of marginal effects in two samples** - Index(es):