Componente principal en matlab - gráfico de cargas

I am trying to obtain a PCA loadings plot similar to that in the artículo siguiente (vea la página 40).

I have estimated a so called affine no-arbitrage model with latent state variables (level, slope and curvature), which I want to track (/plot) together with the PCA loadings (similar to the article, however I will plot Level, inflation and PCA 1, instead of LEVEL and CPI. Similarly with slope and curvature).

  1. Puedo usar el princomp(X) function in MATLAB, however I am not able to obtain the loadings such that I can plot them with the other data. That is: I do not know how I obtain a time series of the loadings in the PCA (once again, see the article). How do I do this in MATLAB?

  2. I also assume that I have to do some data processing on the original data such that it can be plotted on the same "scale" as the loadings. In the article they use normalized data series on CPI and so on. So if I am correct, that should be pretty straight forward, I just need to demean the data and find unit variance by X=X/std(X(:));.. (where X is the original data vector).

The code I have been running so far is [COEFF,SCORE,latent,tsquare] = princomp(yields) however, does SCORE provide me with the time series of the PCA loadings? The SCORE matrix seem to be the correct size...and if SCORE is the correct matrix for plotting (such as the fig. in the article) then do I also need to process the PCA data (normalize)...?

Note: Yields is a 170x5 matrix (5 yields of zero coupon bonds over 170 months)

Gracias.

preguntado el 12 de junio de 14 a las 10:06

The link isn't working. Also, can you put up the relevant code snippet of whatever you have done till now? -

Welcome to StackOverflow. There are some issues with your question. Firstly, the link you provide does not lead to a "page 40". Secondly, you don't provide enough information so that others can diagnose the problem. In order to maximise your chances of getting a useful answer, please read the link below and update your question accordingly: msmvps.com/blogs/jon_skeet/archive/2012/11/24/… -

So sorry, something went wrong with the link apparently.. also tried to improve the question. I have tried to find a solution on the web, however with no luck, I am only able to find the plot, never how to obtain the plot... -

I tried running the following, which seems very correct: norm_level=factors(:,1)-mean(factors(:,1)) %here I normalize the level factor. Then I ran: standardLVL=norm_level/std(norm_level(:)). Then I repeated this with the PCA1, norm_score=SCORE(:,1)-mean(SCORE(:,1)) e norm_score=norm_score/std(norm_score(:)) y luego Z=[norm_score standardLVL]e plot(Z). Any one can confirm whether this is correct..? -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.