<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Proc PLS by variable and CV in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-PLS-by-variable-and-CV/m-p/697108#M33625</link>
    <description>&lt;P&gt;If you want NFAC=3 for one year and NFAC=5 for another year, then you can't fit the models with a BY statement. You need to run PROC PLS twice, once for one year and again for the other year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Nov 2020 11:11:50 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-11-06T11:11:50Z</dc:date>
    <item>
      <title>Proc PLS by variable and CV</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-PLS-by-variable-and-CV/m-p/697034#M33624</link>
      <description>&lt;P&gt;Hi, I'm running a PLS model with a "by" variable which has 2 levels (2014 vs. 2017). I've run CV to select the correct number of latent factors, but&amp;nbsp; for each of my "by" variables I need to use a different number of latent factors (3 vs. 5).&amp;nbsp; How do I tell it that if by=2014 use 3 factors and if by=2017 then use 5?&amp;nbsp; Here's the code for the cross-validation and the model with the factors. Thanks.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Running Model By Year to separate out 2014 from 2017 */
/* Global Model with all bands at R1 */
proc pls data=splitplsr2 cv=random(seed=12345) cvtest varss plots=(diagnostics dmod scores ParmProfiles VIP XLoadingProfiles);
	by yr;
	model meas =
R1Avg_412_d.......etc.
R1Avg_917_d / solution;
	output OUT=test1; 
	ods output VariableImportancePlot=vip;
	title 'Global PLS Full Model';
run;

/*  Model with Factors chosen */
proc pls data=splitplsr2 nfac=3 varss plots=(diagnostics dmod scores ParmProfiles VIP XLoadingProfiles);
	by year;&lt;BR /&gt;    model meas = 
R1Avg_412_d....etc.
R1Avg_917_d / solution;
	output OUT=outfile predicted=predR1f press=pressR1f yresidual=yresidR1f ; 
	ods output VariableImportancePlot=vip;
	title 'Global PLS Full Final Model';
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Nov 2020 00:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-PLS-by-variable-and-CV/m-p/697034#M33624</guid>
      <dc:creator>Daisy2</dc:creator>
      <dc:date>2020-11-06T00:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Proc PLS by variable and CV</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-PLS-by-variable-and-CV/m-p/697108#M33625</link>
      <description>&lt;P&gt;If you want NFAC=3 for one year and NFAC=5 for another year, then you can't fit the models with a BY statement. You need to run PROC PLS twice, once for one year and again for the other year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 11:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-PLS-by-variable-and-CV/m-p/697108#M33625</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-06T11:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc PLS by variable and CV</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-PLS-by-variable-and-CV/m-p/703525#M34013</link>
      <description>&lt;P&gt;Through some persistence I figured out to use a "Where" line within the Proc allows splitting.&amp;nbsp; Here's the details of the code.&amp;nbsp; And below this I have another Proc PLS for&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; where yr='2017';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;/* Running Model By Year to separate out 2014 from 2017 */
/* Global Model with all bands at R1 */
proc pls data=splitplsr2 cv=random(seed=12345) cvtest varss plots=(diagnostics dmod scores ParmProfiles VIP XLoadingProfiles);
	by yr;
	model meas =
R1Avg_412_d.......etc.
R1Avg_917_d / solution;
	output OUT=test1; 
	ods output VariableImportancePlot=vip;
	title 'Global PLS Full Model';
run;

/*  Model with Factors chosen */
proc pls data=splitplsr2 nfac=3 varss plots=(diagnostics dmod scores ParmProfiles VIP XLoadingProfiles);
	by year;    
        where yr='2014';
        model meas = 
R1Avg_412_d....etc.
R1Avg_917_d / solution;
	output OUT=outfile predicted=predR1f press=pressR1f yresidual=yresidR1f ; 
	ods output VariableImportancePlot=vip;
	title 'Global PLS Full Final Model';
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 00:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-PLS-by-variable-and-CV/m-p/703525#M34013</guid>
      <dc:creator>Daisy2</dc:creator>
      <dc:date>2020-12-04T00:32:27Z</dc:date>
    </item>
  </channel>
</rss>

