[R-SIG-Finance] PCA in Risk Control with R
Benji Famel
benjifamel at gmail.com
Wed Feb 17 00:34:38 CET 2010
Hello,
my apologies if I do something wrong - first posting for me.
I am trying to apply PCA on the daily history of a bunch of forward
curves and run into my depths of ignorance. I would appreciate some
help...
My aim is to use PCA for risk control. I.e. estimate the
eigenverctors and eigenvalues and build the principal components at
some confidence level, e.g. 95%. If, for example, we were looking at
the first 3 components only, I would
- estimate PC1up, PC1dn, PC2up, PC2dn, PC3up and PC3dn.
Let's assume that
- PC1up is worse for my position than PC1dn,
- PC2up is worse than PC2dn and
- PC3dn is worse than PC3up
I would then 'add' these worse for me components (PC1up, PC2up and
PC3dn) and run my position through them to get a measure of risk at
that confidence level.
To do the PCA, I first foundthe log returns, let's call them Returns.
I then do:
pcdat <-princomp(Returns, cor=TRUE)
and calculate the principal components like this (this is where I am
very foggy...):
PC <- exp(someQuantile*t(pcdat[[2]])*sqrt(pcdat[[1]])*sd(Returns)) #
somQuantile = 1.64 for a 95% CL
As much as I looked around, people discuss the benefits of PC but not
how to recombine the principal components at some confidence interval
to get a shocked curve.
Could anyone help?
Thank you,
Benji
More information about the R-SIG-Finance
mailing list