Dear SAS Community,
I am working with an annual univariate time series consisting of 75 observations. I suspect that at observation 33, an intervention caused a downward shift in the mean of the series. My dataset contains a time variable labeled "Date" and a response variable "Yt".
In the code below, I define the target mean as the average of the first 32 observations, along with the corresponding estimate of the standard deviation. I then apply the CUSUM test to detect a potential mean shift.
Could you please review my approach and let me know if this is the correct way to detect a mean shift in the series using PROC CUSUM?
Thank you for your insights!
proc means data=a(obs=32);
var Yt;
output out=stats mean=mu0 std=sigma0;
run;
/* Store computed values as macro variables */
data _null_;
set stats;
call symputx("mu0", mu0);
call symputx("sigma0", sigma0);
run;
ods graphics on;
title 'Two-sided CUSUM Chart';
proc cusum data=a;
xchart Yt*Date /
mu0 = &mu0
sigma0 = &sigma0
delta = 2.6
alpha = 0.10;
label Yt = 'Cumulative Sum';
run;