BookmarkSubscribeRSS Feed
teg_76
Calcite | Level 5

Hi,

 

I have a general ARIMA question.

 

When creating an ARIMA model, if I take first differences, I also must take first differences of my covariates, correct? What if my covariate is an indicator variable, 0 or 1?  Does that variable get differenced?

 

Thank you!

3 REPLIES 3
user24feb
Barite | Level 11

No, you can't difference a series that is already stationary. If you look at the IACF it is slowly decreasing:

 

Data A;
  Do i=1 To 100;
    u=IfN(Ranuni(1) gt 0.5,1,0);
	Output;
  End;
Run;

ODS Graphics On;
Proc Arima;
  Identify Var=u(1);
Run;
ODS Graphics Off;
teg_76
Calcite | Level 5

Thank you user24feb. 

 

So what happens to indicator variables when I difference the variable I'm forecasting?  Can they no longer be used in the model?  Or does it depend on the diagnostics?

 

user24feb
Barite | Level 11

Sorry, I was wrong, you have to difference the dummy:

 

No, you can difference one series and leave another as it is.

 

What exactly is your indicator variable, an outlier like here:

 

Data A (Keep=x_i x t);
  Retain e1 0 x1 0 x2 0 x_i_1 100;  
  Do t=-100 To 10000;
    e=Rannor(0);
	x=(0.02+0.8*x1-0.4*e1+e);
	x_i=x_i_1+x;
	e1=e;
	x1=x;
	x_i_1=x_i;
	If t>0 Then Output;
  End;
Run;

Data A;
  Set A; 
  dummy=IfN(t>=6000 & t<=7500,1,0);
  x_i_d=x_i-dummy*200; * <- something bad happens;
Run;

ODS Graphics On;
Proc Timeseries Data=A Plot=Series;
  Var x_i_d x_i;
Run;
Proc Arima Data=A;
  Title "Model 1: Has dent";
  Identify Var=x_i_d (1) CrossCorr=dummy (1); * 1!!!!;
  Estimate p=1 q=1 Input=dummy Method=ML;
Run;
Proc Arima Data=A;
  Title "Model 2: No dent";
  Identify Var=x_i (1);
  Estimate p=1 q=1 Method=ML;
Run;
Title;
ODS Graphics Off;

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1899 views
  • 0 likes
  • 2 in conversation