Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Daisy2
Obsidian | Level 7

I'm new to running Proc PLS and I'm trying to understand if I still need to run cv after choosing the number of factors for my model.

Here's an example of my code and what I'm doing.  Is that correct?  Thanks for your input. (note: I've purposely removed many of my x-vars from the model I'm showing below to save space)

proc pls data=splitplsr2 cv=random(seed=12345) cvtest varss plots=(diagnostics dmod scores ParmProfiles VIP XLoadingProfiles);
	class plat;
	model pNmeas = plat
R1Avg_412_d/ solution;
	output OUT=test1; 
	ods output VariableImportancePlot=vip;
	title 'Global Model';
run;
/* run model above and choose factors by van der Voet's test*/
/*next code to run for solutions using the designated number of factors*/
proc pls data=splitplsr2 nfac=8 varss plots=(diagnostics dmod scores ParmProfiles VIP XLoadingProfiles);
	class plat;
	model pNmeas = plat
R1Avg_412_d/ solution;
	output OUT=outfile predicted=predpNR1f press=presspNR1f yresidual=yresidpNR1f ; 
	ods output VariableImportancePlot=vip;
	title 'Final Global Model';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

This is how I do it

  1. Run cross-validation
  2. Choose number of factors based upon cross-validation results
  3. Re-fit model to have the number of factors chosen above

So if I understand you properly, you are doing the same thing. Also, you don't need the variable importance values and most of the other outputs when you are doing the cross-validation run. In that first run of PROC PLS, you just want the cross-validation outputs.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

This is how I do it

  1. Run cross-validation
  2. Choose number of factors based upon cross-validation results
  3. Re-fit model to have the number of factors chosen above

So if I understand you properly, you are doing the same thing. Also, you don't need the variable importance values and most of the other outputs when you are doing the cross-validation run. In that first run of PROC PLS, you just want the cross-validation outputs.

--
Paige Miller
Daisy2
Obsidian | Level 7
Awesome. Thanks!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 798 views
  • 1 like
  • 2 in conversation