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]

st: NLSUR starting values invalid or some RHS variables have missing values


From   samiul haque <[email protected]>
To   [email protected]
Subject   st: NLSUR starting values invalid or some RHS variables have missing values
Date   Sun, 31 Oct 2010 13:52:55 -0400

Dear Stata Users,

I am trying to estimate a dynamic translog cost function. The function
evaluator program is written below (A). I have 46 parameters. I have
passed the function evaluator program through the matrix as below (B)
and did not get any error message.  But once I try to estimate the
system of equations (C ),
I get the following error:

Calculating NLS estimates...
could not evaluate equation 1
starting values invalid or some RHS variables have missing values
r(480);


I have checked all the RHS variables and none have missing values. So
I have 2 options:

1) To set starting values
2) Figure out why the first equation cannot be evaluated.


I am unsure about how to proceed. Any help in this regard will be appreciated.

Sincerely yours,
Sam


(C  )
***estimating the system
nlsur translog45 @ lntc dsl dsk dslnd lnq1 lnq2 lnw1 lnw2 lnw3 lnw4
lnq1q1 lnq2q2 lnq1q2 lnw1w1 lnw1w2 lnw1w3 lnw1w4 lnw2w2 lnw2
> w3 lnw2w4 lnw3w3 lnw3w4 lnw4w4 lnq1w1 lnq1w2 lnq1w3 lnq1w4 lnq2w1 lnq2w2 lnq2w3 lnq2w4 lncons lnconssq lnconslnq1 lnconslnq2 lnc
> onslnw1 lnconslnw2 lnconslnw3 lnconslnw4 l1lnq1 l1lnq2 l1lnq1q1 l1lnq1q2  l1lnq2q2  l1lnw1 l1lnw2 l1lnw3 l1lnw4 l1lnw1w1 l1lnw1w
> 2 l1lnw1w3 l1lnw1w4 l1lnw2w2 l1lnw2w3 l1lnw2w4 l1lnw3w3 l1lnw3w4 l1lnw4w4 l1lnq1w1 l1lnq1w2 l1lnq1w3 l1lnq1w4 l1lnq2w1 l1lnq2w2
> l1lnq2w3 l1lnq2w4 l1lncons l1lnconssq l1lnconslnq1 l1lnconslnq2 l1lnconslnw1 l1lnconslnw2 l1lnconslnw3 l1lnconslnw4 l1sl l1sk l1
> slnd l1sm , parameters(het a0 a1 a2 d11 d12 d22 b1 b2 b3 g11 g12 g13 g22 g23 g33 g44 rho11 rho12 rho13 rho21 rho22 rho23 fet fet
> t d1t d2t g1t g2t g3t b11 b12 b13 b14 b21 b22 b23 b24 b31 b32 b33 b34 b41 b42 b43 b44) initial(het 0.5 )  nequations(4) ifgnls
(obs = 54)




(B)
**checking evaluator program
matrix a = J(1,46,0)
set trace on
nlsurtranslog46 copy_lntc copy_dsl copy_dsk copy_dslnd lnq1 lnq2 lnw1
lnw2 lnw3 lnw4 lnq1q1 lnq2q2 lnq1q2 lnw1w1 lnw1w2 lnw1w3 lnw1w4 lnw2w2
lnw2w3 lnw2w4 lnw3w3 lnw3w4 lnw4w4 lnq1w1 lnq1w2 lnq1w3 lnq1w4 lnq2w1
lnq2w2 lnq2w3 lnq2w4 lncons lnconssq lnconslnq1 lnconslnq2 lnconslnw1
lnconslnw2 lnconslnw3 lnconslnw4 l1lnq1 l1lnq2 l1lnq1q1 l1lnq1q2
l1lnq2q2  l1lnw1 l1lnw2 l1lnw3 l1lnw4 l1lnw1w1 l1lnw1w2 l1lnw1w3
l1lnw1w4 l1lnw2w2 l1lnw2w3 l1lnw2w4 l1lnw3w3 l1lnw3w4 l1lnw4w4
l1lnq1w1 l1lnq1w2 l1lnq1w3 l1lnq1w4 l1lnq2w1 l1lnq2w2 l1lnq2w3
l1lnq2w4 l1lncons l1lnconssq l1lnconslnq1 l1lnconslnq2 l1lnconslnw1
l1lnconslnw2 l1lnconslnw3 l1lnconslnw4 l1sl l1sk l1slnd l1sm, at(a)



How ever when I try to estimate the system using the nlsur command I
get the following error:



(A)
*******function evaluator program
program nlsurtranslog46
version 11.1

syntax varlist(min=78 max=78) [if], at(name)

tokenize `varlist'
args lntc dsl dsk dslnd lnq1 lnq2 lnw1 lnw2 lnw3 lnw4 lnq1q1 lnq2q2
lnq1q2 lnw1w1 lnw1w2 lnw1w3 lnw1w4 lnw2w2 lnw2w3 lnw2w4 lnw3w3 lnw3w4
lnw4w4 lnq1w1 lnq1w2 lnq1w3 lnq1w4 lnq2w1 lnq2w2 lnq2w3 lnq2w4 lncons
lnconssq lnconslnq1 lnconslnq2 lnconslnw1 lnconslnw2 lnconslnw3
lnconslnw4 l1lnq1 l1lnq2 l1lnq1q1 l1lnq1q2  l1lnq2q2  l1lnw1 l1lnw2
l1lnw3 l1lnw4 l1lnw1w1 l1lnw1w2 l1lnw1w3 l1lnw1w4 l1lnw2w2 l1lnw2w3
l1lnw2w4 l1lnw3w3 l1lnw3w4 l1lnw4w4 l1lnq1w1 l1lnq1w2 l1lnq1w3
l1lnq1w4 l1lnq2w1 l1lnq2w2 l1lnq2w3 l1lnq2w4 l1lncons l1lnconssq
l1lnconslnq1 l1lnconslnq2 l1lnconslnw1 l1lnconslnw2 l1lnconslnw3
l1lnconslnw4 l1sl l1sk l1slnd l1sm


tempname het
scalar `het'= `at'[1,1]
tempname a0 a1 a2 d11 d12 d22
scalar `a0'= `at'[1,2]
scalar `a1'= `at'[1,3]
scalar `a2'= `at'[1,4]
scalar `d11'= `at'[1,5]
scalar `d12'= `at'[1,6]
scalar `d22'= `at'[1,7]
tempname b1 b2 b3 b4
scalar `b1'= `at'[1,8]
scalar `b2'= `at'[1,9]
scalar `b3'= `at'[1,10]
scalar `b4'= `1'-`b1'-`b2'-`b3'
tempname g11 g12 g13 g14
scalar `g11'= `at'[1,11]
scalar `g12'= `at'[1,12]
scalar `g13'= `at'[1,13]
scalar `g14'= -`g11'-`g12'-`g13'

tempname g22 g23 g24
scalar `g22'= `at'[1,14]
scalar `g23'= `at'[1,15]
scalar `g24'= -`g12'-`g22'-`g23'
tempname g33 g34
scalar `g33'= `at'[1,16]
scalar `g34'= -`g13'-`g23'-`g33'
tempname g44
scalar `g44'= `at'[1,17]
tempname rho11 rho12 rho13 rho14
scalar `rho11'= `at'[1,18]
scalar `rho12'= `at'[1,19]
scalar `rho13'= `at'[1,20]
scalar `rho14'= -`rho11'-`rho12'-`rho13'
tempname rho21 rho22 rho23 rho24
scalar `rho21'= `at'[1,21]
scalar `rho22'= `at'[1,22]
scalar `rho23'= `at'[1,23]
scalar `rho24'= -`rho21'-`rho22'-`rho23'
tempname fet fett d1t d2t
scalar `fet'= `at'[1,24]
scalar `fett'= `at'[1,25]
scalar `d1t'= `at'[1,26]
scalar `d2t'= `at'[1,27]
tempname g1t g2t g3t g4t
scalar `g1t'= `at'[1,28]
scalar `g2t'= `at'[1,29]
scalar `g3t'= `at'[1,30]
scalar `g4t'= -`g1t'-`g2t'-`g3t'
tempname z b11 b12 b13 b14 b21 b22 b23 b24 b31 b32 b33 b34 b41 b42 b43
b44 k11 k12 k13 k14 k21 k22 k23 k24 k31 k32 k33 k34
scalar `z'= `1'-`het'
scalar `b11'= `at'[1,31]
scalar `b12'= `at'[1,32]
scalar `b13'= `at'[1,33]
scalar `b14'= `at'[1,34]
scalar `b21'= `at'[1,35]
scalar `b22'= `at'[1,36]
scalar `b23'= `at'[1,37]
scalar `b24'= `at'[1,38]
scalar `b31'= `at'[1,39]
scalar `b32'= `at'[1,40]
scalar `b33'= `at'[1,41]
scalar `b34'= `at'[1,42]
scalar `b41'= `at'[1,43]
scalar `b42'= `at'[1,44]
scalar `b43'= `at'[1,45]
scalar `b44'= `at'[1,46]
scalar `k11'= `het'+`b11'
scalar `k12'= `het'+`b12'
scalar `k13'= `het'+`b13'
scalar `k14'= `het'+`b14'
scalar `k21'= `het'+`b21'
scalar `k22'= `het'+`b22'
scalar `k23'= `het'+`b23'
scalar `k24'= `het'+`b24'
scalar `k31'= `het'+`b31'
scalar `k32'= `het'+`b32'
scalar `k33'= `het'+`b33'
scalar `k34'= `het'+`b34'



quietly {

replace `lntc'=`het'*(`a0'+`a1'*`lnq1'+`a2'*`lnq2'+`d11'*0.5*`lnq1q1'+`d12'*`lnq1q2'+`d22'*0.5*`lnq2q2'+`b1'*`lnw1'+`b2'*`lnw2'+`b3'*`lnw3'+`b4'*`lnw4'+`g11'*0.5*`lnw1w1'+`g12'*`lnw1w2'+`g13'*`lnw1w3'+`g14'*`lnw1w4'+`g22'*0.5*`lnw2w2'+`g23'*`lnw2w3'+`g24'*`lnw2w4'+`g33'*0.5*`lnw3w3'+`g34'*`lnw3w4'+`g44'*0.5*`lnw4w4'+`rho11'*`lnq1w1'+`rho12'*`lnq1w2'+`rho13'*`lnq1w3'+`rho14'*`lnq1w4'+`rho21'*`lnq2w1'+`rho22'*`lnq2w2'+`rho23'*`lnq2w3'+`rho24'*`lnq2w4'+`fet'*`lncons'+`fett'*`lnconssq'+`d1t'*`lnconslnq1'+`d2t'*`lnconslnq2'+`g1t'*`lnconslnw1'+`g2t'*`lnconslnw2'+`g3t'*`lnconslnw3'+`g4t'*`lnconslnw4')+
`z'*(`a0'+`a1'*`l1lnq1'+`a2'*`l1lnq2'+`d11'*0.5*`l1lnq1q1'+`d12'*`l1lnq1q2'+`d22'*0.5*`l1lnq2q2'+`b1'*`l1lnw1'+`b2'*`l1lnw2'+`b3'*`l1lnw3'+`b4'*`l1lnw4'+`g11'*0.5*`l1lnw1w1'+`g12'*`l1lnw1w2'+`g13'*`l1lnw1w3'+`g14'*`l1lnw1w4'+`g22'*0.5*`l1lnw2w2'+`g23'*`l1lnw2w3'+`g24'*`l1lnw2w4'+`g33'*0.5*`l1lnw3w3'+`g34'*`l1lnw3w4'+`g44'*0.5*`l1lnw4w4'+`rho11'*`l1lnq1w1'+`rho12'*`l1lnq1w2'+`rho13'*`l1lnq1w3'+`rho14'*`l1lnq1w4'+`rho21'*`l1lnq2w1'+`rho22'*`l1lnq2w2'+`rho23'*`l1lnq2w3'+`rho24'*`l1lnq2w4'+`fet'*`l1lncons'+`fett'*`l1lnconssq'+`d1t'*`l1lnconslnq1'+`d2t'*`l1lnconslnq2'+`g1t'*`l1lnconslnw1'+`g2t'*`l1lnconslnw2'+`g3t'*`l1lnconslnw3'+`g4t'*`l1lnconslnw4')+
`z'*(`l1sl'*`lnw1'+`l1sk'*`lnw2'+`l1slnd'*`lnw3'+`l1sm'*`lnw4'-`l1lnw1'*(`b1'+`g11'*`l1lnw1'+`g12'*`l1lnw2'+`g13'*`l1lnw3'+`g14'*`l1lnw4'+`rho11'*`l1lnq1'+`rho21'*`l1lnq2'+`g1t'*`l1lncons')-`l1lnw2'*(`b2'+`g12'*`l1lnw1'+`g22'*`l1lnw2'+`g23'*`l1lnw3'+`g24'*`l1lnw4'+`rho12'*`l1lnq1'+`rho22'*`l1lnq2'+`g2t'*`l1lncons')-`l1lnw3'*(`b3'+`g13'*`l1lnw1'+`g23'*`l1lnw2'+`g33'*`l1lnw3'+`g34'*`l1lnw4'+`rho13'*`l1lnq1'+`rho23'*`l1lnq2'+`g3t'*`l1lncons')-`l1lnw4'*(`b4'+`g14'*`l1lnw1'+`g24'*`l1lnw2'+`g34'*`l1lnw3'+`g44'*`l1lnw4'+`rho14'*`l1lnq1'+`rho24'*`l1lnq2'+`g4t'*`l1lncons'))+`b11'*(`b1'+`g11'*`l1lnw1'+`g12'*`l1lnw2'+`g13'*`l1lnw3'+`g14'*`l1lnw4'+`rho11'*`l1lnq1'+`rho21'*`l1lnq2'+`g1t'*`l1lncons'-`l1sl')*`lnw1'+
`b12'*(`b2'+`g12'*`l1lnw1'+`g22'*`l1lnw2'+`g23'*`l1lnw3'+`g24'*`l1lnw4'+`rho12'*`l1lnq1'+`rho22'*`l1lnq2'+`g2t'*`l1lncons'-`l1sk')*`lnw1'+
`b13'*(`b3'+`g13'*`l1lnw1'+`g23'*`l1lnw2'+`g33'*`l1lnw3'+`g24'*`l1lnw4'+`rho13'*`l1lnq1'+`rho23'*`l1lnq2'+`g3t'*`l1lncons'-`l1slnd')*`lnw1'+
`b14'*(`b4'+`g14'*`l1lnw1'+`g24'*`l1lnw2'+`g34'*`l1lnw3'+`g44'*`l1lnw4'+`rho14'*`l1lnq1'+`rho24'*`l1lnq2'+`g4t'*`l1lncons'-`l1sm')*`lnw1'+
`b21'*(`b1'+`g11'*`l1lnw1'+`g12'*`l1lnw2'+`g13'*`l1lnw3'+`g14'*`l1lnw4'+`rho11'*`l1lnq1'+`rho21'*`l1lnq2'+`g1t'*`l1lncons'-`l1sl')*`lnw2'+
`b22'*(`b2'+`g12'*`l1lnw1'+`g22'*`l1lnw2'+`g23'*`l1lnw3'+`g24'*`l1lnw4'+`rho12'*`l1lnq1'+`rho22'*`l1lnq2'+`g2t'*`l1lncons'-`l1sk')*`lnw2'+
`b23'*(`b3'+`g13'*`l1lnw1'+`g23'*`l1lnw2'+`g33'*`l1lnw3'+`g24'*`l1lnw4'+`rho13'*`l1lnq1'+`rho23'*`l1lnq2'+`g3t'*`l1lncons'-`l1slnd')*`lnw2'+
`b24'*(`b4'+`g14'*`l1lnw1'+`g24'*`l1lnw2'+`g34'*`l1lnw3'+`g44'*`l1lnw4'+`rho14'*`l1lnq1'+`rho24'*`l1lnq2'+`g4t'*`l1lncons'-`l1sm')*`lnw2'+
`b31'*(`b1'+`g11'*`l1lnw1'+`g12'*`l1lnw2'+`g13'*`l1lnw3'+`g14'*`l1lnw4'+`rho11'*`l1lnq1'+`rho21'*`l1lnq2'+`g1t'*`l1lncons'-`l1sl')*`lnw3'+
`b32'*(`b2'+`g12'*`l1lnw1'+`g22'*`l1lnw2'+`g23'*`l1lnw3'+`g24'*`l1lnw4'+`rho12'*`l1lnq1'+`rho22'*`l1lnq2'+`g2t'*`l1lncons'-`l1sk')*`lnw3'+
`b33'*(`b3'+`g13'*`l1lnw1'+`g23'*`l1lnw2'+`g33'*`l1lnw3'+`g24'*`l1lnw4'+`rho13'*`l1lnq1'+`rho23'*`l1lnq2'+`g3t'*`l1lncons'-`l1slnd')*`lnw3'+
`b34'*(`b4'+`g14'*`l1lnw1'+`g24'*`l1lnw2'+`g34'*`l1lnw3'+`g44'*`l1lnw4'+`rho14'*`l1lnq1'+`rho24'*`l1lnq2'+`g4t'*`l1lncons'-`l1sm')*`lnw3'+
`b41'*(`b1'+`g11'*`l1lnw1'+`g12'*`l1lnw2'+`g13'*`l1lnw3'+`g14'*`l1lnw4'+`rho11'*`l1lnq1'+`rho21'*`l1lnq2'+`g1t'*`l1lncons'-`l1sl')*`lnw4'+
`b42'*(`b2'+`g12'*`l1lnw1'+`g22'*`l1lnw2'+`g23'*`l1lnw3'+`g24'*`l1lnw4'+`rho12'*`l1lnq1'+`rho22'*`l1lnq2'+`g2t'*`l1lncons'-`l1sk')*`lnw4'+
`b43'*(`b3'+`g13'*`l1lnw1'+`g23'*`l1lnw2'+`g33'*`l1lnw3'+`g24'*`l1lnw4'+`rho13'*`l1lnq1'+`rho23'*`l1lnq2'+`g3t'*`l1lncons'-`l1slnd')*`lnw4'+
`b44'*(`b4'+`g14'*`l1lnw1'+`g24'*`l1lnw2'+`g34'*`l1lnw3'+`g44'*`l1lnw4'+`rho14'*`l1lnq1'+`rho24'*`l1lnq2'+`g4t'*`l1lncons'-`l1sm')*`lnw4'
`if'

replace `dsl'=`het'*(`g11'*`lnw1'+`g12'*`lnw2'+`g13'*`lnw3'+`g14'*`lnw4'+`rho11'*`lnq1'+`rho21'*`lnq2'+`g1t'*`lncons'-`g11'*`l1lnw1'-`g12'*`l1lnw2'-`g13'*`l1lnw3'-`g14'*`l1lnw4'-`rho11'*`l1lnq1'-`rho21'*`l1lnq2'-`g1t'*`l1lncons')+
`k11'*(`b1'+`g11'*`l1lnw1'+`g12'*`l1lnw2'+`g13'*`l1lnw3'+`g14'*`l1lnw4'+`rho11'*`l1lnq1'+`rho21'*`l1lnq2'+`g1t'*`l1lncons'-`l1sl')+
`k12'*(`b2'+`g12'*`l1lnw1'+`g22'*`l1lnw2'+`g23'*`l1lnw3'+`g24'*`l1lnw4'+`rho12'*`l1lnq1'+`rho22'*`l1lnq2'+`g2t'*`l1lncons'-`l1sk')+
`k13'*(`b3'+`g13'*`l1lnw1'+`g23'*`l1lnw2'+`g33'*`l1lnw3'+`g24'*`l1lnw4'+`rho13'*`l1lnq1'+`rho23'*`l1lnq2'+`g3t'*`l1lncons'-`l1slnd')+
`k14'*(`b4'+`g14'*`l1lnw1'+`g24'*`l1lnw2'+`g34'*`l1lnw3'+`g44'*`l1lnw4'+`rho14'*`l1lnq1'+`rho24'*`l1lnq2'+`g4t'*`l1lncons'-`l1sm')
`if'

replace `dsk'=`het'*(`g12'*`lnw1'+`g22'*`lnw2'+`g23'*`lnw3'+`g24'*`lnw4'+`rho12'*`lnq1'+`rho22'*`lnq2'+`g2t'*`lncons'-`g12'*`l1lnw1'-`g22'*`l1lnw2'-`g23'*`l1lnw3'-`g24'*`l1lnw4'-`rho12'*`l1lnq1'-`rho22'*`l1lnq2'-`g2t'*`l1lncons')+
`k21'*(`b1'+`g11'*`l1lnw1'+`g12'*`l1lnw2'+`g13'*`l1lnw3'+`g14'*`l1lnw4'+`rho11'*`l1lnq1'+`rho21'*`l1lnq2'+`g1t'*`l1lncons'-`l1sl')+
`k22'*(`b2'+`g12'*`l1lnw1'+`g22'*`l1lnw2'+`g23'*`l1lnw3'+`g24'*`l1lnw4'+`rho12'*`l1lnq1'+`rho22'*`l1lnq2'+`g2t'*`l1lncons'-`l1sk')+
`k23'*(`b3'+`g13'*`l1lnw1'+`g23'*`l1lnw2'+`g33'*`l1lnw3'+`g24'*`l1lnw4'+`rho13'*`l1lnq1'+`rho23'*`l1lnq2'+`g3t'*`l1lncons'-`l1slnd')+
`k24'*(`b4'+`g14'*`l1lnw1'+`g24'*`l1lnw2'+`g34'*`l1lnw3'+`g44'*`l1lnw4'+`rho14'*`l1lnq1'+`rho24'*`l1lnq2'+`g4t'*`l1lncons'-`l1sm')
`if'

replace `dslnd'=`het'*(`g13'*`lnw1'+`g23'*`lnw2'+`g33'*`lnw3'+`g24'*`lnw4'+`rho13'*`lnq1'+`rho23'*`lnq2'+`g3t'*`lncons'-`g13'*`l1lnw1'-`g23'*`l1lnw2'-`g33'*`l1lnw3'-`g24'*`l1lnw4'-`rho13'*`l1lnq1'-`rho23'*`l1lnq2'-`g3t'*`l1lncons')+
`k31'*(`b1'+`g11'*`l1lnw1'+`g12'*`l1lnw2'+`g13'*`l1lnw3'+`g14'*`l1lnw4'+`rho11'*`l1lnq1'+`rho21'*`l1lnq2'+`g1t'*`l1lncons'-`l1sl')+
`k32'*(`b2'+`g12'*`l1lnw1'+`g22'*`l1lnw2'+`g23'*`l1lnw3'+`g24'*`l1lnw4'+`rho12'*`l1lnq1'+`rho22'*`l1lnq2'+`g2t'*`l1lncons'-`l1sk')+
`k33'*(`b3'+`g13'*`l1lnw1'+`g23'*`l1lnw2'+`g33'*`l1lnw3'+`g24'*`l1lnw4'+`rho13'*`l1lnq1'+`rho23'*`l1lnq2'+`g3t'*`l1lncons'-`l1slnd')+
`k34'*(`b4'+`g14'*`l1lnw1'+`g24'*`l1lnw2'+`g34'*`l1lnw3'+`g44'*`l1lnw4'+`rho14'*`l1lnq1'+`rho24'*`l1lnq2'+`g4t'*`l1lncons'-`l1sm')
`if'


}
end

*
*   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