Hello,
I need to do some operations over all the lags up to the current value, but the loop I wrote takes forever, could you please tell me how to speed it up?
levelsof permno, local(levels)
foreach lev of local levels {
gen l1_new=(retex-b_cons-b_mktrf*mktrf)*(mktrf-mktrf_mean)^2
local lag=_n
forval i=1/`lag'-1{
replace l1_new=l1_new+(l`i'.retex-b_cons-b_mktrf*l`i'.mktrf)*(l`i'.mktrf-mktrf_mean)^2
}
}
Thank you in advance,
Alina
Later edit: I am also getting errors in the code, but I don't know why.
Related Posts with Operations over lags
Which test is better to use with categorical variables?Good afternoon! I regress the model: GDP = β0 + β1ERR1 + β2ERR2 + ơ1Pop+ ơ2Surf + ơ3ExGS + ơ4ExpEd…
Conditional probabilityHello, I have a panel data of participants with their blood sugar levels. I want to calculate proba…
How to turn off scientific notation for estat ic/est stats to avoid identical AIC results?Hi, I'm in need of advice of how to turn off scientific notation for estat ic/est stats. I have chan…
Compare permute to ttestDear all, maybe this is a silly question but I cannot spot the error. Basically, I can compare 2 sam…
Out-of-sample R^2I am struggling to compute my out-of-sample results for R^2os. This is out-of-sample R^2 as done by …
Subscribe to:
Post Comments (Atom)
0 Response to Operations over lags
Post a Comment