• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Finance Train

Finance Train

High Quality tutorials for finance, risk, data science

  • Home
  • Data Science
  • CFA® Exam
  • PRM Exam
  • Tutorials
  • Careers
  • Products
  • Login

AutoRegressive (AR) Model in R

Data Science, Statistics

This lesson is part 18 of 27 in the course Financial Time Series Analysis in R

AutoRegressive (AR) model is one of the most popular time series model. In this model, each value is regressed to its previous observations. AR(1) is the first order autoregression meaning that the current value is based on the immediately preceding value.

We can use the arima.sim() function to simulate the AutoRegressive (AR) model.

Note that model argument is meant to be a list giving the ARMA order, not an actual arima model. So, for the AutoRegressive model, we will specify model as list(ar = phi) , in which phi is a slope parameter from the interval (-1, 1).

Below we create two sets of simulations with AR model, one with a slope of 0.5 and another with a slope of 0.8.

# Simulate AutoRegressive model with 0.5 slope
AR_1 <- arima.sim(model = list(ar = 0.5), n = 200)
# Simulate AutoRegressive model with 0.8 slope
#
AR_2 <- arima.sim(model = list(ar = 0.9), n = 200)
plot.ts(cbind(AR_1 , AR_2 ), main="AR Model Simulated Data")

It is important to note that Random Walk is a special case of AutoRegressive models, where the slope parameter is equal to 1.

ACF and PACF of Autoregressive Model

We can calculate the Autocorrelation and Partial Autocorrelation Functions of the Autoregressive model using the acf() and the pacf() functions.

The following are the respective ACF and PACF plots for the AR_1 series.

> acf(AR_1)
> pacf(AR_1)

Characteristics of AutoRegressive Model

Persistence: The slope in an AR model can range from -1 to 1. As the slope gets closer to 1, the model shows higher persistence, i.e., it shows higher correlation with previous values. Also, the higher the slope, the slower is the decay of ACF to 0.

Oscillatory behavior: This refers to a large amount of variation between an observation and its lag. As the slope reduces, the AR model exhibits oscillatory behavior.

Previous Lesson

‹ Simulate Random Walk (RW) in R

Next Lesson

Estimating AutoRegressive (AR) Model in R ›

Join Our Facebook Group - Finance, Risk and Data Science

Posts You May Like

How to Improve your Financial Health

CFA® Exam Overview and Guidelines (Updated for 2021)

Changing Themes (Look and Feel) in ggplot2 in R

Coordinates in ggplot2 in R

Facets for ggplot2 Charts in R (Faceting Layer)

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

In this Course

  • Financial Time Series Data
  • Exploring Time Series Data in R
  • Plotting Time Series in R
  • Handling Missing Values in Time Series
  • Creating a Time Series Object in R
  • Check if an object is a time series object in R
  • Plotting Financial Time Series Data (Multiple Columns) in R
  • Characteristics of Time Series
  • Stationary Process in Time Series
  • Transforming a Series to Stationary
  • Time Series Transformation in R
  • Differencing and Log Transformation
  • Autocorrelation in R
  • Time Series Models
  • ARIMA Modeling
  • Simulate White Noise (WN) in R
  • Simulate Random Walk (RW) in R
  • AutoRegressive (AR) Model in R
  • Estimating AutoRegressive (AR) Model in R
  • Forecasting with AutoRegressive (AR) Model in R
  • Moving Average (MA) Model in R
  • Estimating Moving Average (MA) Model in R
  • ARIMA Modelling in R
  • ARIMA Modelling – Identify Model for a Time Series
  • Forecasting with ARIMA Modeling in R – Case Study
  • Automatic Identification of Model Using auto.arima() Function in R
  • Financial Time Series in R – Course Conclusion

Latest Tutorials

    • Data Visualization with R
    • Derivatives with R
    • Machine Learning in Finance Using Python
    • Credit Risk Modelling in R
    • Quantitative Trading Strategies in R
    • Financial Time Series Analysis in R
    • VaR Mapping
    • Option Valuation
    • Financial Reporting Standards
    • Fraud
Facebook Group

Membership

Unlock full access to Finance Train and see the entire library of member-only content and resources.

Subscribe

Footer

Recent Posts

  • How to Improve your Financial Health
  • CFA® Exam Overview and Guidelines (Updated for 2021)
  • Changing Themes (Look and Feel) in ggplot2 in R
  • Coordinates in ggplot2 in R
  • Facets for ggplot2 Charts in R (Faceting Layer)

Products

  • Level I Authority for CFA® Exam
  • CFA Level I Practice Questions
  • CFA Level I Mock Exam
  • Level II Question Bank for CFA® Exam
  • PRM Exam 1 Practice Question Bank
  • All Products

Quick Links

  • Privacy Policy
  • Contact Us

CFA Institute does not endorse, promote or warrant the accuracy or quality of Finance Train. CFA® and Chartered Financial Analyst® are registered trademarks owned by CFA Institute.

Copyright © 2021 Finance Train. All rights reserved.

  • About Us
  • Privacy Policy
  • Contact Us