principal component analysis (PCA)_store some of PC

For questions regarding programming in the EViews programming language.

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

veni
Posts: 13
Joined: Fri Sep 02, 2016 6:04 am

principal component analysis (PCA)_store some of PC

Postby veni » Thu Sep 08, 2016 6:17 am

Hi All!
I have the following problem:
Let a group of variables (in my case 26) and assume that only the PC whose eigenvalues are greater than one should be kept.
Since I don't know how to do it in one or two lines (as I'm new in Eviews programming), I though the following (inefficient way):

g1.pcomp(cor,eigval=k1,eigvec=v1)
scalar sc1=@rows(V1)
'Find eigenvalues greater than unity
scalar t=0
for !j=1 to sc1
if k1(!j) > 1 then
t=t+1
endif
next

In the case examined, t=6, therefore only the first six PC should be kept.

Now I want to run the following regression
equation eq01.ls y c pc1 pc2 pc3 pc4 pc5 pc6 (since only the first six PC have eig>1)

I'd like to ask how to store the PC (which meet the criteria mentioned) and how state correctly the following regression
equation eq01.ls gdp c pc1 ... pc{!t}

Thanks all of you in advance!

Veni

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests