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

AW: st: betacoef for new variable?

From   Fabian Nagel <>
Subject   AW: st: betacoef for new variable?
Date   Fri, 21 Mar 2008 02:09:02 +0100

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

So far I adopted Vladimir´s advice.

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

This results in:
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,

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


1. Beta-coefficients are calculated based on your regression. If you
want to include betas for every year, include annual dummies into your
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,

2008/3/20, Fabian Nagel <>:

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
 generate beta=r(beta) if country==`i'

 The problems I have now are:

 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.

 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,

 *   For searches and help try:

Volodymyr Vakhitov
*   For searches and help try:

*   For searches and help try:

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