At first I would like to thank you, Hélio, Allin, and Riccardo for your help.
Em 22 de janeiro de 2010 Riccardo escreveu:
On Fri, 22 Jan 2010, Henrique wrote:
> Dear Gretl community,
>
> I want to create a index using five variables using gretl's
> principal components analysis and I would like to know
> if I'm doing it properly. I'll describe my steps:
>
> Step 1: Compute principal components (Main window, View -> Principal
> components);
> Step 2: Save all components (PC1, ..., PC5);
> Step 3: index = PC1 + ... + PC5.
Sorry, Henrique, maybe I'm missing the point, but what are you trying to do?
I'm trying to rebuild the Financial Stress Index (Balakrishnan,
Danninger, Elekdag & Tytell (2009) The Transmission of Financial
Stress. IMF Working Paper) using a different technique. In this paper
the authors use a variance-equal weighting, something live this:
Index = (X1 - E(X1))/sd(X1) + ... + (X5 - E(X5))/sd(X5)
Where:
E(X1) -> mean of X1
sd(X1) -> standard deviation of X1
I would like to use principal components to determine the weights of
each variable in the index.
Em 22 de janeiro de 2010, Hélio escreveu:
<script>
open /usr/local/share/gretl/data/greene/greene14_1.gdt
pca Q PF LF C --save-all
index = PC1 + PC2 + PC3 + PC4
print index
gnuplot index --with-lines --time-series
</script>
Em 22 de janeiro de 2010 Allin escreveu:
On Fri, 22 Jan 2010, Hélio Guilherme wrote:
> <script>
> open /usr/local/share/gretl/data/greene/greene14_1.gdt
> pca Q PF LF C --save-all
> index = PC1 + PC2 + PC3 + PC4
> print index
> gnuplot index --with-lines --time-series
> </script>
You can also do this via matrix functions:
matrix X = {Q, PF, LF, C}
matrix idx = sumr(princomp(X, 4))
matrix G = idx~seq(1,$nobs)'
gnuplot 1 2 --matrix=G --suppress
I think we have a new problem here: when I put this instructions into
a script, Gretl doesn't plot any graph. To get the plots I need to
enter the lines "gnuplot index --with-lines --time-series"or "gnuplot
1 2 --matrix=G --suppress" on Gretl console. I'm using Gretl 1.8.6 CVS
(build 2010-01-21) for Mac.
Best regards,
Henrique C. de Andrade
Doutorando em Economia Aplicada
Universidade Federal do Rio Grande do Sul
www.ufrgs.br/ppge
--
Henrique C. de Andrade
Doutorando em Economia Aplicada
Universidade Federal do Rio Grande do Sul
www.ufrgs.br/ppge