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]

st: storing/retrieving regression coefficient estimates (xtreg)


From   "Braunfels, Philipp (Stud. SBE / Alumni)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: storing/retrieving regression coefficient estimates (xtreg)
Date   Mon, 2 Jul 2012 21:28:56 +0200

Dear statlisters,
I would like to ask if it is possible to store/retrieve the values of separate regression coefficient estimates (xtreg, fe) and to store them in a new variable.

More precisely, I would like to store the beta 1 coefficient estimate of the following regression:
xtreg y x1 x2 x3, fe vce(cluster ID), where beta 1 refers to the estimated coefficient of x1.
The reason why I would like to do that is as follows:  I am investigating the effect of macroeconomic variables on country-index returns and would like to plot the market beta against certain macro-variables using -twoway scatter-. Therefore, I need to estimate the beta for each country with the world market, store it in a new variable and plot this variable against the average value of a some macro-variables. 
I already found out that the coefficient estimates are stored as a vector and can be retrieved using  -e(b)-, which I cannot use to store as value of a new variable. Therefore, I am only interested in the value of ONE coefficient estimate.

the code I thus would like to implement looks as follows:

xtreg y x1 x2 x3 if country=="DE", fe vce(cluster ID)
<save coefficient estimate of x1, say b1>
gen beta_var=0
replace beta_var = b1 if country=="DE"
gen macro_var_average=0
sum macro_var if country=="DE"
replace macro_var_average = r(mean) if country=="DE"

[do this for all countries in my file and then plot the twoway scatter as described above]


I am very thankful for any support!
regards, p.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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