BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KACJohnson
Calcite | Level 5

Hello SAS Procedures Community,

 

I would like assistance with syntax for specifying "Zero-Order" and "First-Order" transfer functions for interrupted time series ARIMA models. Specifically, what is the code I would use for: (1) the abrupt, permanent change (zero-order), versus (2) gradual, permanent change (first-order)? I am trying to compare pulse, zero-order, and first-order functions to determine if the introduction of a migration policy at point t (the year 2001) is characterized by a abrupt, temporary impact (pulse), an abrupt, permanent change (zero-order), or by a gradual, permanent change (first-order) on visa issuances.

 

I also wonder if the way I have the dates set up is correct, respectively? (I.e. what would be the temporary shock from 2002 to 2007? Or a permanent change after 2001?)

 

I'm very new to the ARIMA procedures and I have combed the SAS boards, guides, and examples for proper syntax. This is what I have come up with:

 

Pulse (temporary): where variable "temp" is coded as 0 prior to and after the event, and 1 during the temporary event ("000111000").

 

data a;

     set a;

     temp = (date = '2002'd, '2003'd, '2004'd, '2005'd, '2006'd, '2007'd);

run;

 

proc arima data=a;

     identify var=f crosscorr=temp;

     estimate p=1 q=1 input=temp;

run;

 

??? (permanent): where the variable "perm" is coded as 0 prior to the event (2001), and 1 after the event ("0000011111")

 

data a;

     set a;

     temp = (date >= '2002'd);

run;

 

proc arima data=a;

     identify var=f crosscorr=perm;

     estimate p =1 q=1 input=perm;

run;

 

Thank you all for helping a newbie, I appreciate all the help and feedback.

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
dw_sas
SAS Employee

Hi KACJohnson,

 

You are definitely on the right track in terms of your understanding of abrupt temporary changes, as compared with abrupt permanent changes and gradual permanent changes.  Temporary changes are typically modeled using a pulse intervention variable, whereas permanent effects are typically modeled using a step intervention variable.  A pulse intervention takes on the value of 0 before and after the intervention, and 1 for the duration of the intervention.  A step intervention typically takes on the value of 0 before the intervention and 1 afterwards.

 

An abrupt temporary effect can be modeled by including a pulse intervention variable as a simple regressor in the model.  Similarly, an abrupt permanent effect can be modeled by including a step intervention variable as a simple regressor in the model.  A gradual permanent effect can be modeled by including a step intervention variable as a dynamic regressor with a denominator factor in the transfer function part of the model.

 

Following, please find an example that illustrates how to fit these 3 types of intervention models.  The example contains annual data from 1998-2010.  Three additional years are included to illustrate how to use the models for forecasting.  The example creates a SAS date variable, DATE, from the numeric YEAR variable, and then uses the DATE variable to create the pulse and step intervention variables included in the subsequent ARIMA models.  I tried to keep these variables consistent with the description you provided for your analysis.   Please note that in order to illustrate the impact of the intervention variables in this example, I have not specified any AR or MA terms in the ARIMA models, though you can certainly include the P= and/or Q= options in the ESTIMATE statement to model any residual autocorrelation.

 

data a;
  input year y;
  date=mdy(1,1,year);  /*  create SAS date variable from YEAR variable */
  format date year4.;
  datalines;
1998 10
1999 12
2000 12
2001 15
2002 16
2003 16
2004 17
2005 17
2006 17
2007 16
2008 17
2009 18
2010 17
2011 .
2012 .
2013 .
;

  /*  add step and pulse interventions to data set using DATE variable */
data a;
  set a;
  perm=(date >= '01jan2001'd);
  temp=('01jan2002'd <= date <= '01jan2007'd);
run;

proc print data=a;
run;

 /* abrupt temporary effect */
proc arima data=a plots=(forecast(forecast));
  identify var=y crosscorr=(temp);
  estimate input=(temp);
  forecast out=out1 lead=3 id=date interval=year;
run;
quit;

 /*  abrupt permanent effect */
proc arima data=a plots=(forecast(forecast));
  identify var=y crosscorr=(perm);
  estimate input=(perm);
  forecast out=out2 lead=3 id=date interval=year;
run;
quit;

 /*  gradual permanent effect */
proc arima data=a plots=(forecast(forecast));
  identify var=y crosscorr=(perm);
  estimate input=( /(1) perm);
  forecast out=out3 lead=3 id=date interval=year;
run;
quit;

 

Note that when creating the intervention variables based on the values of the SAS date variable, DATE, you must use a SAS date literal of the form 'ddmonyy'd.

 

For more details on how to specify input variables and transfer function models in PROC ARIMA, please see the following section of the documentation:

 

http://support.sas.com/documentation/cdl/en/etsug/68148/HTML/default/viewer.htm#etsug_arima_details2...

 

I hope this information helps!

DW

View solution in original post

2 REPLIES 2
dw_sas
SAS Employee

Hi KACJohnson,

 

You are definitely on the right track in terms of your understanding of abrupt temporary changes, as compared with abrupt permanent changes and gradual permanent changes.  Temporary changes are typically modeled using a pulse intervention variable, whereas permanent effects are typically modeled using a step intervention variable.  A pulse intervention takes on the value of 0 before and after the intervention, and 1 for the duration of the intervention.  A step intervention typically takes on the value of 0 before the intervention and 1 afterwards.

 

An abrupt temporary effect can be modeled by including a pulse intervention variable as a simple regressor in the model.  Similarly, an abrupt permanent effect can be modeled by including a step intervention variable as a simple regressor in the model.  A gradual permanent effect can be modeled by including a step intervention variable as a dynamic regressor with a denominator factor in the transfer function part of the model.

 

Following, please find an example that illustrates how to fit these 3 types of intervention models.  The example contains annual data from 1998-2010.  Three additional years are included to illustrate how to use the models for forecasting.  The example creates a SAS date variable, DATE, from the numeric YEAR variable, and then uses the DATE variable to create the pulse and step intervention variables included in the subsequent ARIMA models.  I tried to keep these variables consistent with the description you provided for your analysis.   Please note that in order to illustrate the impact of the intervention variables in this example, I have not specified any AR or MA terms in the ARIMA models, though you can certainly include the P= and/or Q= options in the ESTIMATE statement to model any residual autocorrelation.

 

data a;
  input year y;
  date=mdy(1,1,year);  /*  create SAS date variable from YEAR variable */
  format date year4.;
  datalines;
1998 10
1999 12
2000 12
2001 15
2002 16
2003 16
2004 17
2005 17
2006 17
2007 16
2008 17
2009 18
2010 17
2011 .
2012 .
2013 .
;

  /*  add step and pulse interventions to data set using DATE variable */
data a;
  set a;
  perm=(date >= '01jan2001'd);
  temp=('01jan2002'd <= date <= '01jan2007'd);
run;

proc print data=a;
run;

 /* abrupt temporary effect */
proc arima data=a plots=(forecast(forecast));
  identify var=y crosscorr=(temp);
  estimate input=(temp);
  forecast out=out1 lead=3 id=date interval=year;
run;
quit;

 /*  abrupt permanent effect */
proc arima data=a plots=(forecast(forecast));
  identify var=y crosscorr=(perm);
  estimate input=(perm);
  forecast out=out2 lead=3 id=date interval=year;
run;
quit;

 /*  gradual permanent effect */
proc arima data=a plots=(forecast(forecast));
  identify var=y crosscorr=(perm);
  estimate input=( /(1) perm);
  forecast out=out3 lead=3 id=date interval=year;
run;
quit;

 

Note that when creating the intervention variables based on the values of the SAS date variable, DATE, you must use a SAS date literal of the form 'ddmonyy'd.

 

For more details on how to specify input variables and transfer function models in PROC ARIMA, please see the following section of the documentation:

 

http://support.sas.com/documentation/cdl/en/etsug/68148/HTML/default/viewer.htm#etsug_arima_details2...

 

I hope this information helps!

DW

KACJohnson
Calcite | Level 5

I wanted to post the code I ended up using so if others need it, too:

 

/* Abrupt permanent effect, zero-order transfer function */
proc arima data=arima;
identify var=logf(1) crosscorr=(perm);
estimate p=0 q=1 input=(perm);
run;

 

/* Gradual permanent effect, first-order transfer function */
proc arima data=arima;
identify var=logf(1) crosscorr=(perm);
estimate p=0 q=1 input=( /(1) perm);
run;

 

/* Abrupt temporary effect, pulse transfer function */
proc arima data=arima;
identify var=logf(1) crosscorr=(temp);
estimate p=0 q=1 input=( / (1) temp );
run;

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!

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
  • 2 replies
  • 2105 views
  • 0 likes
  • 2 in conversation