BookmarkSubscribeRSS Feed
DLstudent
Calcite | Level 5

Hi everyone,

I'm currently doing an event study of quarterly earnings announcements and are trying to produce an ARMA(1,1) forecast for the earnings per share (EPS). Due to the large number of events I'm trying to configurate the ARMAREG module (SAS/IML(R) 9.22 User's Guide)  to loop and get the forecast as an output. Currently I've managed to loop and get the right estimates for the parameters, but I'm struggeling with getting the forecast to concurr with what I get in PROC ARIMA. I've read how the one-period ahead forecast should be done here,SAS/ETS(R) 9.2 User's Guide However I've not managed to replicate the result in order to loop the code.

I have only done changes to the bottom of the ARIMAREG code. The variable "estimate" are currently producing false results. I would be deeply thankful to anyone who are able to help me with this problem Smiley Happy

Here is my current code:

/* everything above here is the same as in ARIMAREG */

   /* Begin estimation for Grunfeld's investment models */

iphi=1;       /*p*/

itheta=1;     /*q*/

maxiter=10;

delta=0.0005;

ml=1;

/*----  To prevent overflow, specify starting values  ----*/

par={-0.5  0.5  1.956306};

use work.eps;

read all var {EPS} into y;

EPSrow=nrow(Y);

params=J(3,4,0);

estimate=J(4,1,0);

do tt=1 to 4;

y=y[1:EPSrow-tt];

x=j(EPSrow-tt,1,1);

par={-0.5  0.5  1.956306};

run armareg;   /*----  Perform ML estimation  ----*/

Yrows=nrow(Y);

estimate[tt]=par[3]+par[2]*(-1)*Y[yRows]+par[1]*(-1)*resid[yRows];

params[,tt]=par[1:3];

end;

quit;

4 REPLIES 4
Rick_SAS
SAS Super FREQ

It would be helpful to have some sample data for Y.

This module uses global variables, so there is no guarantee that the state of variables after the call are equivalent to the state prior to the call.

If the first iteration is correct, but not subsequent iterations, then clear out the old variables before the second iteration. For example, to clear all variables except for the ones listed below, use the following:

free / iphi itheta maxiter delta ml x y par estimate params;

DLstudent
Calcite | Level 5

Hi,

Thank you for your response Smiley Happy

here is the sample data.

the import procedure used is

PROC IMPORT OUT= WORK.EPS

            DATAFILE= "filapath:\Hydro.xls"

            DBMS=xls REPLACE;

             GETNAMES=YES;

RUN;

However it is estimation of the one-period ahead forecast I'm struggeling with.

Edit: to clarify the ar, ma and mu parameters I get is correct, but the one-period ahead forecast is not Smiley Happy

Rick_SAS
SAS Super FREQ

Are you saying that the formula

estimate[tt]=par[3]+par[2]*(-1)*Y[yRows]+par[1]*(-1)*resid[yRows];

is not correct and that you want someone to tell you the correct formula to use?

If so, you might want to check with the Time series/forecating community. Someone there can help with the formula.

Or do you have the correct formula but you are getting wrong numbers, nonconvergence, or some other IML problem?

DLstudent
Calcite | Level 5

Yes,

estimate[tt]=par[3]+par[2]*(-1)*Y[yRows]+par[1]*(-1)*resid[yRows];

is not the correct formula, I think the correct formula is stated here SAS/ETS(R) 9.2 User's Guide under "finite memory forecasts", but I do not know how to implement it.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 4 replies
  • 1025 views
  • 0 likes
  • 2 in conversation