EXPERIMENT 5
Aim: Implementation of ARIMA model in python.
Theory:
ARIMA
An autoregressive integrated moving average, or ARIMA, is a statistical analysis model that uses time
series data to either better understand the data set or to predict future trends. A statistical model is
autoregressive if it predicts future values based on past values. For example, an ARIMA model might
seek to predict a stock's future prices based on its past performance or forecast a company's earnings
based on past periods. An autoregressive integrated moving average model is a form of regression
analysis that gauges the strength of one dependent variable relative to other changing variables. The
model's goal is to predict future securities or financial market moves by examining the differences
between values in the series instead of through actual values.
An ARIMA model can be understood by outlining each of its components as follows:
Autoregression (AR): refers to a model that shows a changing variable that regresses on its own
lagged, or prior, values.
Integrated (I): represents the differencing of raw observations to allow the time series to become
stationary (i.e., data values are replaced by the difference between the data values and the previous
values).
Moving average (MA): incorporates the dependency between an observation and a residual error
from a moving average model applied to lagged observations.
ARIMA Parameters
Each component in ARIMA functions as a parameter with a standard notation. For ARIMA models, a
standard notation would be ARIMA with p, d, and q, where integer values substitute for the
parameters to indicate the type of ARIMA model used. The parameters can be defined as:
p: the number of lag observations in the model, also known as the lag order.
d: the number of times the raw observations are differenced; also known as the degree of differencing.
q: the size of the moving average window, also known as the order of the moving average.
ARIMA and Stationary Data
In an ARIMA model, the data are differenced in order to make it stationary. A model that shows
stationarity is one that shows there is constancy to the data over time. Most economic and market
data show trends, so the purpose of differencing is to remove any trends or seasonal structures.
Seasonality, or when data show regular and predictable patterns that repeat over a calendar year,
could negatively affect the regression model. If a trend appears and stationarity is not evident, many
of the computations throughout the process cannot be made and produce the intended results.
How to Build an ARIMA Model
To begin building an ARIMA model for an investment, you download as much of the price data as you
can. Once you've identified the trends for the data, you identify the lowest order of differencing
(d) by observing the autocorrelations. If the lag-1 autocorrelation is zero or negative, the series is
already differenced. You may need to difference the series more if the lag-1 is higher than zero.
Next, determine the order of regression (p) and order of moving average (4) by comparing
autocorrelations and partial autocorrelations. Once you have the information you need, you can
choose the model you'll use.
Advantages of ARIMA model:
Simple to Use: ARIMA models are relatively easy to understand and implement, making them
accessible to a wide range of users.
Flexibility: ARIMA models can capture a variety of temporal structures, including trends,
seasonality, and autocorrelation.
Statistical Foundation: ARIMA models are based on solid statistical principles, which can
provide insights into the underlying data generating process.
Forecasting Accuracy: When used appropriately, ARIMA models can provide accurate
forecasts, especially for short to medium-term predictions
Robustness: ARIMA models can perform well even with noisy or irregularly spaced data, as
long as the underlying assumptions are met.
No Need for Feature Engineering: Unlike some other forecasting methods, ARIMA models do
not require manual feature engineering, which can save time and effort.
Disadvantages of ARIMA model:
Limited to Linear Relationships: ARIMA models assume that the relationships between
variables are linear. They may not perform well with data that exhibits non-linear patterns.
Sensitive to Outliers: ARIMA models can be sensitive to outliers, which can lead to inaccurate
forecasts if not properly addressed.
Requires Stationarity: ARIMA models require the time series to be stationary, meaning that
its statistical properties such as mean and variance do not change over time. Achieving
stationarity may require data transformation, differencing, or other pre-processing steps.
Complexity Selection: Selecting the appropriate ARIMA model order (p, d, q) can be
challenging and often requires expertise and iterative model fitting.
Limited Forecast Horizon: ARIMA models are generally better suited for short to medium-term
forecasts and may not perform well for long-term predictions.
Data Quality Dependence: The effectiveness of ARIMA models depends heavily on the quality
and consistency of the input data.
Overfitting: Like any modelling approach, ARIMA models can be susceptible to overfitting if
the model complexity is not appropriately controlled.
Computationally Intensive: Estimating ARIMA models can be computationally intensive,
especially for large datasets or models with high orders.
Noisy Data Handling: ARIMA models may not perform well with highly noisy data, requiring
additional pre-processing or the use of more robust modelling techniques.
Conclusion: Hence, we have successfully implemented the ARIMA model using python.