[Limdep Nlogit List] Problem with NLSUR

William Greene wgreene at stern.nyu.edu
Sat Apr 25 01:13:04 EST 2009


James. The results for a nonlinear model, especially one with multiple
equations, often depend on the starting values. There are often multiple
solutions. Or, even if there is only one solution, the path to that 
solution is a function of the starting point. The solver can get in 
trouble in either case. Since you only show 5 iterations below, it does
appear that the iterations have strayed into a problematic point in the
parameter space.
/Bill Greene

----- Original Message -----
From: "James Rao" <James.Rao at agr.uni-goettingen.de>
To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
Sent: Friday, April 24, 2009 6:06:37 AM GMT -05:00 Columbia
Subject: Re: [Limdep Nlogit List] Problem with NLSUR

Hello,

Am using the NLSUR command for the nonlinear instrumental variable to
estimate a system pf equations some of which are non-linear. One of the error
messages that I encounter sometimes is that the variance and covariance
matrix are singular. Below is an excerpt of this error

Iteration=  5, log|S|=      .1150727, ||db||=      .0000000
  Error   143: Models - estimated variance matrix of estimates is singular
  Error   447: Current estimated covariance matrix for slopes is singular.

Initially I was told that it had something to do with unmatching instrumental
variables which I corrected. Besides, sometimes when I change the stating
values for the same model, I do not encounter this problem. Could this error
be related to the starting values am using and if so what could be the
solution?
=============================================================================
==
Rao E.O. James (Msc)
Research Associate/PhD Student

Department of Agricultural Economics and Rural Development
Georg-August University of Göttingen
Platz der Gottinger Sieben 5
37073 Göttingen, Germany.
 
Tell:+49-551-394443 (Office)
E-mail: jimrao2 at yahoo.co.uk;  James.Rao at agr.uni-goettingen.de

Courage is not the absence of fear but the triumph over it ... so fear not to
fear ... but strive to overcome fear!




-----Original Message-----
From: limdep-bounces at limdep.itls.usyd.edu.au on behalf of Rao, James
Sent: Fri 4/17/2009 9:43 AM
To: Limdep and Nlogit Mailing List
Subject: Re: [Limdep Nlogit List] Problem with NLSUR
 

Hello,

I was wondering whether or not its possible to estimate coefficients a
individual points after regression. Usually, the results show coefficients at
mean points but I would like to have these coefficients at individual points
(for each observation). If this is possible how would one go about it in
limdep?
=============================================================================
==
Rao E.O. James (Msc)
Research Associate/PhD Student

Department of Agricultural Economics and Rural Development
Georg-August University of Göttingen
Platz der Gottinger Sieben 5
37073 Göttingen, Germany.
 
Tell:+49-551-394443 (Office)
E-mail: jimrao2 at yahoo.co.uk;  James.Rao at agr.uni-goettingen.de

Courage is not the absence of fear but the triumph over it ... so fear not to
fear ... but strive to overcome fear!




-----Original Message-----
From: limdep-bounces at limdep.itls.usyd.edu.au on behalf of William Greene
Sent: Wed 3/18/2009 7:29 PM
To: Limdep and Nlogit Mailing List
Subject: Re: [Limdep Nlogit List] Problem with NLSUR
 
James:
(1) No, it doesn't. But, that is not what your model states.
In principle, you are describing the reduced form (plugging the
first equation into the second).  However, in your model, I see
the log of y in the first and second equation, and the log of 
the log of y in the second equation. I would be surprised if
the reduced form of this system of equations exists. In any 
event, in answer to the question, the log of y on the RHS of
the second equation is exactly what it says, the log of the
variable y.  If you do want the prediction from the first 
equation to appear in the second equation, you must literally
transcribe the first equation into the second one where you
want it to appear.  Assuming I have this right,

CREATE  ; logy = log(y) $
NLSUR   ;Lhs = logy, lnZ 
        ;Fn1 =                   a1 + b1*X1 + b2*X2 + b3*X3
        ;Fn2 = -log(b2) - log(1+(a1 + b1*X1 + b2*X2 + b3*X3)/c0^2) + b4*X4
        ;labels = a1, b1, b2, b3, b4, c0
        ;Start =  0, 0.01, 0.8, 0.2, 0.6, 0.1
        ;Inst = one, X1, X3, X4, ... $

Two points: (a) It does not appear that you can constrain the quantity
in the parens in the second equation to be positive. So, this may
come down with logs of negative numbers.
(b)  It is wasteful for you to put "log(y)"
anywhere in the system. You should compute the new variable 
logy = log(y) before the NLSUR command, and use "logy" in the
specification of the model.  Note also, that your first line
should be NLSUR ; Lhs=logy,lnZ.  You might not receive a
diagnostic, because ;LOG is meaningful to the compiler, but
eventually, a serious problem will show up.
(2) You can have any variables you want in the instrument list,
whether they appear elsewhere in the model or not. In most cases,
at least some of the instruments would, in fact, not appear
in the model.
/Bill Greene


----- Original Message -----
From: "James Rao" <James.Rao at agr.uni-goettingen.de>
To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
Sent: Wednesday, March 18, 2009 12:36:40 PM GMT -05:00 Columbia
Subject: Re: [Limdep Nlogit List] Problem with NLSUR

Getting back to my NLSUR question, am estimating the following kind of model
(production function and input demand function)

log(y)=a1 + b1*X1 + b2*X2 + b3*X3
log(y/x2)-log(w2/p)= -log(b2) - log(1+1/c0^2*log(y)) + b4*X4

Where:
   - the second equation (input demand function) is the first order condition
of the first
    equation (production function)
   - log(y) in the second equation is the predicted value from equation 1,
and 
   - the dependent variable in equation 2 can be written as lnZ (for brevity)


NLSUR   ;log(y), lnZ 
        ;Fn1 = a1 + b1*X1 + b2*X2 + b3*X3
        ;Fn2 = -log(b2) - log(1+1/c0^2*log(y)) + b4*X4
        ;labels = a1, b1, b2, b3, b4, c0
        ;Start = 0, 0.01, 0.8, 0.2, 0.6, 0.1
        ;Inst = one, X1, X3, X4

I have the following questions:
   - Does the NL3SLS ensures that the log(y) in my second equation is the
predicted value from the first equation?
   - I assume X2 is endogenous and I am using X4 as an instrument for this
endogenous input. Now the estimation procedure needs six instruments since I
have six parameters. So my question is whether I can include some other
variables in the list of instruments even though they are not specified as
part of either equations. 

=============================================================================
==
Rao E.O. James (Msc)
Research Associate/PhD Student

Department of Agricultural Economics and Rural Development
Georg-August University of Göttingen
Platz der Gottinger Sieben 5
37073 Göttingen, Germany.
 
Tell:+49-551-394443 (Office)
E-mail: jimrao2 at yahoo.co.uk;  James.Rao at agr.uni-goettingen.de

Courage is not the absence of fear but the triumph over it ... so fear not to
fear ... but strive to overcome fear!




-----Original Message-----
From: limdep-bounces at limdep.itls.usyd.edu.au on behalf of William Greene
Sent: Tue 3/17/2009 12:06 PM
To: Limdep and Nlogit Mailing List
Subject: Re: [Limdep Nlogit List] Problem with NLSUR
 
James. If you ultimately got convergence, then no, you should not worry about
the results. Warnings sometimes show up during the iterations as the solver
searches the parameter space for a solution. Since you have not prevented "a"
from being in the negative region, trial values might end up there. A common
solution is to estimate c in a = exp(c), then, when done, just compute a from
the estimated c.  As to your second question, the way you have specified it, 
you don't have that model if a is negative, so it is a moot point. Likewise,
it 
won't "affect" the results, since if a is negative, there will be no results.
It
does raise a question as to what happens if you can't keep a from being
negative.
In my proposed solution above, c is unconstrained, but as the solver looks
for
the solution, c would become very large and negative. You should take this as
evidence that there is something wrong with your specification.
Sincerely,
/Bill Greene


----- Original Message -----
From: "James Rao" <James.Rao at agr.uni-goettingen.de>
To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
Sent: Tuesday, March 17, 2009 5:58:17 AM GMT -05:00 Columbia
Subject: Re: [Limdep Nlogit List] Problem with NLSUR

Thanks for your response about the log minus error. Its true that I have a
function that contains a log(a). In response to your clarification I have two
further questions:
   1. So does it mean that the eventual results obtained are invalid due to
this logminus error? 
   2. And if I have to constrain (a) to be positive, won't this affect the
specification of my model and the eventual results obtained thereof?

=============================================================================
==
Rao E.O. James (Msc)
Research Associate/PhD Student

Department of Agricultural Economics and Rural Development
Georg-August University of Göttingen
Platz der Gottinger Sieben 5
37073 Göttingen, Germany.
 
Tell:+49-551-394443 (Office)
E-mail: jimrao2 at yahoo.co.uk;  James.Rao at agr.uni-goettingen.de

Courage is not the absence of fear but the triumph over it ... so fear not to
fear ... but strive to overcome fear!




-----Original Message-----
From: limdep-bounces at limdep.itls.usyd.edu.au on behalf of
wgreene at stern.nyu.edu
Sent: Fri 3/13/2009 7:15 PM
To: Limdep and Nlogit Mailing List
Subject: Re: [Limdep Nlogit List] Problem with NLSUR
 
James. If the actual function contains log(a) without constraining a to be
positive, that would be the problem.
The error would apply to every obsevation but the program tries not to repeat
the error N times.
/Bill Greene

Sent from my Verizon Wireless BlackBerry

-----Original Message-----
From: "Rao, James" <James.Rao at agr.uni-goettingen.de>

Date: Fri, 13 Mar 2009 18:57:55 
To: Limdep and Nlogit Mailing List<limdep at limdep.itls.usyd.edu.au>
Subject: Re: [Limdep Nlogit List] Problem with NLSUR


Thanks a lot for your response. Actually the example I used was quite
simplistic. My actual system of equations is nonlinear and that is why I am
using NL3SLS. I was able to run the estimation after implementing the
suggested correction. While the iterations proceeded and eventually produced
some results, there were some error messages appearing after some of the
iterations which I did not quite understand. Here is an excerpt of the error
messages:

Error   590: Obs.=     1 Cannot compute function: Logminus
Warning   137: Iterations: function not computable at crnt. trial estimate
  Error   590: Obs.=     1 Cannot compute function: Logminus
Warning   137: Iterations: function not computable at crnt. trial estimate
  Error   590: Obs.=     1 Cannot compute function: Logminus
Warning   137: Iterations: function not computable at crnt. trial estimate
  Error   590: Obs.=     1 Cannot compute function: Logminus
Warning   137: Iterations: function not computable at crnt. trial estimate
  Error   590: Obs.=     1 Cannot compute function: Logminus
Warning   137: Iterations: function not computable at crnt. trial estimate

Could it be due to my unrealistic starting values? 

=============================================================================
==
Rao E.O. James (Msc)
Research Associate/PhD Student

Department of Agricultural Economics and Rural Development
Georg-August University of Göttingen
Platz der Gottinger Sieben 5
37073 Göttingen, Germany.
 
Tell:+49-551-394443 (Office)
E-mail: jimrao2 at yahoo.co.uk;  James.Rao at agr.uni-goettingen.de

Courage is not the absence of fear but the triumph over it ... so fear not to
fear ... but strive to overcome fear!




-----Original Message-----
From: limdep-bounces at limdep.itls.usyd.edu.au on behalf of William Greene
Sent: Fri 3/13/2009 12:50 AM
To: Limdep and Nlogit Mailing List
Subject: Re: [Limdep Nlogit List] Problem with NLSUR
 
Dear Mr. James.  Continuing ...
Given that neither of the LHS variables appears on the RHS of these
equations, you probably don't need NL3SLS; nonlinear least squares
will suffice. But, if any of x2,x3 or x4 are endogenous, you'd need
5 instruments for the 5 parameters. If, say, it is x2, then you have
ONE,X3,X4, but you'd need two others.  You need at least one moment
equation for each parameter being estimated.  The shortage of instruments
is what is causing he singularity. The program is trying to invert a
5x5 matrix based only two instruments - it has rank 2.
/Bill Greene


----- Original Message -----
From: wgreene at stern.nyu.edu
To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
Sent: Thursday, March 12, 2009 7:07:01 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Limdep Nlogit List] Problem with NLSUR


Dear limdep listers,

Am pretty new to limdep so kindly excuse my silly questions and mistakes. Am
trying to estimate a nonlinear system of equations using the NLSUR command
for NL3SLS exemplified as follows:

NLSUR   ;Lhs = lnY, lnfert_d
        ;Fn1 = a1 + a2*x2 + a3*x3
        ;Fn2 = -Log(a2) + b1*x3 + b2*x4
        ;Labels = a1, a2, a3, b1, b2
        ;Start = 0, 1, 0, 0, 0
        ;Inst = x3, x4$

Whenever I try to run this estimation I get the following error messages
"Error   143: Models - estimated variance matrix of estimates is singular"
"Error   447: Current estimated covariance matrix for slopes is singular"

Where could the mistake be?

=============================================================================
==
Rao E.O. James (Msc)
Research Associate/PhD Student

Department of Agricultural Economics and Rural Development
Georg-August University of Göttingen
Platz der Gottinger Sieben 5
37073 Göttingen, Germany.
 
Tell:+49-551-394443 (Office)
E-mail: jimrao2 at yahoo.co.uk;  James.Rao at agr.uni-goettingen.de

Courage is not the absence of fear but the triumph over it ... so fear not to
fear ... but strive to overcome fear!


_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au


Sent from my Verizon Wireless BlackBerry
_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au
_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au

_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au
_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au

_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au
_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au

_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au
_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au

_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au

_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au



More information about the Limdep mailing list