Forecasting the stock market is often seen as a complex puzzle. While no model can guarantee future
performance, statistical tools like Vector Auto Regression (VAR) allow us to uncover meaningful patterns in historical price data and make educated predictions.
In this blog, I explore how VAR can be applied to analyze stock price movements using MYR Group Inc.
(MYRG).

Understanding the Data

To begin, I collected daily price data for MYRG from February to April 2025. This dataset included key features such as open, high, low, and close prices for each trading day. These variables are crucial because they provide a comprehensive view of the stock’s behavior within each market session.
Visualizing these time series revealed interesting trends — some consistent, others volatile — highlighting the dynamic nature of market pricing.

The Role of Stationarity

One of the foundational requirements for time series modeling is stationarity, which means that a series’ statistical properties remain constant over time. Since real-world financial data often isn't stationary by default, the data was transformed to achieve this condition.
Stationary data allows models like VAR to perform better by focusing on meaningful shifts and dependencies rather than being distracted by long-term trends or seasonality.

Discovering Relationships Between Variables

Before diving into modeling, I explored whether certain price features could be predictive of others. For example, could the open price help anticipate the close price? This was done using the Granger Causality Test, a statistical method used to determine whether one time series can forecast another.
The results suggested that some variables indeed had predictive power over others — a valuable insight for building effective forecasting models.

Modeling with VAR

With the data prepared and the relationships identified, I applied the Vector Auto Regression (VAR) model. Unlike univariate models that analyze a single variable, VAR simultaneously captures relationships among multiple time-dependent features.
The model was trained to recognize how variables influence each other over time. To ensure optimal
performance, a metric called Akaike Information Criterion (AIC) was used to select the best lag length — essentially, how many past observations the model should consider when making predictions.

Forecasting the Future

After fitting the model, I generated forecasts for the stock's future high and close prices. While these predictions should always be taken with a grain of salt — as markets are influenced by many unpredictable factors — they offer a data-driven glimpse into what might come next.
This kind of forecasting can be especially useful for short-term planning, algorithmic trading strategies, or understanding general market behavior.

Final Thoughts

Vector Auto Regression is a powerful tool when it comes to modeling complex, interrelated financial variables. By examining how multiple price indicators influence each other over time, VAR can help us build more holistic and informative forecasts.