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
removing the first character of a string variable if it is zeroHi everyone, How can I remove the first character(s) of values if they are zero? For example, I woul…
[new on SSC] ineqord: module to calculate indices of inequality and polarization for ordinal dataWith thanks as ever to Kit Baum, ineqord is now available on SSC. Its functionality is described bel…
Ivreg 2sls and fixed effectsDear all, I would like to use instrument2 as an instrument for sp_city_10t. I estimate the following…
Post estimation with endogenous switching regressionsDear STATALIST, I am using an endogenous switching regression model to understand how selection aff…
esttab: Can't Export Continuous Variable's Coefficient when it's also in Another Interaction Term & Exporting with Multiple SpecificationsDear Statalist Users, I am having trouble exporting my estimation results for my paper. I am using …
Subscribe to:
Post Comments (Atom)
0 Response to Rolling window standard deviation of residuals in ARIMA
Post a Comment