<?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: plot the correlation between 2 functions in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407096#M21196</link>
    <description>&lt;P&gt;First thank you for all your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the correlation I meant the cov(X,Y) by std_X and std_y.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to plot the correlation of the function A(m) and B(m) for m in [0.000001,30], tau1 fixed equal to 2 and tau2 in [0.0001,30].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the x axis will be tau2 and the y axis will be corr(A,B)&lt;/P&gt;</description>
    <pubDate>Tue, 24 Oct 2017 22:24:55 GMT</pubDate>
    <dc:creator>madix</dc:creator>
    <dc:date>2017-10-24T22:24:55Z</dc:date>
    <item>
      <title>plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406872#M21183</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fonction 1.PNG" style="width: 138px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16174i1B65F572757C62A1/image-size/large?v=v2&amp;amp;px=999" role="button" title="fonction 1.PNG" alt="fonction 1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fonction2.PNG" style="width: 118px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16177i63341162544EEB92/image-size/large?v=v2&amp;amp;px=999" role="button" title="fonction2.PNG" alt="fonction2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is the following one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 function A and B. The parameters m is in [0.001,30]. We have&amp;nbsp;tau_1=1 and tau_2=1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder if there is a way&amp;nbsp;plot the corrélation between my function A and B on SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 09:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406872#M21183</guid>
      <dc:creator>madix</dc:creator>
      <dc:date>2017-10-24T09:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406876#M21184</link>
      <description>&lt;P&gt;This might help:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/procstat/66703/HTML/default/viewer.htm#procstat_corr_syntax01.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/procstat/66703/HTML/default/viewer.htm#procstat_corr_syntax01.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will move the post to stats section of forum also.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 09:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406876#M21184</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-24T09:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406899#M21187</link>
      <description>&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a technical question about&amp;nbsp;the correlation matrix:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="corr.PNG" style="width: 492px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16178i03DAB1CAD357C175/image-size/large?v=v2&amp;amp;px=999" role="button" title="corr.PNG" alt="corr.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you know how to keep only the value of the corr between C_0 and P_0, C_1 and P_1, C_2 and P_2... in a table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 10:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406899#M21187</guid>
      <dc:creator>madix</dc:creator>
      <dc:date>2017-10-24T10:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406900#M21188</link>
      <description>&lt;P&gt;Am afraid I can't help you, hopefully in this forum area a Stato will be able to help.&amp;nbsp; I am merely a programmer&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 11:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406900#M21188</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-24T11:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406938#M21190</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/170715"&gt;@madix&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for your reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a technical question about&amp;nbsp;the correlation matrix:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="corr.PNG" style="width: 492px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16178i03DAB1CAD357C175/image-size/large?v=v2&amp;amp;px=999" role="button" title="corr.PNG" alt="corr.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Do you know how to keep only the value of the corr between C_0 and P_0, C_1 and P_1, C_2 and P_2... in a table?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It wouldn't hurt to show the code you used to generate that.&lt;/P&gt;
&lt;P&gt;Assuming you used Proc Corr and want Pearson correlation statistics then the option OUTP=datassetname will place the statistics into a dataset named&amp;nbsp; on the option.&lt;/P&gt;
&lt;P&gt;I am not sure exactly what you mean by "between C_0 and P_0, C_1 and P_1, C_2 and P_2" but you should be able to transform the resulting dataset to have the contents and structure you want.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 13:47:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/406938#M21190</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-24T13:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407033#M21192</link>
      <description>&lt;P&gt;Why not show the &lt;STRONG&gt;relation&lt;/STRONG&gt; between the two functions as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=sasuser.fcmp.math;
function A(m);
return ((1-exp(-m))/m - exp(-m));
endsub;
function B(m);
return (m**2 * exp(-m));
endsub;
run;

options cmplib=sasuser.fcmp;

data test;
do lm = log(.001) to log(30) by log(30/0.001)/100;
    m = exp(lm);
    A = A(m);
    B = B(m);
    output;
    end;
run;

proc sgplot data=test;
series x=a y=b / markers 
    markerattrs=(symbol=circlefilled size=5)
    lineattrs=(thickness=2);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16188i40EEE9BE8543BE62/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SGPlot2.png" alt="SGPlot2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 18:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407033#M21192</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-10-24T18:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407067#M21194</link>
      <description>&lt;P&gt;Could you clarify your statement? There are many kinds of correlations. Are you looking for &lt;A href="https://en.wikipedia.org/wiki/Cross-correlation" target="_self"&gt;cross-correlation of time series?&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 20:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407067#M21194</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-10-24T20:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407090#M21195</link>
      <description>&lt;P&gt;Interesting Relationship...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="myfile.gif" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16199iA94CE8AC6C3C97FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="myfile.gif" alt="myfile.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 21:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407090#M21195</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-10-24T21:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407096#M21196</link>
      <description>&lt;P&gt;First thank you for all your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the correlation I meant the cov(X,Y) by std_X and std_y.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to plot the correlation of the function A(m) and B(m) for m in [0.000001,30], tau1 fixed equal to 2 and tau2 in [0.0001,30].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the x axis will be tau2 and the y axis will be corr(A,B)&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 22:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407096#M21196</guid>
      <dc:creator>madix</dc:creator>
      <dc:date>2017-10-24T22:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407222#M21199</link>
      <description>&lt;P&gt;So there are no random variables in your problem? The variable M is not random with a distribution?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have SAS/IML software or do you require the solution to use Base SAS?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 12:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407222#M21199</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-10-25T12:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: plot the correlation between 2 functions</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407233#M21200</link>
      <description>&lt;P&gt;The distribution of&amp;nbsp;M determines the correlation between A(m) and B(m). If you choose M ~ lognormal you will get a different&amp;nbsp;answer from if you choose M ~ gamma or M ~ exponential.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you didn't specify the distribution of M, the following DATA step chooses equally spaced values in [1,30] along with some small values. This should give the general idea of how to do the computation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* evaluate A(m) and B(m) for range of m 
   THE LOCATIONS OF m THAT YOU CHOOSE AFFECT THE CORRELATION */
data AB;
tau2 = 2;
do tau1 = 0.0001, 0.001, 0.01, 0.1, 1 to 30;
   /* probably want a DISTRIBUTION for m */
   do m = 0.0001, 0.001, 0.01, 0.1, 1 to 30; 
      c1 = -m/tau1;
      c2 = -m/tau2;
      A = (1 - exp(c1)) / c1 - exp(c1);
      B = c2**2 * exp(c2);
      output;
   end;
end;
drop c1 c2;
run;

/* compute correlation matrices for each tau1 value */
proc corr data=AB noprint
     outp=OutCorr(where=(_TYPE_="CORR") rename=(B=Corr));
by tau1;
var A B;
run;

/* we only want the correlation coefficient; extract the R[1,2] cell */
data Corr;      
   set OutCorr;
   if mod(_N_,2)=1;   /* Keep odd-numbered rows; delete even rows */
   drop _TYPE_ _NAME_ A;
run;

title "Corr(A,B), tau2=2";
proc sgplot data=Corr;
   series x=tau1 y=Corr;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you choose a distribution for M, then the inner loop will be&lt;/P&gt;
&lt;P&gt;do i = 1 to 10000;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;m = rand("disrib_name", params);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;c1= ..; c2=..; etc;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16208iA593B23D16CAEA77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SGPlot2.png" alt="SGPlot2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 12:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/plot-the-correlation-between-2-functions/m-p/407233#M21200</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-10-25T12:58:46Z</dc:date>
    </item>
  </channel>
</rss>

