Hi,
I'm finishing my thesis we're I'm forming currency-hedge investment portfolios out of the PCA on the currencies.
I need to do a PCA using a "moving-window" of the previous 60 months of data, throughout my entire data-set.
If you want the "pseudo-code" is:
-Run PCA using previous 60m of data.
-Store the principal components
-Standardize principal components
-Average the standardized principal components according to each component's proportion.
-Export Array with the averaged standardized principal components, for each month.
Basically, an "OOS" PCA with 60 month rolling window.
Any thoughts?
I tried using the formula:
rolling e(L), window(60): pca AUD CAD EUR JPY NZD SGD SEK CHF GBP USD
But I end up having the mismatch r(109) error, and I can't understand why.
For those not acquainted with the rolling formula (http://www.stata.com/manuals13/tsrolling.pdf), e(L) is supposed specification of the stored components, 60 the number of periods to use, and pca the command we are using.
Thanks for ANY help you can provide me with this.
PS: If anyone knows how to do this in other statistical software (R, for instance), some tips would also be welcomed!
I'm finishing my thesis we're I'm forming currency-hedge investment portfolios out of the PCA on the currencies.
I need to do a PCA using a "moving-window" of the previous 60 months of data, throughout my entire data-set.
If you want the "pseudo-code" is:
-Run PCA using previous 60m of data.
-Store the principal components
-Standardize principal components
-Average the standardized principal components according to each component's proportion.
-Export Array with the averaged standardized principal components, for each month.
Basically, an "OOS" PCA with 60 month rolling window.
Any thoughts?
I tried using the formula:
rolling e(L), window(60): pca AUD CAD EUR JPY NZD SGD SEK CHF GBP USD
But I end up having the mismatch r(109) error, and I can't understand why.
For those not acquainted with the rolling formula (http://www.stata.com/manuals13/tsrolling.pdf), e(L) is supposed specification of the stored components, 60 the number of periods to use, and pca the command we are using.
Thanks for ANY help you can provide me with this.
PS: If anyone knows how to do this in other statistical software (R, for instance), some tips would also be welcomed!
Comment