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.

# Re: st: how do we jointly test coefficients from different regressions?

 From Jorge Eduardo Pérez Pérez To "statalist@hsphsun2.harvard.edu" Subject Re: st: how do we jointly test coefficients from different regressions? Date Tue, 19 Mar 2013 00:38:36 -0400

```This is an example of the "stacking" approach using reshape. I don't
understand what you mean when you say you want to allow the constant,
but I contemplate it the example below.

* ----------------- Begin code ---------------------------------------
clear
version 12
* This just generates some random data. You do not need to do this.
set obs 68
set seed 135
* x variables
gen x1=rnormal()
gen x2=rnormal()
* time
gen time=_n
* 3 y variables (this could be any number of variables, i.e. 25)
glo nvar=3
* Coefficients. I am setting 0 for x1 and 1 for x2
forv i=1(1)\$nvar {
glo b`i'1=0
glo b`i'2=1
}
forv i=1(1)\$nvar {
gen y`i'=\${b`i'1}*x1+\${b`i'2}*x2
}
* Now I have a data set like yours.
* Reshape, same as stacking y into 1 vector
reshape long y, i(time) j(var)
* Add an error term for the regression. You do not need to do this.
gen e=0.1*rnormal()
replace y=y+e
* Regress the stacked y on x, different coefficients by var.
* Constant is not varying over the different y variables
* If you want to allow the constant to vary, use reg y c.(x1 x2)##i.var
reg y c.(x1 x2)#i.var
* Test coefficients on x1. Notice this can be run for any number of variables.
qui test 1.var#c.x1=0
forv i=2(1)\$nvar {
qui test `i'.var#c.x1=1.var#c.x1, accum
}
test
* --------------------- End code ----------------------------------------

Hope this helps,

Jorge Pérez.
_______________________
Jorge Eduardo Pérez Pérez

On Mon, Mar 18, 2013 at 11:55 PM, Arthur Boman <boman@berkeley.edu> wrote:
> Hello,
>
> I am working on a joint test.  The test is NOT of the standard f-test
> form:
>
> y = a*x1 + b*x2+ c*x3 +d*x4, and then testing the null whether a=b=c=0.
>
> The test is of the form:
>
> y1= a*x1 + f*x2  and  y2= b*x1 + g*x2 and  y3= c*x1 + h*x2 and testing the
> null whether a=b=c=0
>
> I want to allow the constant.
>
> I have looked a lot and cannot figure out how to do in Stata.
>
> y1, y2, y3, x1, x2 are time series data by year... one value per year.  I
> have data for all five of those variables for each of 68 consecutive years.
> I don't have data for any of them for any other years.
>
> Someone suggested I stack (y1, y2, y3) into a column vector.  I dont get
> how that would work and cannot ask the person.
>
> Thanks,
> Arthur
>
> (More background: y1, y2, and y3 are portfolio returns by year.  I want to
> test the hypothesis that x1 is not a priced factor in ANY of the portfolios
> (i.e. that the coefficient on x1 is zero for ALL portfolios).  x2 is just
> another factor in my asset-pricing model.  There are actually 25
> portfolios, not just three.  I will be testing whether we can reject the
> null hypothesis that all of the 25 coefficients are zero.)
>
>
>
>
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```