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 to get mean coefficients and t-statistics from several regressions


From   Nahla Betelmal <[email protected]>
To   [email protected]
Subject   Re: st: How to get mean coefficients and t-statistics from several regressions
Date   Tue, 30 Jul 2013 16:45:15 +0100

Thanks again, I will keep that in mind, and I do hope that others find
this thread helpful and practical as I did.

Thank you
Nahla

On 30 July 2013 16:39, Nick Cox <[email protected]> wrote:
> In a strong sense you are both right and wrong.
>
> -regress- returns e(r2_a) and many, probably most, regression commands
> are based on -regress-. Often somebody writes a wrapper program that
> does some preparation and some processing before and after a call to
> -regress-.
>
> But (a very big but) what's crucial is exactly what a wrapper program
> returns. If it does not pass on a e-class result, that result is lost.
> Nick
> [email protected]
>
>
> On 30 July 2013 16:25, Nahla Betelmal <[email protected]> wrote:
>> Thanks for the clarification, and sorry about that. I genuinely
>> assumed that every regression command return  e(r2_a).
>>
>> Sorry and thanks again
>>
>> Nahla
>>
>> On 30 July 2013 16:11, Nick Cox <[email protected]> wrote:
>>> -xtfmb- (SSC) does not return -e(r2_a)-.
>>>
>>> To find that out takes two minutes running an example and checking the code.
>>>
>>> A Stata expert is just someone who just gets into certain habits:
>>> reading the help, looking at the code and running examples to check
>>> what is going on.
>>>
>>> I guess you need to clone the program and modify the cloned version to
>>> work out adjusted R-square.
>>>
>>> Nick
>>> [email protected]
>>>
>>>
>>> On 30 July 2013 16:00, Nahla Betelmal <[email protected]> wrote:
>>>> Thanks Nick for the reply, I tried that as well, but it gave me
>>>> missing adjusted R-squared, although the value of R-squared was
>>>> available. So I assumed that something wrong with this command,
>>>> because the papers reported adjusted R-square.
>>>>
>>>> Why the adjusted R square is missing? It would be great if there is a
>>>> way to get it.
>>>>
>>>> Also, I wonder if there is another way than statsby to get the mean of
>>>> the regressions betas and mean adjusted R square and matched standard
>>>> errors.
>>>>
>>>> Many thanks again
>>>>
>>>> Nahla
>>>>
>>>> On 30 July 2013 15:09, Nick Cox <[email protected]> wrote:
>>>>> Quite where the error is coming from is for you to tell us.
>>>>>
>>>>> Meanwhile this seems confused:
>>>>>
>>>>>  forval  i= 1/50 {
>>>>>        statsby _b e(r2)  e(r2_a) , by(industry):xtfmb DV IV1 IV2 IV3 if
>>>>>  industry== `i'
>>>>> }
>>>>>
>>>>> Much of the point of the -statsby- command is that it does the looping
>>>>> for you. It seems more likely that you want
>>>>>
>>>>> statsby _b e(r2)  e(r2_a) , by(industry): xtfmb DV IV1 IV2 IV3
>>>>>
>>>>> Nick
>>>>> [email protected]
>>>>>
>>>>>
>>>>> On 30 July 2013 14:43, Nahla Betelmal <[email protected]> wrote:
>>>>>> Hi Richard, thanks for your previous comments, and sorry for the delay
>>>>>> in replying. I had to do some readings to see how researchers solve
>>>>>> this issue.
>>>>>>
>>>>>> In industry-year context rather than firm-year context, authors seem
>>>>>> to report mean of the mean rather than just Fama-MacBeth  time series
>>>>>> mean.
>>>>>>
>>>>>> first they perform Fama-MacBeth on each industry alone to get the time
>>>>>> series mean . In other words, they perform cross-sectional  on the
>>>>>> firms-years observations in each industry to produce  time series mean
>>>>>> of each industry. This could be easily obtained by the following
>>>>>> Fama-MacBeth command available in Stata:
>>>>>>
>>>>>> tsset firm_id year
>>>>>>
>>>>>> forval  i= 1/50 {
>>>>>>     xtfmb DV IV_1 IV_2 IV_3 if  industry== `i'
>>>>>> }
>>>>>>
>>>>>> Therefore, there will be 50  time series mean betas, 50 mean R-square
>>>>>> for the 50 industries I have. This is easy to execute.
>>>>>>
>>>>>> The second stage is to take the mean of these 50 time series means
>>>>>> beta and the mean of these 50 means R-square, and of course the
>>>>>> standard error and the t-stat of mean of the mean betas.
>>>>>>
>>>>>> In this way, they can obtain the time series mean across industries
>>>>>> (rather than firms).
>>>>>>
>>>>>> Unfortunately, due to my humble knowledge with Stata, I have not
>>>>>> figured out the command of how to get stage two (i.e. mean of the mean
>>>>>> betas and matched standard error). I tried the following but there is
>>>>>> an error
>>>>>>
>>>>>> forval  i= 1/50 {
>>>>>>       statsby _b e(r2)  e(r2_a) , by(industry):xtfmb DV IV1 IV2 IV3 if
>>>>>>  industry== `i'
>>>>>> }
>>>>>>
>>>>>> collapse (mean) _b_cons _b_IV1 _b_IV2  _b_IV3  _eq2_stat_1 _eq2_stat_2///
>>>>>>  (semean) _se_cons = _b_cons _se_IV1 = _b_IV1  _se_IV2 = _b_IV2
>>>>>> _se_IV3 = _b_IV3
>>>>>>
>>>>>> foreach v in cons IV1 IV2 IV3 {
>>>>>> generate _t_`v' = _b_`v' / _se_`v'
>>>>>>  }
>>>>>>
>>>>>> I got error:
>>>>>>
>>>>>> no; data in memory would be lost
>>>>>> r(4);
>>>>>>
>>>>>>
>>>>>> If I remove  by(industry) in the first line of the loop , I got an error as well
>>>>>>
>>>>>> industry not found
>>>>>> r(111);
>>>>>>
>>>>>>
>>>>>> I would highly appreciate it if you can help me to figure out the
>>>>>> right command. Also, I do hope this thread to be useful for other
>>>>>> people who face this issue as well.
>>>>> *
>>>>> *   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/
>> *
>> *   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