Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: How to test the equality of coef in regression model


From   Joseph Coveney <jcoveney@bigplanet.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   Re: st: How to test the equality of coef in regression model
Date   Mon, 24 Apr 2006 17:44:55 +0900

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/



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