Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

AW: st: betacoef for new variable?


From   Fabian Nagel <Fabian.Nagel@uni-konstanz.de>
To   statalist@hsphsun2.harvard.edu
Subject   AW: st: betacoef for new variable?
Date   Fri, 21 Mar 2008 02:09:02 +0100

1.) Pryvet Vladimir,
spasiba for your quick response.

2.)
So far I adopted Vladimir´s advice.

forvalues i=1/30 {
xi: reg conver lag_log_ssegdp i.year if country==`i', noconstant
betacoef
return list
matrix list r(beta)
}

This results in:
matrices:
r(beta) : 1 x 27
(for each of the 30 countries)

But somehow I don`t get the trick, when I try to use -svmat- for saving the values as variables. Or ist any other operation more suiteable to transform those beta-coefficients into new a new list of variables?


If anyone has any idea I will appreciate it,
Fabian


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Vladimir Vakhitov
Gesendet: Freitag, 21. März 2008 00:17
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: betacoef for new variable?

Fabian,

1. Beta-coefficients are calculated based on your regression. If you
want to include betas for every year, include annual dummies into your
regression.
For example:
xi: conver lag_log_ssegdp i.year if country==`i', noconstant

2. -r(beta)- is a matrix, and you are trying to save the matrix into
the variable, that is why you are getting an error r(109). Look for
-matrix subscription- in Help to see how to address individual
elements of the matrix.

Best wishes,
Vladimir.


2008/3/20, Fabian Nagel <Fabian.Nagel@uni-konstanz.de>:

Dear Stata-community,

 I want to generate a new variable containing the current value of the
 beta-coefficient for each country, each year. The dataset includes 30
 countries for the period from 1980-2003.

 My last thought was:

 forvalues i=1/30 {
 reg conver lag_log_ssegdp if country==`i', noconstant
 betacoef
 generate beta=r(beta) if country==`i'
 }

 The problems I have now are:

 1.
 I want the beta-coefficient to be calculated for each year AND each
 country and not only for each country, but right now I have no idea
 how I can achieve this.

 2.
 When the loop generates beta=r(beta) I receive the r(109), type
 mismatch. Is there any possibility to save the beta-coefficients (for
 each year and each country) as a new variable?

 Thanks for any suggestion in advance,
  Fabian


 *
 *   For searches and help try:
 *   http://www.stata.com/support/faqs/res/findit.html
 *   http://www.stata.com/support/statalist/faq
 *   http://www.ats.ucla.edu/stat/stata/


--
__________________
Volodymyr Vakhitov
vvakhitov@gmail.com
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index