A GARCH Tutorial with R

Main Article Content

Marcelo Scherer Perlin
https://orcid.org/0000-0002-9839-4268 orcid
Mauro Mastella
https://orcid.org/0000-0002-7163-9448 orcid
Daniel Francisco Vancin
https://orcid.org/0000-0001-6303-0555 orcid
Henrique Pinto Ramos
https://orcid.org/0000-0002-7998-7033 orcid


Context: modeling volatility is an advanced technique in financial econometrics, with several applications for academic research. Objective: in this tutorial paper, we will address the topic of volatility modeling in R. We will discuss the underlying logic of GARCH models, their representation and estimation process, along with a descriptive example of a real-world application of volatility modeling. Methods: we use a GARCH model to predict how much time it will take, after the latest crisis, for the Ibovespa index to reach its historical peak once again. The empirical data covers the period between years 2000 and 2020, including the 2009 financial crisis and the current 2020’s episode of the COVID-19 pandemic. Conclusion: we find that, according to our GARCH model, Ibovespa is more likely than not to reach its peak once again in one year and four months from June 2020. All data and R code used to produce this tutorial are freely available on the internet and all results can be easily replicated.


Download data is not yet available.

Article Details

How to Cite
Perlin, M. S., Mastella, M., Vancin, D. F., & Ramos, H. P. (2020). A GARCH Tutorial with R. Journal of Contemporary Administration, 25(1), e200088. https://doi.org/10.1590/1982-7849rac2021200088


Aas, K. (2004). To log or not to log: The distribution of asset returns (Technical Report SAMBA nº 03/04), Oslo, Norway, Norwegian Computing Center, Applied Research and Development. Retrieved from https://www.nr.no/files/samba/bff/SAMBA0304.pdf
Aït-Sahalia, Y., Mykland, P. A., & Zhang, L. (2011). Ultra high frequency volatility estimation with dependent microstructure noise. Journal of Econometrics, 160(1), 160-175. https://doi.org/10.1016/j.jeconom.2010.03.028
Ardia, D., Bluteau, K., Boudt, K., Catania, L., & Trottier, D.-A. (2019). Markov-switching GARCH models in R: The MSGARCH package. Journal of Statistical Software, 91(4), 1-38. http://dx.doi.org/10.18637/jss.v091.i04
Bauwens, L., Laurent, S., & Rombouts, J. V. K. (2006). Multivariate GARCH models: A survey. Journal of Applied Econometrics, 21(1), 79-109. https://doi.org/10.1002/jae.842
Bernardino, W., Brito, L., Ospina, R., & Melo, S. (2018). A GARCH-VaR investigation on the Brazilian sectoral stock indices. Brazilian Review of Finance, 16(4), 573-610. http://dx.doi.org/10.12660/rbfin.v16n4.2018.74676
Black, F. (1976, August). Studies of stock market volatility changes. Proceedings of the 1976 Meeting of the Business and Economic Statistics Section, American Statistical Association, Washington, DC, USA.
Bollerslev, T., Engle, R. F., & Nelson, D. B. (1994). Arch models. Handbook of Econometrics, 4, 2959–3038.
Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics, 31(3), 307-327. https://doi.org/10.1016/0304-4076(86)90063-1
Box, G. E. P., & Jenkins, G. M. (1976). Time series analysis: Forecasting and control San Francisco. San Francisco, CA: Holden Day.
Brockwell, P. J., & Davis, R. A. (2016). Introduction to time series and forecasting. New York, NY: Springer International Publishing
Bueno, R. D. S. (2011). Econometria de séries temporais. São Paulo, SP: Cengage Learning
Burnham, K. P., & Anderson, D. R. (2004). Multimodel inference: Understanding AIC and BIC in model selection. Sociological Methods & Research, 33(2), 261-304. https://doi.org/10.1177%2F0049124104268644
Byström, H. N. E. (2004). Orthogonal GARCH and covariance matrix forecasting: The Nordic stock markets during the Asian financial crisis 1997–1998. The European Journal of Finance, 10(1), 44-67. https://doi.org/10.1080/1351847032000061379
Caldeira, J. F., Moura, G. V., Perlin, M. S., & Santos, A. A. P. (2017). Portfolio management using realized covariances: Evidence from Brazil. EconomiA, 18(3), 328-343. https://doi.org/10.1016/j.econ.2017.04.002
Carson, J. M., Elyasiani, E., & Mansur, I. (2008). Market risk, interest rate risk, and interdependencies in insurer stock returns: A system‐GARCH model. Journal of Risk and Insurance, 75(4), 873-891. https://doi.org/10.1111/j.1539-6975.2008.00289.x
Cont, R. (2001). Empirical properties of asset returns: Stylized facts and statistical issues. Quantitative Finance, 1(2), 223–236. https://doi.org/10.1080/713665670
Costa, C. H., Porto Junior, S. S., & Menezes, G. R. (2018). Um estudo empírico da dinâmica da correlação do retorno das ações do Brasil. Brazilian Review of Finance, 16(4), 635-667. http://dx.doi.org/10.12660/rbfin.v16n4.2018.72142
De Goeij, P., & Marquering, W. (2004). Modeling the conditional covariance between stock and bond returns: A multivariate GARCH approach. Journal of Financial Econometrics, 2(4), 531-564. https://doi.org/10.1093/jjfinec/nbh021
Deng, L., Ma, C., & Yang, W. (2011). Portfolio optimization via pair copula-GARCH-EVT-CVaR model. Systems Engineering Procedia, 2, 171-181. https://doi.org/10.1016/j.sepro.2011.10.020
Engle, R. F., Focardi, S. M., & Fabozzi, F. J. (2012). ARCH/GARCH models in applied financial econometrics. In F. J. Fabozzi (Ed.), Encyclopedia of financial models. Hoboken, NJ: John Wiley & Sons
Engle, R. F. (1982). Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation. Econometrica, 50(4), 987-1007. https://doi.org/10.2307/1912773
Engle, R. (2001). GARCH 101: The use of ARCH/GARCH models in applied econometrics. Journal of Economic Perspectives, 15(4), 157-168. https://doi.org/10.1257/jep.15.4.157
Ferreira, P. G. C. (2018). Análise de séries temporais em R: Curso introdutório. São Paulo, SP: GEN Atlas
Fioruci, J. A., Ehlers, R. S., & Andrade Filho, M. G. (2014). Bayesian multivariate GARCH models with dynamic correlations and asymmetric error distributions. Journal of Applied Statistics, 41(2), 320-331. https://doi.org/10.1080/02664763.2013.839635
Fisher, I. (1896). Appreciation and interest: A study of the influence of monetary appreciation and depreciation on the rate of interest with applications to the bimetallic controversy and the theory of interest. New York: Macmillan Company.
Francq, C., & Zakoian, J. M. (2019). GARCH models: Structure, statistical inference and financial applications. Hoboken, NJ: John Wiley & Sons.
Ghalanos, A. (2020). Introduction to the rugarch package (version 1.3-8). Retrieved from http://cran.r-project.org/web/packages/rugarch
Glosten, L. R., Jagannathan, R., & Runkle, D. E. (1993). On the relation between the expected value and the volatility of the nominal excess return on stocks. The Journal of Finance, 48(5), 1779-1801. https://doi.org/10.1111/j.1540-6261.1993.tb05128.x
Hamilton, J. D. (1994). Time series analysis. Princeton, NJ: Princeton University Press.
Hansen, P. R., & Lunde, A. (2005). A forecast comparison of volatility models: Does anything beat a GARCH (1, 1)?. Journal of Applied Econometrics, 20(7), 873-889. https://doi.org/10.1002/jae.800
Härdle, W. K., Chen, C. Y. H., & Overbeck, L. (2017). Applied quantitative finance. Heidelberg, Germany: Springer-Verlag
Katsiampa, P. (2017). Volatility estimation for bitcoin: A comparison of GARCH models. Economics Letters, 158(C), 3-6. https://doi.org/10.1016/j.econlet.2017.06.023
Kuha, J. (2004). AIC and BIC: Comparisons of assumptions and performance. Sociological Methods & Research, 33(2), 188-229. https://doi.org/10.1177%2F0049124103262065
Lobão, J., & Fernandes, J. (2018). Psychological barriers in single stock prices: Evidence from three emerging markets. Revista Brasileira de Gestão de Negócios, 20(2), 248-272. https://doi.org/10.7819/rbgn.v20i2.3049
Mastella, M., & Coster, R. (2014). O impacto da crise de 2008 na estrutura temporal de correlação condicional da BM&FBovespa. Revista Brasileira de Gestão de Negócios, 16(50), 110-123. https://doi.org/10.7819/rbgn.v16i50.1534
Meng, X. L., & Rubin, D. B. (1992). Performing likelihood ratio tests with multiply-imputed data sets. Biometrika, 79(1), 103-111. https://doi.org/10.2307/2337151
Morettin, P. A., & Toloi, C. (2006). Análise de séries temporais. São Paulo, SP: Blucher
Morettin, P. A. (2017). Econometria financeira: Um curso de séries temporais financeiras. São Paulo, SP: Blucher
Nelson, D. B. (1991). Conditional heteroskedasticity in asset returns: A new approach. Econometrica, 59(2), 347-370. https://doi.org/10.2307/2938260
Omran, M. F., & McKenzie, E. (2000). Heteroscedasticity in stock returns data revisited: Volume versus GARCH effects. Applied Financial Economics, 10(5), 553-560. https://doi.org/10.1080/096031000416433
Perlin, M., Mastella, M., Vancin, D., & Ramos, H. (2020). Replication data for: A garch tutorial with R. Harvard Dataverse, v1. https://doi.org/10.7910/DVN/C4WHUJ
Perlin, M. S. (2018) Processamento e análise de dados financeiros e econômicos com o R (2nd ed.). Porto Alegre, RS: Author
Quigley, L., & Ramsey, D. (2008). Statistical analysis of the log returns of financial assets (Bachelor dissertation). University of Limerick, Ireland. Retrieved from https://www.uni-muenster.de/Stochastik/paulsen/Abschlussarbeiten/Diplomarbeiten/Quigley.pdf
R Core Team (2017). R: A language and environment for statistical computing. Vienna, Austria: R Foundation for Statistical Computing. Retrieved from https://www.r-project.org/
Ruppert, D., & Matteson, D. S. (2015). GARCH models. In D. Ruppert, D. S. Matteson (Eds.), Statistics and data analysis for financial engineering (pp. 405-452). New York, NY: Springer.
Tsay, R. S. (2005). Analysis of financial time series (3rd ed.). Hoboken, NJ: John Wiley & Sons.
Varga-Haszonits, I., & Kondor, I. (2007). Noise sensitivity of portfolio selection in constant conditional correlation GARCH models. Physica A: Statistical Mechanics and its Applications, 385(1), 307-318. https://doi.org/10.1016/j.physa.2007.06.017
Wuertz, D., Setz, T., Chalabi, Y., Boudt, C., Chausse, P., & Miklovac, M. (2020). fGarch: Rmetrics - Autoregressive conditional heteroskedastic modelling [R package version 3042.83.2]. Retrieved from https://CRAN.R-project.org/package=fGarch