BookmarkSubscribeRSS Feed
harmonic
Obsidian | Level 7

https://support.sas.com/resources/papers/proceedings15/3294-2015.pdf

 

Hi community,

based on the following paper, I wanted to apply these tests to my series. Is the procedure for calculating the ideal number of lags correct? How do I define the maximum number on which to complete the cycle?

data tstats;
set _null_;
run;
%macro np(indata, testvar);
%do i=1 %to &&nmax;
%if (&i<2) %then %do;
ods output ParameterEstimates=parms_&i.a;
proc reg
data = &indata;
model d1&testvar= lag1&testvar lag&i.d1&testvar;
run;quit;
%end;
%if (&i>1) %then %do;
ods output ParameterEstimates=parms_&i.a;
proc reg
data = &indata;
model d1&testvar = lag1&testvar lag1d1&testvar --
lag&i.d1&testvar;
run;quit;
%end;
data parms_&i (keep=tvalue lag);
set parms_&i.a (where=(variable="lag&i.d1&testvar"));
lag=&i;
run;
data tstats;
set tstats parms_&i;
if abs(tvalue)>1.6 then flag=1;
run;
%end;
proc sort data=tstats;
by descending lag;
run;
%mend;
%np(nhe_data,PCA);

Additionally, which metric should I use because the single mean and the trend give me two different pieces of information with the KPSS test. The single mean tells me that the series is stationary, while the trend does not reject the null hypothesis H0, so it is non-stationary.

 

/* KWIATKOWSKI-PHILLIPS-SCHMIDT  */
proc autoreg
	data = data;
	model y = /stationarity=(kpss=(kernel=qs auto));
run;

 

harmonic_0-1716557543105.png

1 REPLY 1
SASCom1
SAS Employee

Hello @harmonic 

It seems to me that the logic in the description of the testing procedure in your referenced paper is along the lines of the general-to-specific procedure of sequential tests for significance of coefficients on the lags discussed in Ng and Perron (1995):

Unit Root Tests in ARIMA Models with Data-Dependent Methods for the Selection of the Truncation Lag, Journal of the American Statistical Association , Mar., 1995, Vol. 90, No. 429 (Mar., 1995), pp. 268-281

 

There may be some specific choices you can make for yourself using this type of tests, for example, choosing the test as well as choosing the significance level to determine the significance of the lags coefficients, choosing the maximum number of lags to start the sequential testing process, etc.. I am not familiar with the literature in this area to make specific suggestions or point to a specific reference. You may want to do some research in the literature to help you make the decision. The Ng and Perron(1995) paper did mention a few references that used this type of sequential tests, you may want to look into those references.

 

Alternative to the sequential testing procedures, information based tests have also been proposed and used in the literature.  For example, Elliott, Rothenberg, and Stock (1996), suggest using the Schwarz Bayesian information criterion to select the optimal lag length in the augmented Dickey-Fuller regression; Ng and Perron(2001) suggest using modified AIC to select optimal lag length in the ADF regression. PROC AUTOREG provides the ERS stationarity test which selects the lag length using SBC and NP stationarity test which selects the lag length using modified AIC. You can specify ERS  option, NP  option in the MODEL statement in PROC AUTOREG to requests these tests:


https://go.documentation.sas.com/doc/en/pgmsascdc/v_050/etsug/etsug_autoreg_syntax06.htm#etsug_autor...

 

then scroll down to:

 

STATIONARITY=(ERS)
STATIONARITY=(ERS=(value))
STATIONARITY=(NP)
STATIONARITY=(NP=(value))

 

where 'value' is the maximum lag length to be considered in the lag order selection in the stationarity test.

 

Regarding conflicting results between the single mean model and trend model, in general, you choose the appropriate model for the data before performing the stationarity test. Inappropriate model choice can lead to misleading results. The choice between single mean and trend model depends on your data. For example, if data clearly shows deterministic trend, then the trend model is commonly used. You may want to examine your data and make the decision accordingly.

 

I hope this helps.

 

Wen

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 1 reply
  • 620 views
  • 0 likes
  • 2 in conversation