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]
Re: st: nlsur QUAIDS (Poi 2008)
From
"Brian P. Poi" <[email protected]>
To
[email protected]
Subject
Re: st: nlsur QUAIDS (Poi 2008)
Date
Thu, 19 May 2011 19:47:27 -0400
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
-- [email protected]
*
* 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/