BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
genemroz
Quartz | Level 8

Esteemed advisers:

 

I’ve been experimenting with Proc Expand.  Specifically, with the transformation MOVTVALUE.  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”.  So I was expecting that for a normal distribution, MOVTVALUE would cluster around a value of 0 regardless of the mean of the distribution.  

 

But that’s not what I found. See code below where I created two normal distributions with a mean of 0 and 1.  I then used Proc Expand to compute MOVTVALUE and then plotted the result and computed the mean of the t-values.  

 

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.  But the plot for t-values for normal distribution of a mean of 1 looks very different. 

 

What am I misunderstanding?  Thanks in advance for any insights you can provide.

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;
1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

What you see looks correct to me:

  • PROBLEM: What exactly is the transformation operation MOVTVALUE calculating (on the EXPAND procedure)?
  • RESOLUTION:
    t-statistic (t-value) based on moving windows.  t-statistic corresponds to the test statistic of testing if mean being 0 or not. (see TTEST procedure).

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).

 

Koen

View solution in original post

2 REPLIES 2
sbxkoenk
SAS Super FREQ

What you see looks correct to me:

  • PROBLEM: What exactly is the transformation operation MOVTVALUE calculating (on the EXPAND procedure)?
  • RESOLUTION:
    t-statistic (t-value) based on moving windows.  t-statistic corresponds to the test statistic of testing if mean being 0 or not. (see TTEST procedure).

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).

 

Koen

genemroz
Quartz | Level 8

Thanks for the prompt and clear response.  I see where I went off the rails.

 

Gene

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 925 views
  • 1 like
  • 2 in conversation