Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: non-linear constraints panel dynamic estimation


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: non-linear constraints panel dynamic estimation
Date   Mon, 26 Oct 2009 10:23:02 -0400

E.g.

clear all
range id 1 10 10
expand 100
forv i=0/10 {
g x`i'=rnormal()
}
forv i=0/10 {
g z`i'=rnormal()
}
g y=.5*x0+rnormal()
forv i=1/10 {
replace y=y+.5*.9^(`i')*x`i'
}
forv i=0/10 {
replace y=y+.75*.9^(`i')*z`i'
}
program nlbdg
version 10
syntax varlist(min=23 max=23) [aw fw iw] if, at(name)
gettoken y varlist: varlist
forv i=0/10 {
gettoken x`i' varlist: varlist
}
forv i=0/10 {
gettoken z`i' varlist: varlist
}
tempname b d g
scalar `b' = `at'[1,1]
scalar `d' = `at'[1,2]
scalar `g' = `at'[1,3]
replace `y'=`b'*`x0'
forv i=1/10 {
replace `y'=`y'+`b'*(`d')^(`i')*`x`i''
}
forv i=0/10 {
replace `y'=`y'+`g'*(`d')^(`i')*`z`i''
}
end
matrix init=(.5,.5,.5)
nl bdg @ y x* z*, parameters(b d g) initial(init) vce(cluster id)
reg y x* z*, nohe vce(cluster id)
testnl _b[x1]/_b[x0]=_b[x2]/_b[x1]
loc c
forv i=1/9 {
loc c `c' (_b[x1]/_b[x0]=_b[x`=`i'+1']/_b[x`i'])
}
loc c `c' (_b[z1]/_b[z0]=_b[x1]/_b[x0])
forv i=1/9 {
loc c `c' (_b[z1]/_b[z0]=_b[z`=`i'+1']/_b[z`i'])
}
testnl `c'
loc p (_b[x1]/_b[x0])
forv i=1/9 {
loc p `p' (_b[x`=`i'+1']/_b[x`i'])
}
forv i=0/9 {
loc p `p' (_b[z`=`i'+1']/_b[z`i'])
}
nlcom `p'
areg y x* z*, a(id) vce(cluster id)
testnl `c'
nlcom `p'


On Mon, Oct 26, 2009 at 9:56 AM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>
> <>
>
> " and -test- whether the ratio of coef on x1 to the
> coef on x0 is the same as the the ratio of coef on x2 to the coef on
> x1 etc."
>
>
> Make that -testnl-?
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Austin Nichols
> Gesendet: Montag, 26. Oktober 2009 14:56
> An: statalist@hsphsun2.harvard.edu
> Betreff: Re: st: non-linear constraints panel dynamic estimation
>
> Gili et al.--
> You can use -nl- regardless, and the vce(cluster panel) option to
> account for correlation of errors within panel--there is nothing in
> the model as stated that requires an XT command.  Or you can estimate
> the linear model and -test- whether the ratio of coef on x1 to the
> coef on x0 is the same as the the ratio of coef on x2 to the coef on
> x1 etc. (there are 21 such ratios which should all equal delta).
> Estimating the linear model directly also allows comparing the pooled
> model with clustered errors to a FE or RE regression using -xtreg- and
> such.
>
> On Mon, Oct 26, 2009 at 9:42 AM, Maarten buis <maartenbuis@yahoo.co.uk>
> wrote:
>>> -- Gili Greenberg wrote:
>>> > I am  looking to estimate an equation such as the
>>> > following:
>>> >
>>> >
>>> y=beta*[x0+delta*x1+delta^2*x2+delta^3*x3+...+delta^10*x10]+gama*
>>> > [z0+delta*z1+delta^2*z2+...+delta^10*z10]
>>> >
>>> > using panel data.
>>>
>>> --- On Mon, 26/10/09, Nick Cox wrote:
>>> > It does look like a case for -nl- to
>>> > me.
>>>
>>> Normally yes, but Gili asked for doing this with panel
>>> data.
>>
>> There is one case where -nl- might be the solution, and
>> that is when there is only one y for each unit (person/
>> company/ant/whatever), for example when it is the end
>> state after some growth process. In that case you don't
>> have a panel structure in your model, as you just have
>> one observation per person, and you can just use -nl-.
>>
>> -- Maarten
>>

*
*   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   |   What's new   |   Site index