Page 1 of 1

Extract k principal coomponents

Posted: Mon Sep 07, 2015 7:04 am
by fboehlandt
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

Re: Extract k principal coomponents

Posted: Wed Sep 09, 2015 8:50 am
by EViews Glenn
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.

Re: Extract k principal coomponents

Posted: Wed Sep 16, 2015 2:44 am
by fboehlandt
Thanks, I did get it to work with your advise