PCA on Panel data

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

abcd
Posts: 7
Joined: Fri Jan 17, 2014 9:59 am

PCA on Panel data

Postby abcd » Sun Jan 26, 2014 7:12 am

Hi Admin


I am woring on panel data, haveing time series form 1970 to 2008. and number of countries are 30. I have to generate the PCA for each country. first of all I have to generate the eigen values for country one and store them in excel and generate the eigen vlaues for country two and save them in excel below the eigean values of first country eigen values. and so on

how i can do this
thanks

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: PCA on Panel data

Postby EViews Glenn » Mon Jan 27, 2014 2:38 pm

You'll have to write a simple program to loop over the calculation for each cross-section. There are many examples of such looping on this forum and in the EViews documentation.

abcd
Posts: 7
Joined: Fri Jan 17, 2014 9:59 am

Re: PCA on Panel data

Postby abcd » Wed Jan 29, 2014 3:40 am

thanks for reply

can you please refer me to such loops

thanks
i am unalbe to find.

abcd
Posts: 7
Joined: Fri Jan 17, 2014 9:59 am

Re: PCA on Panel data

Postby abcd » Wed Jan 29, 2014 10:30 am

Not geeting the command to save the eigen values in Excel.

how to do this .

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: PCA on Panel data

Postby EViews Glenn » Wed Jan 29, 2014 10:46 am

Code: Select all

!maxcrossid = @max(@crossid) for !i=1 to !maxcrossid smpl if @crossid = !i [do your thing here] next

aramibiaram
Posts: 2
Joined: Mon Jan 19, 2015 6:56 am

Re: PCA on Panel data

Postby aramibiaram » Mon Jan 19, 2015 7:13 am

Can you explain more??????

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: PCA on Panel data

Postby EViews Glenn » Mon Jan 19, 2015 9:11 am

Just substitute the lines to do the pca and save the results in place of the lines

[do your thing here]

I dont' remember the syntax but I believe something like

Code: Select all

grp.pcomp(eigen=a)
should save the eigenvalues for the correlation matrix of the group into the vector A. For each cross-section, you'll also want to put A in a different row of a results matrix.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests