Get Started

Simulate ARCH and GARCH series

In this exercise, you will simulate an ARCH(1) and GARCH(1,1) time series respectively using a predefined function simulate_GARCH(n, omega, alpha, beta = 0).

Recall the difference between an ARCH(1) and a GARCH(1,1) model is: besides an autoregressive component of \(\alpha\) multiplying lag-1 residual squared, a GARCH model includes a moving average component of \(\beta\) multiplying lag-1 variance.

The predefined function will simulate an ARCH/GARCH series based on n (number of simulations), omega, alpha, and beta (0 by default) you specify. It will return simulated residuals and variances. Afterwards you will plot and observe the simulated variances from the ARCH and GARCH process.

This is a part of the course

“GARCH Models in Python”

View Course

Exercise instructions

  • Simulate an ARCH(1) process with omega = 0.1, alpha = 0.7.
  • Simulate a GARCH(1,1) process with omega = 0.1, alpha = 0.7, and beta = 0.1.
  • Plot the simulated ARCH variances and GARCH variances respectively.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Simulate a ARCH(1) series
arch_resid, arch_variance = simulate_GARCH(n= 200, 
                                           omega = ____, alpha = ____)
# Simulate a GARCH(1,1) series
garch_resid, garch_variance = simulate_GARCH(n= 200, 
                                             omega = ____, alpha = ____, 
                                             beta = ____)
# Plot the ARCH variance
plt.plot(____, color = 'red', label = 'ARCH Variance')
# Plot the GARCH variance
plt.plot(____, color = 'orange', label = 'GARCH Variance')
plt.legend()
plt.show()

This exercise is part of the course

GARCH Models in Python

AdvancedSkill Level
4.8+
4 reviews

Learn about GARCH Models, how to implement them and calibrate them on financial data from stocks to foreign exchange.

What are GARCH models, what are they used for, and how can you implement them in Python? After completing this first chapter you’ll be able to confidently answer all these questions.

Exercise 1: Why do we need GARCH modelsExercise 2: Understand volatilityExercise 3: Observe volatility clusteringExercise 4: Calculate volatilityExercise 5: What are ARCH and GARCHExercise 6: Review GARCH model basicsExercise 7: Simulate ARCH and GARCH series
Exercise 8: Observe the impact of model parametersExercise 9: How to implement GARCH models in PythonExercise 10: Review "arch" documentationExercise 11: Implement a basic GARCH modelExercise 12: Make forecast with GARCH models

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free