Extract k principal coomponents

For questions regarding programming in the EViews programming language.

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

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Extract k principal coomponents

Postby fboehlandt » Mon Sep 07, 2015 7:04 am

Hi everyone

I would like to create all principal components representing 0.95 of the cumulative proportion of variance explained (PCA).

This is what I have so far where CFP01 is the group name of a number of underlying series.

Code: Select all

%m= "cfp01" freeze(table01) {%m}.pcomp(cproport = 0.95, out=table) !n = @val(@wright(@wleft(table01(6,1),2),1)) For !i = 1 to !n %str1 = %str1 + "F" + @str(!i) + " " next {%m}.makepcomp(scale=normscore, cpnorm) %str1
The input for the vector names is not a string. The code does not recognise the empty space as a delimiter. Please advise

Thanks

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

Re: Extract k principal coomponents

Postby EViews Glenn » Wed Sep 09, 2015 8:50 am

At a quick glance, it looks like there are two issues. First, you have a space before the period in the last line. Second, you need to enclose the %str1 in braces, as in {%str1} so that it's interpreted as a variable name and not as a string.

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Re: Extract k principal coomponents

Postby fboehlandt » Wed Sep 16, 2015 2:44 am

Thanks, I did get it to work with your advise


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests