<?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 Proc Expand Puzzle in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand-Puzzle/m-p/953697#M83813</link>
    <description>&lt;P&gt;Esteemed advisers:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’ve been experimenting with Proc Expand.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Specifically, with the transformation MOVTVALUE.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;The documentation says: “They can be viewed as combinations of the moving average (CUAVE, MOVAVE, CMOVAVE) and the moving standard deviation (CUSTD, MOVSTD, CMOVSTD), respectively”.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;So I was expecting that for a normal distribution, MOVTVALUE would cluster around a value of 0 regardless of the mean of the distribution. &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that’s not what I found. See code below where I created two normal distributions with a mean of 0 and 1.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;I then used Proc Expand to compute MOVTVALUE and then plotted the result and computed the mean of the t-values. &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The plot of t-values for a normal distrubution with a mean of 0 looks as I would expect with values clusters around of mean of (near) zero.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;But the plot for t-values for normal distribution of a mean of 1 looks very different.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I misunderstanding?&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Thanks in advance for any insights you can provide.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
call streaminit(123);
do i=1 to 100;
test0=rand('normal',0);
test1=rand('normal',1);
output;
end;
run;

proc expand data=have out=out method=none;
id i;
convert test0=tvalue0/transout=(movtvalue 5);
convert test1=tvalue1/transout=(movtvalue 5);
run;

proc sgplot data=out;
   series x=i y=tvalue0  /
   name='tvalue0'   legendlabel="tvalue0" markers markerattrs=(symbol=circlefilled);
      series x=i y=tvalue1  /
   name='tvalue1'   legendlabel="tvalue1" markers markerattrs=(symbol=circlefilled);
   xaxis grid;
   yaxis grid label='t-value';
run;

proc means data=out mean;
var tvalue0 tvalue1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Dec 2024 17:28:03 GMT</pubDate>
    <dc:creator>genemroz</dc:creator>
    <dc:date>2024-12-16T17:28:03Z</dc:date>
    <item>
      <title>Proc Expand Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand-Puzzle/m-p/953697#M83813</link>
      <description>&lt;P&gt;Esteemed advisers:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’ve been experimenting with Proc Expand.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Specifically, with the transformation MOVTVALUE.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;The documentation says: “They can be viewed as combinations of the moving average (CUAVE, MOVAVE, CMOVAVE) and the moving standard deviation (CUSTD, MOVSTD, CMOVSTD), respectively”.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;So I was expecting that for a normal distribution, MOVTVALUE would cluster around a value of 0 regardless of the mean of the distribution. &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that’s not what I found. See code below where I created two normal distributions with a mean of 0 and 1.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;I then used Proc Expand to compute MOVTVALUE and then plotted the result and computed the mean of the t-values. &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The plot of t-values for a normal distrubution with a mean of 0 looks as I would expect with values clusters around of mean of (near) zero.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;But the plot for t-values for normal distribution of a mean of 1 looks very different.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I misunderstanding?&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Thanks in advance for any insights you can provide.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
call streaminit(123);
do i=1 to 100;
test0=rand('normal',0);
test1=rand('normal',1);
output;
end;
run;

proc expand data=have out=out method=none;
id i;
convert test0=tvalue0/transout=(movtvalue 5);
convert test1=tvalue1/transout=(movtvalue 5);
run;

proc sgplot data=out;
   series x=i y=tvalue0  /
   name='tvalue0'   legendlabel="tvalue0" markers markerattrs=(symbol=circlefilled);
      series x=i y=tvalue1  /
   name='tvalue1'   legendlabel="tvalue1" markers markerattrs=(symbol=circlefilled);
   xaxis grid;
   yaxis grid label='t-value';
run;

proc means data=out mean;
var tvalue0 tvalue1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Dec 2024 17:28:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand-Puzzle/m-p/953697#M83813</guid>
      <dc:creator>genemroz</dc:creator>
      <dc:date>2024-12-16T17:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Expand Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand-Puzzle/m-p/953700#M83814</link>
      <description>&lt;P&gt;What you see looks correct to me:&lt;/P&gt;
&lt;UL class="lia-list-style-type-square"&gt;
&lt;LI&gt;&lt;SPAN&gt;PROBLEM:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;What exactly is the transformation operation MOVTVALUE calculating (on the EXPAND procedure)?&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;RESOLUTION:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;t-statistic (t-value) based on moving windows.&amp;nbsp;&amp;nbsp;t-statistic corresponds to the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;test statistic of testing if mean being 0 or not. (see TTEST procedure).&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;For a mean that is not zero you see higher t-values of course. t-values will often become significant then (rejecting null-hypothesis of mean=0).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 17:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand-Puzzle/m-p/953700#M83814</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-12-16T17:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Expand Puzzle</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand-Puzzle/m-p/953710#M83815</link>
      <description>&lt;P&gt;Thanks for the prompt and clear response. &amp;nbsp;I see where I went off the rails.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Gene&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 18:22:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Expand-Puzzle/m-p/953710#M83815</guid>
      <dc:creator>genemroz</dc:creator>
      <dc:date>2024-12-16T18:22:49Z</dc:date>
    </item>
  </channel>
</rss>

