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
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: How to get mean coefficients and t-statistics from several regressions
Date
Tue, 30 Jul 2013 15:09:38 +0100
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/