Extracting Principal Components via code

For questions regarding programming in the EViews programming language.

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

saranya
Posts: 41
Joined: Wed Nov 16, 2016 5:51 am

Extracting Principal Components via code

Postby saranya » Fri Mar 10, 2017 12:58 am

Hi,

I use the below code to get the principal components which satisfy the condition of min eigen to not fall below 1:
freeze(tab) all.pcomp(cov=cov, mineigen=1, eigval=eval, eigvec=evec)

Now, I want the code to determine how many principal components are extracted with this criterion. Is there a way to do it via code, rather than analysing the table per se?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13317
Joined: Tue Sep 16, 2008 5:38 pm

Re: Extracting Principal Components via code

Postby EViews Gareth » Fri Mar 10, 2017 8:27 am

Can't you just test the length of the eval vector?
!num = @rows(eval)
Follow us on Twitter @IHSEViews

saranya
Posts: 41
Joined: Wed Nov 16, 2016 5:51 am

Re: Extracting Principal Components via code

Postby saranya » Wed Mar 15, 2017 11:25 pm

The length of the eval vector is always equal to the total number of variables/ Principal components. It is not dependent on the cumulative proportion that one mentions in the code. :(

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

Re: Extracting Principal Components via code

Postby EViews Glenn » Fri Mar 17, 2017 9:50 am

Code: Select all

!numge1 = @ege(eval, @ones(eval.@rows))

saranya
Posts: 41
Joined: Wed Nov 16, 2016 5:51 am

Re: Extracting Principal Components via code

Postby saranya » Mon Mar 20, 2017 4:53 am

Thanks Glenn! Works perfect :)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 33 guests