Bookmark and Share

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: how do we jointly test coefficients from different regressions?


From   Arthur Boman <[email protected]>
To   <[email protected]>
Subject   Re: st: how do we jointly test coefficients from different regressions?
Date   Tue, 19 Mar 2013 12:07:53 -0700

Jorge,

When I say 'allow the constant' I just meant that the regression has a
constant in it and is not forced to pass through the origin.  But now that
you mention it... Yes I need to allow the constant to vary over different y
variables.

I will have to do a lot of reading and study to know what this means.

If I trim your code to exclude generation of the dataset, I guess I get
the following.  I have also tried to include the facts that 1. there is
more than just x2, there is also x3 and x4 and that 2. there are y1... y25:

clear
reshape long y, i(year) j(var)
* Regress the stacked y on x, different coefficients by var.
* Allowing the constant to change over different y variables:
reg y c.(x1 x2 x3 x4)##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

Did I erase anything that I should not have?



On Tue, 19 Mar 2013 00:38:36 -0400, Jorge Eduardo Pérez Pérez
<[email protected]> wrote:
> 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 <[email protected]>
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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index