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

From |
pstock@rumms.uni-mannheim.de |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Programming an iterative regression with converging parameters |

Date |
Fri, 15 Aug 2008 07:51:43 +0200 |

Hello STATA users,

I am new to STATA and have to replicate a paper by Easton, Taylor, Shroff, Soughiannis (2002) about the implicit calculation of the implied cost of capital r. The problem is that the proxy for the dependent variable X_cT is caluclated with r, while r itself is to be estimated from the regression coefficients. They note that an initial r=0.12 or 12% is used to calculate X_cT. Then it is used as dependent variable to run the first regression. From the resulting intercept and regression coefficient the r and growth rate g are calculated. The new r is used as revised estimate of the implied cost of capital r to recalculate X_cT. The regression is run again and the process of estimating r from the coefficients, and recalculating X_cT starts all over. The logic is simple and straight forward - the programming for a rookie is not. Reading about STATA Programming I guess that a loop using the while command is needed, with the iterative regression to stop when the r from the previous run and the new r are so close as not changing matterially. I used r_`j'-r_`i'>0.0001 as indicator to continue with the loop, as the "true" condition. Also r must be positiv, whereas the forth root can be negative, but is economic meaningless. How to program constraints I do not know - sounds like MATA-rogramming then. So I tried it first without the constraints. Maybe the nl command could work.

Here is my do file, and when executing it I even do not get an error message, neither results, not anything:

clear

set memory 50m

use "C:\Users\stock.GESS\Desktop\IBES Datensatz\Data_replication_study_1_X_cT.dta"

preserve

generate r_1=0.12

generate X_cT_1=x1+x2+x3+x4+[(1+r_1)^3-1]*d0+[(1+r_1)^2-1]*d0+[(1+r_1)-1]*d0

generate depvar=X_cT_1/B0

local i=1

forvalues i=1/100 {

local j=1

while r_`j'-r_`i'>0.001 {

replace r_`i'=r_`j'

replace X_cT_`i'=x1+x2+x3+x4+[(1+r_`i')^3-1]*d0+[(1+r_`i')^2-1]*d0+[(1+r_`i')-1]*d0

replace depvar=X_cT_`i'/B0

regress depvar indvar

generate g_`i'=(_b[_cons]+1)^(1/4)-1, replace

generate r_`j'=(_b[indvar]+(_b[cons]+1))^(1/4)-1, replace

}

}

save Data_replication_study_1_X_cT_1.dta

describe

summarize

estimates save regression_1, replace

estimates tab

Any suggestions hw to program such a process are highly appreciated.

Kind regards

Pascal Stock

*

* 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/

- Prev by Date:
**Re: st: RE: RE: convergence problems with zinb** - Next by Date:
**st: Tabulation task** - Previous by thread:
**st: data structure for xtmepoisson** - Next by thread:
**RE: st: Programming an iterative regression with converging parameters** - Index(es):

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