BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
WarrenKuhfeld
Rhodochrosite | Level 12

Princomp and prinqual give the same proportions every time I have ever tested them.


proc princcomp data=sashelp.heart;
   ods select eigenvalues;
   run;

ods graphics on;
ods html body='b.html';
proc prinqual data=sashelp.heart out=res scores mdpref;
   ods output mdprefplot=m;
      var ide(_numeric_);
   run;
ods html close;

proc contents varnum data=m; ods select position; run;

While I have not added it to the procedure at this juncture, I have grown fond of minimizing the data ink associated with the vectors.  See this blog.  It might not help much with hundreds of vectors.

https://blogs.sas.com/content/graphicallyspeaking/2017/06/22/advanced-ods-graphics-vector-plots-adju...

variety
Obsidian | Level 7
Yeah, I got it why I am seeing two different results for princomp and prinqual.

For prinqual I am seeing this in log: The almost constant variable will be zeroed and excluded from analysis.

But for princomp, I don't see the above warning.

That might be it.
variety
Obsidian | Level 7
Hi @WarrenKuhfeld, Thanks so much for your reply and the blog post. For now, I am able to create the graph I am looking for using prinqual.

However, I still would like to learn how to overlay score plot on loading plot in princomp. As for my data prinqual is eliminating near zero variables and princomp is keeping the near zero variables, they are both showing two different results for my analysis. Also, for example: In PLS analysis, if I want to overlay, XSCORES on XLOADINGPLOT. Or XSCORES on XWEIGHTPLOT. It helps me with more tools to be able to modify my data. If there is any literature regarding this, please suggest me.

Thanks again for your help.
WarrenKuhfeld
Rhodochrosite | Level 12

Since prinqual typically iterates, it tries to get rid of potentially problematic variables.  You can specify a really small singularity criterion as in this example.

data x;
   do i = 1 to 10;
      x1 = normal(7);
      x2 = normal(7);
      x3 = normal(7);
      x4 = normal(7);
      x5 = normal(7) * 1e-10;
      output;
      end;
   run;

proc prinqual data=x std;
   var ide(x:);
run;

proc prinqual data=x std singular=1e-50;
   var ide(x:);
run;


You can always output anything produced by any procedure and rearrange it in any way to make a graph.  Do an ODS OUTPUT on the data object that underlies prinqual's graph.  Then use princomp pieces to make something like that.  Again be aware that prinqual scales things in a nice way.  The documentation has details.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 19 replies
  • 2551 views
  • 4 likes
  • 3 in conversation