What Are Autoregressive Models?

Written by Coursera Staff • Updated on

Explore the exciting world of predictive modeling with autoregressive models. Learn what this type of model is and why you might benefit from learning how to use it.

[Featured Image] A statistician goes over some autoregressive models on a laptop while sitting at a desk.

Autoregressive models are linear predictive models that use past data to make future predictions. You can use this model across fields, making it a powerful tool to gain insight into future events. In this article, we will explore autoregressive models, how professionals use them in different industries, its advantages and disadvantages, and how you can begin building your own models. 

Read more: What Is a Data Model?

What is an autoregressive model?

An autoregressive model, or AR model, is a linear predictive model that uses past data to predict future trends. For example, an autoregressive model might continually integrate stock market data into its algorithm to provide updated forecasts for future prices.

This class of statistical models is commonly used for time series analysis. These models operate under the premise that a variable's past values significantly impact its current value. Autoregressive modeling is particularly popular for analyzing time-varying processes in fields like nature, economics, finance, and many others. These models capture and quantify the relationship between an observation and its lagged (past) values.

Types of autoregressive models

When you use AR models, you will classify them based on the number of past values considered in predicting the current value. When building an autoregressive mode, you must determine the appropriate number of past events for your linear model to predict future data values. 

While more past events can capture more detailed patterns, it can also increase your model's complexity. The number of past events defines the order of the autoregressive model. For example:

  • AR(0): An AR(0) process models white noise or random noise with no significant dependence between the terms. It assumes that the current value does not relate to any past values.

  • First-order autoregression or AR(1): In an AR(1) process, the current value is determined primarily by the immediately preceding value. It assumes a linear relationship between the current value and the most recent past value.

  • Second-order autoregression or AR(2): An AR(2) process extends the influence to the previous two values. In other words, this model assumes the current value is a combination of the two most recent values.

  • p order autoregression or AR(p): Similar to previous models, an AR process dependent on p previous observations is an AR(p) process.

Uses of autoregressive models

You can use autoregressive models in a variety of fields. Depending on your goal, you can use these models for many types of predictions. Some ways in which professionals use autoregressive models across industries include:

  • Predicting future stock prices

  • Predicting the number of earthquakes in a given year

  • Modeling protein sequences in genetic data

  • Predicting patient health outcomes

  • Modeling patient symptoms over time

  • Modeling the progression of animal disease spread

  • Predicting circadian rhythm patterns

Advantages and limitations of autoregressive models

While autoregressive models have many strengths, you should be aware of the limitations so you do not misinterpret your model or develop unnecessary errors. One common advantage that leads professionals to choose autoregressive models is that they are efficient for complex data. The nature of autoregressive models allows them to work well with large and intricate data sets. In addition to this, they are relatively easy to implement. Compared to other types of models, autoregressive models are easier to design and test.

However, the limitations of autoregressive models can lead to inaccurate results if you aren’t careful. Because autoregressive models predict new values related to the values of past events, unusual occurrences can disrupt the model and lead to inaccurate predictions. For example, crashes in the economy or financial sector can disrupt predictive models and lead to skewed predictions.

Build your own autoregressive model.

To build your own autoregressive model, you will need historical data and an idea of how many previous data points you are using in your model. While this will vary, here is a simple example of the steps you would take to build an autoregressive model.

Let’s consider an example of using an autoregressive model to predict monthly gas prices at a particular gas station. The goal is to forecast the gas price each month using previous data. In this example, we’ll use an AR(2) autoregressive model, where the current month’s price depends on the two previous months’ prices.

1. Collect historical data and organize the data into a time series data set, with each row representing the gas price for each month.

2. Divide the data set into training and testing sets. You will use the training set to estimate parameters and build the model and the testing set to test your developed model.

3. Fit an AR(2) autoregressive model to the training data. The model will include parameters for the coefficients of the lagged values (previous two months’ prices) and an intercept.

4. Estimate the model’s coefficients (AR parameters) using methods like the least squares method or maximum likelihood estimation.

5. Assess the model’s goodness of fit and statistical significance of the parameters using appropriate statistical tests and diagnostics.

6. Apply the trained AR(2) model to the testing data set to make out-of-sample predictions of the prices for each month.

7. Evaluate the model’s accuracy by comparing what it predicted to what the observed values were. Common evaluation metrics include mean squared error (MSE) and root mean squared error (RMSE).

8. Continue to evaluate and update the model as needed.

This is a simplified version of how to build an autoregressive model. Depending on your data and the relationship between historical data and future values, you will need to adjust your model and process as necessary. 

Learn more with Coursera.

The world of artificial intelligence and machine learning continues to evolve, making it an exciting field to explore. To continue learning about different computer models, take courses, Specializations, or Professional Certificates on Coursera. To build foundational skills, you can begin with the Mathematics for Machine Learning and Data Science Specialization offered by DeepLearningAI. This program covers fundamental mathematics used in machine learning.

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.