Dear Statalist community,
I have trouble writing the code and would greatly appreciate your help.
I am working on a panel of quarterly data for 37 countries. I investigate the variability of different types of capital flows. For that purpose I will need to run a separate ARIMA (1,1,0) of each type of capital flow for each country and calculate the corresponding residuals. Afterwards, I need to calculate the separate rolling standard deviation (over 5 quarters) of each series of residuals.
So I have:
c_id quarter y1....y19 (with y I name the different types of capital flows)
And I use the following code which needs improvement
local z "y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 y17 y18 y19"
. foreach k of local z {
. qby c_id: reg `k' l.d. `k'
predict residuals, residuals
egen sd_residuals=sd(residuals), by(quarter)
. }
Thank you in advance.
Related Posts with Rolling window standard deviation of residuals in ARIMA
Optimization time when transposing rclass into eclassDear Statalist, I need to use _pctile inside another ado that only accepts eclass programs. My orig…
Fixed effect estimator, interaction effect with dummy variable varying within unit and timeHei, I am doing a fixed effect model on a panel of N = 1089 and T = 30 000 (ish). ESGscore = beta…
Survival Analysis - Failure / UnknownHi there, I have a question regarding survival data My data is as follows: Code: * Example gener…
Non-linear ARDL bound testHow can I do NARDL in STATA? is there any user written command? FYI: I use STATA 15.1 …
ppml vs ppmlhdfe for structural gravity estimmationGood afternoon, I am studying the determinants of asset trade flows across 40ish countries, from 19…
Subscribe to:
Post Comments (Atom)
0 Response to Rolling window standard deviation of residuals in ARIMA
Post a Comment