<?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 How to do k-fold CV with replacements/replication in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/303938#M3050</link>
    <description>&lt;P&gt;Hi, how to do, say 10-fold cross validation with resampling with proc logistic (which apparently is as good as bootstrap with replacements, "..We also carried out cross-validation with replication. Here the cross-validation was replicated r times, with a different random split into k groups each time..." - this is the article,&amp;nbsp;&lt;A href="http://m.aje.oxfordjournals.org/content/early/2014/06/24/aje.kwu140.full.pdf&amp;nbsp;" target="_blank"&gt;http://m.aje.oxfordjournals.org/content/early/2014/06/24/aje.kwu140.full.pdf&amp;nbsp;&lt;/A&gt;). Help most appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;p/s sorry if i hv the terminologies jumbled up; and no access to hp-procs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Saiful.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Oct 2016 04:51:20 GMT</pubDate>
    <dc:creator>Dcicantab5</dc:creator>
    <dc:date>2016-10-12T04:51:20Z</dc:date>
    <item>
      <title>How to do k-fold CV with replacements/replication</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/303938#M3050</link>
      <description>&lt;P&gt;Hi, how to do, say 10-fold cross validation with resampling with proc logistic (which apparently is as good as bootstrap with replacements, "..We also carried out cross-validation with replication. Here the cross-validation was replicated r times, with a different random split into k groups each time..." - this is the article,&amp;nbsp;&lt;A href="http://m.aje.oxfordjournals.org/content/early/2014/06/24/aje.kwu140.full.pdf&amp;nbsp;" target="_blank"&gt;http://m.aje.oxfordjournals.org/content/early/2014/06/24/aje.kwu140.full.pdf&amp;nbsp;&lt;/A&gt;). Help most appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;p/s sorry if i hv the terminologies jumbled up; and no access to hp-procs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Saiful.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 04:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/303938#M3050</guid>
      <dc:creator>Dcicantab5</dc:creator>
      <dc:date>2016-10-12T04:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to do k-fold CV with replacements/replication</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/303939#M3051</link>
      <description>&lt;P&gt;How big is your data?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The methods in this paper are what you're looking for. Essentially, use PROC SURVEYSELECT to generate random samples, run PROC LOGISTIC on the samples using a BY group and then summarize results using PROC SURVEYMEANS OR MEANS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/forum2007/183-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/183-2007.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Realized this is IML so feel free to disregard this message if it's irrelevant, but this would be a perfectly valid way to approach your problem. PS I would find a worked example and work through it to verify that you understand your calculations thoroughly. I once spent 3 days debugging a bootstrap because I didn't realize the denominator was n-1 vs n....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 05:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/303939#M3051</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-12T05:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to do k-fold CV with replacements/replication</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/303960#M3052</link>
      <description>You? 3 days? No...&lt;BR /&gt;Ok, anyway, not how big but rather, how small, N=199 with events=20; will look into the referred paper, thanks</description>
      <pubDate>Wed, 12 Oct 2016 07:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/303960#M3052</guid>
      <dc:creator>Dcicantab5</dc:creator>
      <dc:date>2016-10-12T07:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to do k-fold CV with replacements/replication</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/304063#M3053</link>
      <description>&lt;P&gt;It looks like very easy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro k_fold_cv(k=10);
ods select none;

proc surveyselect data=sashelp.heart group=&amp;amp;k out=have;
run;

%do i=1 %to &amp;amp;k ;
data training;
 set have(where=(groupid ne &amp;amp;i)) ;
run;
data test;
 set have(where=(groupid eq &amp;amp;i));
run;

ods output 
Association=native(keep=label2 nvalue2 rename=(nvalue2=native) where=(label2='c'))
ScoreFitStat=true(keep=dataset freq auc rename=(auc=true));
proc logistic data=training
 outest=est(keep=_status_ _name_) ;
 class sex;
 model status(event='Alive')=sex height weight;
 score data=test fitstat; 
run;

data score&amp;amp;i;
 merge true native est;
 retain id &amp;amp;i ;
 optimism=native-true;
run;
%end;
data k_fold_cv;
 set score1-score&amp;amp;k;
run;

ods select all;
%mend;

%k_fold_cv(k=10)








/*************************************/


%macro k_fold_cv_rep(r=1,k=10);
ods select none;
%do r=1 %to &amp;amp;r;
proc surveyselect data=sashelp.heart group=&amp;amp;k out=have;
run;

%do i=1 %to &amp;amp;k ;
data training;
 set have(where=(groupid ne &amp;amp;i)) ;
run;
data test;
 set have(where=(groupid eq &amp;amp;i));
run;

ods output 
Association=native(keep=label2 nvalue2 rename=(nvalue2=native) where=(label2='c'))
ScoreFitStat=true(keep=dataset freq auc rename=(auc=true));
proc logistic data=training
 outest=est(keep=_status_ _name_) ;
 class sex;
 model status(event='Alive')=sex height weight;
 score data=test fitstat; 
run;

data score_r&amp;amp;r._&amp;amp;i;
 merge true native est;
 retain rep &amp;amp;r id &amp;amp;i;
 optimism=native-true;
run;
%end;
%end;
data k_fold_cv_rep;
 set score_r:;
run;

ods select all;
%mend;

%k_fold_cv_rep(r=20,k=10);


/********************/
data all;
 set k_fold_cv k_fold_cv_rep indsname=indsn;
 length indsname $ 32;
 indsname=indsn;
run;
proc summary data=all nway;
 class indsname;
 var optimism;
 output out=want mean=mean lclm=lclm uclm=uclm;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 13:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-do-k-fold-CV-with-replacements-replication/m-p/304063#M3053</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-12T13:34:47Z</dc:date>
    </item>
  </channel>
</rss>

