Hi everyone,
I am new to Stata and have a specific question which hasn't been asked previously. I would like to determine the drivers of capital flow volatility (for FDI, portfolio flows etc) in a panel regression framework. I have quarterly data from 1990q1 to 2015q4 for about 30 countries. In order to obtain capital flow volatility I have to determine the rolling window standard deviation of capital flows (in % of GDP) over 16 quarters. I was able to obtain the std. dev. RW volatility values using the asrol code. However in addition I would like to normalize the capital flow size in each window to account for sudden and inflated capital flows. This has been done before in previous studies by setting the largest flow in the window in absolute terms at 100 and adjusting the rest of the flows in the window accordingly.
However, I have no idea how to do that in Stata and whether it even is possible. Any help would be greatly appreciated, thanks!
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input long country1 float time double(FDI_Y portf_Y growth cpiinf)
1 120 .17231784760951996 -.9790787100791931 . 2313.96466339752
1 121 .297639936208725 -.1853722333908081 . 2313.96466339752
1 122 .5561167001724243 -.297639936208725 . 2313.96466339752
1 123 3.7674949169158936 -1.3263252973556519 . 2313.96466339752
1 124 .35033947229385376 .6481280326843262 8.01972920571854 171.671696468306
1 125 .8563854098320007 .04281926900148392 12.6232550936542 171.671696468306
1 126 1.9112964868545532 .6228257417678833 10.3181134926589 171.671696468306
1 127 1.6290786266326904 15.704939842224121 11.0739362271975 171.671696468306
1 128 .9140308499336243 1.9101029634475708 14.7219244954837 24.8999485988255
1 129 .8333814740180969 .824242889881134 12.1971686945041 24.8999485988255
1 130 1.8140782117843628 1.7009556293487549 8.71265614740751 24.8999485988255
1 131 3.585623025894165 .8046157360076904 3.86171819523977 24.8999485988255
1 132 .713859498500824 1.5377459526062012 5.54761931043747 10.6114940961305
1 133 .7013773322105408 38.629981994628906 4.27610081101725 10.6114940961305
1 134 1.4815151691436768 6.997681617736816 5.54071690729179 10.6114940961305
1 135 1.4612315893173218 8.938626289367676 7.53490991157804 10.6114940961305
1 136 .9901248812675476 4.15770959854126 22.4869436613209 4.17734724366985
1 137 1.3512213230133057 -.11289051175117493 18.4146986836012 4.17734724366985
1 138 1.1978986263275146 6.422641277313232 14.7651310963296 4.17734724366985
1 139 1.6693300008773804 5.218678951263428 15.6788995316809 4.17734724366985
I am new to Stata and have a specific question which hasn't been asked previously. I would like to determine the drivers of capital flow volatility (for FDI, portfolio flows etc) in a panel regression framework. I have quarterly data from 1990q1 to 2015q4 for about 30 countries. In order to obtain capital flow volatility I have to determine the rolling window standard deviation of capital flows (in % of GDP) over 16 quarters. I was able to obtain the std. dev. RW volatility values using the asrol code. However in addition I would like to normalize the capital flow size in each window to account for sudden and inflated capital flows. This has been done before in previous studies by setting the largest flow in the window in absolute terms at 100 and adjusting the rest of the flows in the window accordingly.
However, I have no idea how to do that in Stata and whether it even is possible. Any help would be greatly appreciated, thanks!
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input long country1 float time double(FDI_Y portf_Y growth cpiinf)
1 120 .17231784760951996 -.9790787100791931 . 2313.96466339752
1 121 .297639936208725 -.1853722333908081 . 2313.96466339752
1 122 .5561167001724243 -.297639936208725 . 2313.96466339752
1 123 3.7674949169158936 -1.3263252973556519 . 2313.96466339752
1 124 .35033947229385376 .6481280326843262 8.01972920571854 171.671696468306
1 125 .8563854098320007 .04281926900148392 12.6232550936542 171.671696468306
1 126 1.9112964868545532 .6228257417678833 10.3181134926589 171.671696468306
1 127 1.6290786266326904 15.704939842224121 11.0739362271975 171.671696468306
1 128 .9140308499336243 1.9101029634475708 14.7219244954837 24.8999485988255
1 129 .8333814740180969 .824242889881134 12.1971686945041 24.8999485988255
1 130 1.8140782117843628 1.7009556293487549 8.71265614740751 24.8999485988255
1 131 3.585623025894165 .8046157360076904 3.86171819523977 24.8999485988255
1 132 .713859498500824 1.5377459526062012 5.54761931043747 10.6114940961305
1 133 .7013773322105408 38.629981994628906 4.27610081101725 10.6114940961305
1 134 1.4815151691436768 6.997681617736816 5.54071690729179 10.6114940961305
1 135 1.4612315893173218 8.938626289367676 7.53490991157804 10.6114940961305
1 136 .9901248812675476 4.15770959854126 22.4869436613209 4.17734724366985
1 137 1.3512213230133057 -.11289051175117493 18.4146986836012 4.17734724366985
1 138 1.1978986263275146 6.422641277313232 14.7651310963296 4.17734724366985
1 139 1.6693300008773804 5.218678951263428 15.6788995316809 4.17734724366985
Comment