2006/4/24, David Harrison <[email protected]>:
> The -cnsreg- approach is numerically identical to generating the new
> variable x as suggested in ronggui's original post, but looks rather
> more complicated to me.
>
> The only error in ronggui's original code seems to be in the
> specification of the two -reg- commands, which should be:
>
> reg y x1 x2 x3
> reg y x
>
> These two models are nested.
Thanks for all :)
Now I get it.
> David
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Joseph
> Coveney
> Sent: 24 April 2006 09:45
> To: Statalist
> Subject: Re: st: How to test the equality of coef in regression model
>
> ronggui wrote:
>
> First,I get the first model by:
> reg y x1 x2 x2 x3
>
> then I want to test if _b[x1]=_b[x2]=_b[x3], Can I achieve it by the
> following codes?
> gen x=x1+x2+x3
> reg y x1 x2 x2 x3
> est store A1
> reg y x1 x
> lrtest A1 .
>
> Are model A1 and . nested? and Is this test valid?
>
> Thanks.
>
> ------------------------------------------------------------------------
> --------
>
> Maybe you could use constrained regression (-help constraint- and -help
> cnsreg-) or just do a Wald test (-help test-). They both seem to arrive
> at
> the same conclusion in the example below.
>
> Joseph Coveney
>
>
> clear
> set more off
> set obs 25
> set seed `=date("2006-04-24", "ymd")'
> forvalues i = 1/3 {
> generate float x`i' = uniform()
> }
> generate float y = 2 * x1 + 2 * x2 + 2 * x3 + invnorm(uniform())
> regress y x*
> test x1 = x2, notest
> test x2 = x3, accumulate
> estimates store A
> constraint 1 x1 = x2
> constraint 2 x2 = x3
> cnsreg y x*, constraints(1-2)
> lrtest A ., force
> exit
>
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
--
���ٹ�
Deparment of Sociology
Fudan University
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/