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: RE: nlsur QUAIDS (Poi 2008)


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: nlsur QUAIDS (Poi 2008)
Date   Thu, 19 May 2011 19:14:10 +0100

That means "invalid syntax". 

The most important advice is to use -set trace on- to see where your program fails. 

In addition: 

You have made an -if- call compulsory in your program, but you don't issue one. 

Also, look at these lines: 

scalar `a4' = 1 - `a1' - `a2' - `a3' 
scalar `b4' = -`b1' - `b2' - `b3' 
scalar `g14' = -`g11' - `g12' - `g13' 
scalar `g24' = -`g21' - `g22' - `g23' 
scalar `g34' = -`g31' - `g32' - `g33' 
scalar `g44' = -`g41' - `g42' - `g43' 

Should the first line alone subtract every other argument from 1? 

FYI, "Poi Brian" is Brian Poi. 

Nick 
[email protected] 


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of olorunfemi sola
Sent: 19 May 2011 19:06
To: [email protected]
Subject: st: nlsur QUAIDS (Poi 2008)

Dear Statalisters (especially Poi Brian),
My  aim is to specify a QUAIDS model to estimate four demand equations using the method of Poi 2008 approach.After using Stata 11 to estimate i got the following error message: r(100).
 I need anybody assistance.
My models are as follows:
program nlsuraids 

version 11 

  

syntax varlist(min=8 max=8) if, at(name) 

  

tokenize `varlist' 

args w1 w2 w3 lnp1 lnp2 lnp3 lnp4 lnexp 

  

  

tempname a1 a2 a3 a4 

scalar `a1' = `at'[1,1] 

scalar `a2' = `at'[1,2] 

scalar `a3' = `at'[1,3] 

  

scalar `a4' = 1 - `a1' - `a2' - `a3' 

  

tempname b1 b2 b3 b4 

scalar `b1' = `at'[1,4] 

scalar `b2' = `at'[1,5] 

scalar `b3' = `at'[1,6] 

  

scalar `b4' = -`b1' - `b2' - `b3' 

  

tempname g11 g12 g13 g14 

tempname g21 g22 g23 g24 

tempname g31 g32 g33 g34 

tempname g41 g42 g43 g44 

  

scalar `g11' = `at'[1,7] 

scalar `g12' = `at'[1,8] 

scalar `g13' = `at'[1,9] 

  

scalar `g14' = -`g11' - `g12' - `g13' 

  

scalar `g21' = `g12' 

scalar `g22' = `at'[1,10] 

scalar `g23' = `at'[1,11] 

  

scalar `g24' = -`g21' - `g22' - `g23' 

  

scalar `g31' = `g13' 

scalar `g32' = `g23' 

scalar `g33' = `at'[1,12] 

  

scalar `g34' = -`g31' - `g32' - `g33' 

  

scalar `g41' = `g14' 

scalar `g42' = `g24' 

scalar `g43' = `g34' 

  

scalar `g44' = -`g41' - `g42' - `g43' 

  

  

  

quietly { 

tempvar lnpindex 

gen double `lnpindex' = 5 + `a1'*`lnp1' + `a2'*`lnp2' /// 

+ `a3'*`lnp3' + `a4'*`lnp4' 

forvalues i = 1/4 { 

forvalues j = 1/4 { 

replace `lnpindex' = `lnpindex' + /// 

0.5*`g`i'`j''*`lnp`i''*`lnp`j'' 

} 

} 

replace `w1' = `a1' + `g11'*`lnp1' + `g12'*`lnp2' + /// 

`g13'*`lnp3' + `g14'*`lnp4' + `g15'*`lnp5' + /// 

`b1'*(`lnexp' - `lnpindex') 

replace `w2' = `a2' + `g21'*`lnp1' + `g22'*`lnp2' + /// 

`g23'*`lnp3' + `g24'*`lnp4' + `g25'*`lnp5' + /// 

`b2'*(`lnexp' - `lnpindex') 

replace `w3' = `a3' + `g31'*`lnp1' + `g32'*`lnp2' + /// 

`g33'*`lnp3' + `g34'*`lnp4' + `g35'*`lnp5' + /// 

`b3'*(`lnexp' - `lnpindex') 

} 

  

end 

nlsur aids @ w1 w2 w3  lnp1-lnp4 lnexp, ifgnls nequations(3) param(a1 

a2 a3  b1 b2 b3  g11 g12 g13  g22 g23  g33 ) nolog 


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