Bookmark and Share

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]

Re: st: nlsur QUAIDS (Poi 2008)


From   olorunfemi sola <solafem7@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: nlsur QUAIDS (Poi 2008)
Date   Fri, 20 May 2011 09:37:06 +0100 (BST)

Dear  Brian,
 Thank you very much for your assistance, I admire you.
After correcting the errors you identified, I am still having the same problem(i.e error ).For your information am using the data used by Poi(2008)for four goods in his explanation of nlsur. Kindly help me to fix where the problem is.Your advice will equally be appreciated. My model after effecting your corrections 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' + ///
`b1'*(`lnexp' - `lnpindex')
replace `w2' = `a2' + `g21'*`lnp1' + `g22'*`lnp2' + ///
`g23'*`lnp3' + `g24'*`lnp4' + ///
`b2'*(`lnexp' - `lnpindex')
replace `w3' = `a3' + `g31'*`lnp1' + `g32'*`lnp2' + ///
`g33'*`lnp3' + `g34'*`lnp4' + ///
`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





*********************************************************************** 
SOLA OLORUNFEMI   Ph.D
SENIOR LECTURER   DEAPARTMENT OF ECONOMICS
ADEKUNLE AJASIN UNIVERSITY 
AKUNGBA AKOKO 
ONDO STATE NIGERIA official e-mail: olorunfemi@adekunleajasinuniversity.edu.ng
TEL NO +234 803 581 0893 

**********************************************************************


--- On Fri, 20/5/11, Brian P. Poi <brian@poiholdings.com> wrote:

> From: Brian P. Poi <brian@poiholdings.com>
> Subject: Re: st: nlsur QUAIDS (Poi 2008)
> To: statalist@hsphsun2.harvard.edu
> Date: Friday, 20 May, 2011, 0:47
> On 05/19/2011 02:06 PM, olorunfemi
> sola wrote:
> > 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]
> <snip>
> > 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')correct; as documented in
> [R] nlsur,
> > 
> > }
> 
> 
> The problem is that your -replace- statements for the
> expenditure shares are written assuming there are five
> goods, not four.  That is, the references to `g15',
> `g25', `g35', and `lnp5' are causing the problems.  For
> example, the -replace- for `w1' should be
> 
>    replace `w1' = `a1' + `g11'*`lnp1' +
> `g12'*`lnp2' + ///
>                
>   `g12'*`lnp3' + `g14'*`lnp4' +     
>   ///
>                
>   `b1'*(`lnexp' - `lnpindex')
> 
> 
> Your -syntax- statement is fine the way it is; -nlsur-
> always calls your program with an "if" condition marking the
> estimation sample (which may consist of all the observations
> in the dataset).  If you ensure you do not have any
> missing values for any of the variables in your model before
> calling -nlsur-, you can skip having to mess around with its
> ramifications.  One of the examples in the reference
> manual entry shows how to write your evaluator program so
> that it respects the estimation sample.
> 
> I hope this helps.
> 
> 
>    -- Brian Poi
>    -- brian@poiholdings.com
> *
> *   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index