Saving regression results into a variable

#1
I have time-series data for many countries on exchange rate, consumer price index and interest rate.
Now I need for further analysis to save regression results in variables.

What I do:
For each country regress changes in exchange rate to changes in CPI and real interest rate

Code:
bysort cname: regress ndexch ndcpi nrreal
Data sample: http://pastebin.com/Qc4E8NbW

What I then need:
For each of this regressions to save appropriate coeff, t-values, R2, N_obs in according variables, let's say: ccndcpi, ccnrreal, ctndcpi, ctnrreal, cr2, cnobs. That means, that each of those cells will be the same for the same country.

This is necessary for further filtering of results, to compare them with each other, to make additional regressions and to prepare graphs for a research paper.

thx. in forehand
 

bukharin

RoboStataRaptor
#2
Use -statsby- to generate the results dataset. If you wanted it to be included in the main dataset you could then -merge- it in.
 
#3
Thanks a lot! Just one left problem: there are no t-statistics left. And the R2 values are not the best for predictions of significance. But regress doesn't save (at least under normal conditions) the t-values.
Any ideas?
 

bukharin

RoboStataRaptor
#4
Yes, but you can calculate the t-statistic yourself:
Code:
. sysuse auto, clear
(1978 Automobile Data)

. statsby b_weight=_b[weight] se_weight=_se[weight], by(foreign) clear: regress mpg weight
(running regress on estimation sample)

      command:  regress mpg weight
     b_weight:  _b[weight]
    se_weight:  _se[weight]
           by:  foreign

Statsby groups
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..

. gen t=b_weight / se_weight 

. list

     +---------------------------------------------+
     |  foreign    b_weight   se_wei~t           t |
     |---------------------------------------------|
  1. | Domestic   -.0059751   .0004654   -12.83925 |
  2. |  Foreign    -.010426   .0024942   -4.180132 |
     +---------------------------------------------+
 
#5
thanks again.... somehow we didn't came across the idea to use such simple math. We had no classes on stata, so while we have to learn stata, and do so, we start to forget the math behind it :)
I hope, that in some time I'll be able to help someone else, as you did.