Statalist


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

Re: st: betacoef for new variable?


From   "Vladimir Vakhitov" <[email protected]>
To   [email protected]
Subject   Re: st: betacoef for new variable?
Date   Thu, 20 Mar 2008 19:17:20 -0400

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 <[email protected]>:
> 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
[email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index