Statalist


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

st: nlsur error cannot have fewer observations than parameters


From   "Nelson, Carl" <chnelson@illinois.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: nlsur error cannot have fewer observations than parameters
Date   Fri, 5 Feb 2010 14:27:22 -0600

In general I know what this error means about a rank condition for identification. 

I looked at the nlsur.ado file and found the following code that generates the error:

qui count if `touse'
	if r(N) < `np' {
		di as err "cannot have fewer observations than parameters"
		exit 2001

The question comes from a 1996 Journal of Applied Econometric article  (Coelli, JAE, 11(1996):77-91) estimating an 8 netput profit function with 35 time series observations.
The functional form is a generalized McFadden profit function with convexity imposed by expressing the matrix of quadratic terms as the product of cholesky factors and estimating the elements of the Cholesky matrix nonlinearly.
Nick and Maarten helped me fix tempname and scalar syntax errors caused by my limited understanding. After fixing them and some other errors I am know encountering:

 - replace `q7' = `b7' + `b17'*(`p1'/`p8') + `b27'*(`p2'/`p8') + `b37'*(`p3'/`p8
> ') + `b47'*(`p4'/`p8') + `b57'*(`p5'/`p8') + `b67'*(`p6'/`p8') + `b77'*(`p7'/`p8') 
> + `bt7'*`t' + `btt'*`g7'*`t'^2 `if'
      = replace __00000J = __00001I + __00001X*(p1/p8) + __000023*(p2/p8) + __000028*
> (p3/p8) + __00002C*(p4/p8) + __00002F*(p5/p8) + __00002H*(p6/p8) + __00002I*(p7/p8)
>  + __00001P*t + __00001Q*g7*t^2 if __000002
(obs = 35)

cannot have fewer observations than parameters
r(2001);
It is true that the full system contains 45 parameters and there are 35 observations. But the data is stacked into 8 equations. reg3 estimation of the constrained system, without convexity imposed, runs without problem. I don't think the r(2001) is generated because of the 45 to 35 comparison.

I am guessing that the error is being caused by the first stage single equation estimation to generate the first estimate of the residuals. The higher the index of the equation the more elements of the Cholesky factor enter into the bij parameters that you see in the above specification. So my main question is ``Is the error being generated because the single equation that needs to be estimated to obtain first stage residuals has more parameters than observations."

I would never choose such a specification for research. I am working on this for a problem set for a PhD class using the JAE data archive. Coelli reports that estimation of the model with convexity imposed was accomplished by maximum likelihood estimation of the system in Shazam. I don's want to make to big a point of it, but the results that I am seeing causes me to think that the parameter estimates are very fragile.

I'm hoping someone can give me more insight into the cannot have fewer observations than parameters
r(2001); error. Thanks.

Carl Nelson
University of Illinois
*
*   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   |   What's new   |   Site index