You are on page 1of 9

ARMA MODEL FOR FORECATING STOCK PRICE USING EVIEWS

1. Download historical price data from Yahoo Finance.

2. The stock price data gets downloaded as a CSV file. Save the file as XLXS file
and except for the date and adjusted close price columns delete all other columns.

3. Open EViews and import the excel file.


2

4. EViews automatically reads the file and a dialog box opens up. Press next on
all steps and finish at the last step.

5. The workfile window is shown below. ‘adj_close’ is the dependent variable.


Rename it as ‘y’ (right click on the variable and click rename).

6. Checking for Stationarity. The ‘Augmented Dicky-Fuller Test’ is used for


testing for stationarity. Go to ‘Quick’ -> Series Statistics -> Unit Root Test. A dialog
box: Series Name opens up, enter ‘y’ as the series name and press ok.
3

7. The Unit Root Test dialog box opens up. Test type ‘Augmented Dickey-
Fuller’ is preselected. First, we test for stationarity at Level, the check-box Level is
selected in the ‘Test for unit root in’ section. Click Ok.

8. The results of the Augmented Dickey Fuller Unit Root Test are displayed is
a dialog box. The p-value of the t-statistic should be below 0.05, for the series to be
stationary. In this case the p-value of the t-statistic is 0.9843, hence, we need to run
the unit root test for the 1st difference and check.
4

9. In the same dialog box go to View -> Unit Root Tests -> Standard Unit Root
Test. The Unit Root Test dialog box will open up again, select the 1st difference in the
‘Test for unit root in’ section and press Ok.

10. The results of the Augmented Dickey-Fuller Test at 1st difference are shown
below. The p-value of the t-statistic is 0.000 thus the series is stationary at 1st
difference.
5

11. Estimating the Equation. Go to Quick -> Estimate equation.

12. The estimate equation dialog box opens up. Write the equation in the dialog
box as: d(y) c ar(1) ar(2) ma(1) ma(2). Adjust the sample date till 2/12/2024, since the
model would be based on historic data up to 12 Feb 24 and the stock price for 13 Feb
24 would be predicted. Then click OK.

13. The results of the regression appear in a separate dialog box as shown below.
The p-value associated with all AR & MA terms except AR(2) term are less than 0.05,
hence they are significant.
6

14. Changin the AR/ MA Terms. To exclude the AR(2) term, click ‘Estimate’ on
the same dialog box, the Equation Estimate dialog box opens up, delete the AR(2) and
click ok.

15. The results of regression using one AR and two MA terms is shown below. The
p-value associated with the AR and MA terms are below 0.05, hence the AR(1) and
both MA(1) and MA(2) terms are significant.
7

16. Forecast. Click the Forecast button on the same dialog box (displaying the
results of the regression eqn). The Forecast dialog box opens up forecast name is
displayed as yf, select Static Forecast under the Method section and click OK. The
graph comprising results of the forecast is displayed, expand the dialog box and
observe the Theil Statistic.

17. The Theil Statistic in this case is 0.006, which is close to zero, signifying good
forecast accuracy.
8

18. Minimize the graph and go to the workfile window and double click on the yf
series as well as the y series, both series would open in different dialog boxes. The
actual and forecast values for 13 Feb can be compared side by side as shown below.
The forecasted value for 13 Feb in yf series is 2907.8 as against actual value of
2930.2.

19. Further, towards generating a good forecast model the entire set of data can be
bifurcated into two sets of data, known as train and test data. For instance, if there are
100 observations, the first 60 observations could be set as the train data and the next
40 the test dataset. The train data is used to train (build) the model and then the model
is used on the test data to generate the forecasted values for the test data points. The
forecasted values are then compared with the actual data. Comparison of two or more
9

different models (i.e. models with different AR & MA terms) is then carried out based
on the Mean Absolute Error (MAE), the model with a lower MAE could be expected to
give better predictions.

You might also like