Hi,
I am doing an interrupted time-series analysis and use the autoreg procedure. I have difficulties to understand what excatly the nlag= option does in this procedure as it changes my results minimally, but the follow-up graph practically not at all.
Would be great if someone could shortly explain the function of the nlag= option simple.
Thank you very much!
Here is my SAS coding:
proc autoreg data=mydata;
model measurements = preintervention intervention postintervention sin cos/ method=ml nlag=1 /*dw=5*/ dwprob
covb;
output out=autoreg_out predicted=pred pm=trend lcl=pred_l ucl=pred_u residual=resid
predictedm=predm lclm=predm_l uclm=predm_u residualm=residm;
run;
Hello,
Is the documentation not clear enough?
This is what the doc says :
The AUTOREG Procedure
SAS/ETS® 15.2 User's Guide
https://go.documentation.sas.com/doc/en/etsug/15.2/etsug_autoreg_syntax05.htm
NLAG=number
NLAG=(number-list)
specifies the order of the autoregressive error process or the subset of autoregressive error lags to be fitted. Note that NLAG=3 is the same as NLAG=(1 2 3). If the NLAG= option is not specified, PROC AUTOREG does not fit an autoregressive model.
Thus, for nlag=3, you believe (and test) that the lags 1, 2 and 3 of the target variable (=dependent variable) are playing a role in modelling it.
Thanks,
Koen
Hello,
Is the documentation not clear enough?
This is what the doc says :
The AUTOREG Procedure
SAS/ETS® 15.2 User's Guide
https://go.documentation.sas.com/doc/en/etsug/15.2/etsug_autoreg_syntax05.htm
NLAG=number
NLAG=(number-list)
specifies the order of the autoregressive error process or the subset of autoregressive error lags to be fitted. Note that NLAG=3 is the same as NLAG=(1 2 3). If the NLAG= option is not specified, PROC AUTOREG does not fit an autoregressive model.
Thus, for nlag=3, you believe (and test) that the lags 1, 2 and 3 of the target variable (=dependent variable) are playing a role in modelling it.
Thanks,
Koen
Specifying option nlag=1 is loosely like requesting :
model measurements = measurements_1 preintervention intervention postintervention sin cos/ method=ml dwprob covb;
where measurements_1 is the measurement value from the preceeding observation. I.e. you model the measurements as depending not only on independent variables but also on the previous state of the system.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.