Hi all,
Figure 1 is for a study period Jan 2018 - Dec 2019.
(note: figure removed by request of author)
Figure 2 is for study period Jan 2017 - Mar 2020.
(note: figure removed by request of author)
The values from Jan 2018 to Dec 2019 are the same for both figures, figure 2 is just an expanded version and includes more months.
My question is - why does the band for predicted series values changes when we expand the period? Shouldnt the bands be the same given that same datapoints where used? THANK YOU!
CODE FOR BOTH FIGS:
/***************** Autoreg **********************/
ods output ParameterEstimates=parms;
PROC AUTOREG DATA = import_x;
MODEL rate = slope2 step ramp
/PLOTS=ALL METHOD=ML NLAG=12 DWPROB BACKSTEP;
OUTPUT OUT=outputdata PM=trendhat LCLM=lclm UCLM=uclm P=yhat LCL=lcl UCL=ucl;
/*PM= predicted values from only the structural part of the model;
useful in predicting the trend */;
/*P= predicted values from both the structural and autoregressive parts of the model;
useful in predicting future values of the current response time series */;
RUN;
PROC SGPLOT DATA=outputdata;
title 'Cephalosporins (non-targeted population)';
SCATTER X=month Y=rate / MARKERATTRS = (COLOR=BLACK)
LEGENDLABEL = "Observed values";
/* SERIES X=month Y=yhat / LINEATTRS =(COLOR=DABGR PATTERN=SHORTDASH) */
/* */
/* LEGENDLABEL = "Predicted series values"; */
/* */
BAND X=month UPPER=ucl LOWER=lcl / FILLATTRS=(COLOR=LTGREY TRANSPARENCY=.7)
/* */
LEGENDLABEL = "Band for predicted series values";
SERIES X=month Y=trendhat / LINEATTRS =(COLOR= BLACK PATTERN=SOLID)
LEGENDLABEL = "Predicted mean (trend)";
/* BAND X=month UPPER=uclm LOWER=lclm / */
/* */
/* FILLATTRS= (COLOR= MEGR TRANSPARENCY=.5) */
/* */
/* LEGENDLABEL = "Band for predicted trend"; */
LABEL Rate = "Prescription rate per 1,000 beneficiaries"
month ="Month";
REFLINE '1dec2018'd / AXIS = X LINEATTRS =(PATTERN=SHORTDASH COLOR=BLACK);
REFLINE '1dec2018'd / AXIS = X LINEATTRS =(PATTERN=SHORTDASH COLOR=BLACK);
refline '1dec2018'd / axis= X
lineattrs=(thickness=10 color=grey) transparency=0.6 ;
RUN;
ODS GRAPHICS OFF;