<?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: R-Square on test and training dataset in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331999#M17538</link>
    <description>&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Split a dataset into training and test subsets */
data splitClass;
set sashelp.class;
if mod(_n_, 3) &amp;gt; 0 then role = "training";
else role = "test";
run;

proc glmselect data=splitclass;
class sex;
model weight = sex height / selection=none;
partition rolevar=role(test="test" train="training");
output out=outClass residual=resWeight;
run;


proc sql noprint;
select 1 - uss(resWeight)/css(weight) as rsquare format=7.4
into :r2_training trimmed
from outClass where role="training";
select 1 - uss(resWeight)/css(weight) as rsquare format=7.4
into :r2_test trimmed
from outClass where role="test";
quit;

%put &amp;amp;=r2_training &amp;amp;=r2_test;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 12 Feb 2017 20:49:34 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2017-02-12T20:49:34Z</dc:date>
    <item>
      <title>R-Square on test and training dataset</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331794#M17525</link>
      <description>&lt;P&gt;Using this code snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC GLMSELECT DATA = WORK.Training TESTDATA = WORK.Test;
MODEL
.... / selection=none stb showpvalues;
ods output
"Fit Statistics" = WORK.Model_Fit
"Parameter Estimates" = WORK.ParameterEstimates
Nobs = WORK.Nobs;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dataset&amp;nbsp;WORK.Model_Fit contains:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Root MSE&lt;BR /&gt;Dependent Mean&lt;BR /&gt;R-Square&lt;BR /&gt;Adj R-Sq&lt;BR /&gt;AIC&lt;BR /&gt;AICC&lt;BR /&gt;SBC&lt;BR /&gt;ASE (Train)&lt;BR /&gt;ASE (Test)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the&amp;nbsp;&lt;SPAN&gt;R-Square measured on the training dataset? Is it possible to obatin the&amp;nbsp;R-Square fro the training and test dataset?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2017 10:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331794#M17525</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-02-11T10:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: R-Square on test and training dataset</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331928#M17530</link>
      <description>&lt;P&gt;One option is to calculate R square yourself from the residuals as 1 - USS(resid)/CSS(dependent) for each data subset.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Feb 2017 05:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331928#M17530</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-12T05:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: R-Square on test and training dataset</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331947#M17533</link>
      <description>&lt;PRE&gt;
You can use SCORE or CODE statement to score new dataset and calculated R-square.
OR
proc glmselect;
model.........
run;

proc reg.......
model y=&amp;amp;_GLSIND ;
........

to get that R-square.

&lt;/PRE&gt;</description>
      <pubDate>Sun, 12 Feb 2017 12:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331947#M17533</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-12T12:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: R-Square on test and training dataset</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331955#M17534</link>
      <description>Thanks, sorry this does not make much sense. I am able to use proc plm. I could use this to potentially calculate the r-square against the test dataset myself. The final aim is to put it into a macro variable.</description>
      <pubDate>Sun, 12 Feb 2017 13:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331955#M17534</guid>
      <dc:creator>csetzkorn</dc:creator>
      <dc:date>2017-02-12T13:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: R-Square on test and training dataset</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331999#M17538</link>
      <description>&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Split a dataset into training and test subsets */
data splitClass;
set sashelp.class;
if mod(_n_, 3) &amp;gt; 0 then role = "training";
else role = "test";
run;

proc glmselect data=splitclass;
class sex;
model weight = sex height / selection=none;
partition rolevar=role(test="test" train="training");
output out=outClass residual=resWeight;
run;


proc sql noprint;
select 1 - uss(resWeight)/css(weight) as rsquare format=7.4
into :r2_training trimmed
from outClass where role="training";
select 1 - uss(resWeight)/css(weight) as rsquare format=7.4
into :r2_test trimmed
from outClass where role="test";
quit;

%put &amp;amp;=r2_training &amp;amp;=r2_test;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 12 Feb 2017 20:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/R-Square-on-test-and-training-dataset/m-p/331999#M17538</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-12T20:49:34Z</dc:date>
    </item>
  </channel>
</rss>

