Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 309 Application of Markov Regime Switching Autoregressive Model to Gold Prices in Pakistan Tahira Bano Qasim a ,Gul Zaib Iqbal b , Mahmood ul Hassan c , Hina Ali d a Assistant Professor, Department of Statistics, The Women University Multan, Pakistan b Scholar, Department of Statistics, The Women University Multan, Pakistan c Assistant Professor, Department of Economics, University of Sargodha, Sargodha, Pakistan d Assistant Professor, Department of Economics, The Women University Multan, Pakistan Email: hinaali@wum.edu.pk ARTICLE DETAILS ABSTRACT History: Accepted 25 July 2021 Available Online September 2021 The goal of this study is to investigate the performance of the Markov regime switching autoregressive (MRS-AR) model to estimate and forecast the gold prices in Pakistan. Initial analysis of the data covering from January 1995 to January 2019 reveals the existence of nonstationarity, heteroscedasticity, and structural changes. The dynamics of the data are studied in two distinct regimes. The empirical analysis provides evidence that the regime shifts are mattered and MRS- AR model is found to be suitable even in the case of nonstationarity. Moreover, it is worthwhile to note that the Markov regime switching successfully captures the nonlinearities and heteroscedasticity underlying the selected data and provides efficient forecasts. Based on empirical evidence it is recommended that the applications of regime switching models should be promoted in other fields of life. © 2021 The authors. Published by SPCRD Global Publishing. This is an open access article under the Creative Commons Attribution- NonCommercial 4.0 Keywords: Markov Process, Gold, Regime Switching, Autoregressive, Heteroscedasticity JEL Classification: K49, C10 DOI: 10.47067/reads.v7i3.368 Corresponding author’s email address: hinaali@wum.edu.pk 1. Introduction Gold holds historic importance in the development of the human economic system. Being a noble metal, it has been considered a symbol of wealth, prosperity, and nobility since pre-historic times. The advent of metal coins throughout the world provided a standard for financial exchange (McKay and Peters, 2017). While the other metals lost their importance with time, gold made its way to the modern economy. It has been considered a commodity to stabilize the economy and prevent inflation. The use of ‘The Gold Standard’ in the pre-world war II era was aimed at stabilizing the price of goods and preventing over-inflation (Bahrami, Moghadam and Baghernia, 2020). Till today gold holds its credibility as an indicator of wealth. It has been seen that during periods of economic and political uncertainty, investors turn to gold to save their wealth. It gives the impression that while other assets lose their value, gold promises some value regardless of the political and economic conditions. A study examining the role of gold as a safe-haven during COVID-19 crises found that it served as a haven asset during phase I (31-12-2019 to 16-03-2020) of the crises, though it lost its position in phase II (17-03- Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 310 2020 to 04-04-2020) (Akhtaruzzaman, Boubaker, Lucey and Sensoy, 2020). However, in many studies, the inflation hedging properties of gold have been challenged and other assets like stocks and real estate have been shown to have provided better hedges (Salisu, Raheem, and Ndako, 2020; Zhu, Fan, and Tucker, 2018). In Pakistan, gold holds its importance as a potential investment not only for investors and business groups but also for the common man. It has retained its cultural and social value and a middle class man considers it a safe investment option compared with real estate and stocks. Moreover, gold price directly affects the country’s economy as well. In a study, it has been shown that crude oil price and gold price affect the exchange rate in the country which in turn affects the stock market (Bakhsh and Khan, 2019). Another study has shown that gold and oil price have a significant effect on the stock market (Shabbir, Kousar, and Batool, 2020). Given the mentioned facts, stabilizing the gold price is crucial for the government for stabilizing the country’s economy. Additionally, the potential investment interests for the common man that lie in gold make it beneficial to forecast and predict the price of gold and the factors affecting it. Appropriate forecasts of gold prices not only guide decision making for the government but also provide a reference for investors to make informed decisions. The structural changes due to political and economic instability not only affect the stock markets but also gold prices. Linear univariate models like autoregressive moving average (MA) and autoregressive moving average(ARMA) models cannot successfully capture these structural changes. In such a situation some nonlinear models such as state space models, threshold models and Markov regime switching (MRS) models are considered suitable to accommodate the structural changes. MRS model introduced by Hamilton(1989) characterized the structural changes in the data generating process describing the US business cycles. Hamilton’s model is an autoregressive process in which parameters switch under the first order Markov process from one regime to another. Numerous studies have been conducted applying different univariate and GARCH-type models to estimate and forecast gold prices in Pakistan. But to the best of our knowledge, no one has investigated the performance of the Markov regime switching models to model gold prices in Pakistan. In the present study, we have applied the Markov regime switching autoregressive models to the monthly gold prices in Pakistan to fill this gap. The main objective of the study is to build a suitable model to predict and forecast the gold price in Pakistan accommodating the nonstationarity, heteroscedasticity, and structural changes simultaneously. The rest of the paper is organized as: Section 2 describes the brief review of the previous studies; Section 3 provides the data and methodology adopted in this study. Results and discussion are provided in Section 4; Section 5 provides the conclusion of the study and recommendations for future work. 2. Literature Review Numerous studies related to gold price modeling and its forecasting are available in the literature, some of these are as Khaemasunun (2009) applied the multiple regression method and the ARIMA model to forecast Thai gold prices. The results presented that ARIMA is the best model for the forecasting of Thai gold prices. Ismail, Yahya and Shabri (2009) used multiple linear regression for forecasting the gold price. They used different indicators to develop the models such as; IR (Inflation Rate), USDX (US Dollar Index), MI (Money Supply), SPX (Standard and Poor 500), NYSE (New York Stock Exchange), EURO USD (USD/Euro Foreign Exchange Rate), T-BILL (Treasury Bill) and CRB (Commodity Research Bureau future index). Their findings revealed the significance of IR, MI, EURO Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 311 USD, and CRB variables in the model. Sujit and Kumar (2011) computed a vector autoregressive model and integration by considering the gold price, exchange rate, oil price, and stock returns. The results of their study showed that the variables are cointegrated. The univariate linear ARIMA models are widely used to model the gold prices, for example, Abdullah, 2012; Khan, 2013; Massarrat, 2013; Davis, Dedu, and Boyne, 2014; Khalid, Sultana, and Zaidi, 2014; Guha and Bandyopadhyay, 2016; Tripathy, 2017, etc. Due to the importance of nonlinear models, the application of these is increasing in many fields of life. Adejumo Albert and Asemota (2020) investigated the performance of the Markov Switching Autoregressive model to forecast the Nigerian stock market returns. Moore and Whitehall (2005) applied Markov regime switching models to the tourism area lifecycle data. Ismail and Isa (2006) compared the performance of the Self-Exciting Threshold Autoregressive (SETAR) model and the Markov switching autoregressive (MS-AR) model to fit the exchange rates of three ASEAN countries: Singapore, Malaysia, and Thailand. Based on the empirical results, they concluded that the MS–AR model best fits all the return series. To model the financial time series volatility, Markov regime switching generalized conditional heteroscedastic (GARCH) models have been applied by many researchers such as Cia, 1994; Gray, 1996; Klaasen, 2002; Haas, Mittnik and Paolella 2004; Marcucci, 2005; Alizadeh Nomikos and Pouliasis, 2008; Caporale and Zekokh, 2019, etc. Due to the importance of Markov regime switching models, the applications of these models is increasing recently. However, there is still little work on regime switching models. In this study a trial is made to utilize the characteristics of the MRS models to forecast the gold prices in Pakistan. 3. Data and Methodology Our study is related to secondary data of monthly gold prices in PK RS per troy ounce in Pakistan which is collected from the website www.indexmundi.com. The data cover 289 observations from January 1995 to January 2019, out of these total observations, 268 observations are used for estimation purpose and the remaining are used for forecasting purposes. Excel, EViews 9 and Minitab statistical software are used for analysis purposes. The methodology adopted in this study consists of the following steps 1. Graphical representation of the data 2. Stationarity checking by means of ACF and PACF and Dickey and Fuller Unit test. Heteroscedasticity and nonlinearity testing by means of CUSUM and CUSUM squared and LM- ARCH test. 3. Modeling and forecasting applying Markov regime switching autoregressive model. 4. The diagnostics of the residuals are checked by means of:  The correlogram of the ACF, PACF and Ljung Box Q-test by Box and Ljung (1979) of the residuals to check the independence of the residuals  The correlogram of the ACF, PACF and Ljung Box Q-test of the squared residuals to check the heteroscedasticity of the residuals. 5. Forecast evaluation by means of RMSE (Root mean Square Error), MAE (mean absolute error), MAPE(mean absolute percentage error) and Thiel-U inequality. The models applied in this study are discussed in the following Subsections 3.1 Autoregressive Model The autoregressive model of order m denoted by AR(m) is given as Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 312 (1) Where ~ N(0, ). For the identification of the order of AR models, ACF and PACF have been applied. 3.2 Markov Regime-Switching Autoregressive Model In a Markov regime switching model, all or some of the parameters switch from one regime or state to another under Markov Process governed by state variable, denoted by t S (Marcucci, 2005). The state variable t S follows a first order Markov chain with transition probabilities P( jS t  | ) = ijp (2) Indicating the probability of transition of the process from state i at time t-1 to state j at t (Hamilton, 1989). For two state processes the transition matrix of constant transition probabilities may be given as:                qp qp pp pp P 1 1 2212 2111 (3) The two state Markov regime switching autoregressive process of order m can be described as. Yt { (4) Where ~ N(0, The expected duration that a system stays in the ith regime is the function of transition probabilities. Let Di be the number of periods, the system stays in state i, then the probability that the system remains in state i under the chain rule and Markov property, l periods is given as P(Di = l ) = (5) and the expected duration of state i is E (D) = ∑ (6) 3.3 Estimation The likelihood function for a given sample consisting of T observations, , , …, may be obtained as L( = ∏ ∏ ∑ (7) where is standard normal distribution conditional on the information set the set of all past observations on and be the vector of the parameters to be estimated which consisting of mean parameters, the regime process parameters and variance parameters. Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 313 The corresponding log likelihood function is l( = ∑ ∑ (8) which may be maximized concerning . The evaluation in (8) recursively involves the following steps: 1. Obtain the one-step-ahead predictions of the regime probabilities as: = ∑ = j | (9) 2. Next, form the one step ahead densities of the data in each regime using the probabilities in step one. (10) 3. Obtain the marginal density ∑ (11) 4. Find the filter probabilities ∑ All these steps are repeated successively for the entire sample. But to start the process the initial values of is required. In literature, unconditional probabilities of St for two states are suggested by Hamilton (1999). Then the log likelihood function may be generated as given in equation (8). The estimates of the parameters may be obtained by maximizing this function using the standard process. 4. Results and Discussion The plot of the gold price series is presented in Figure 1. It is obvious that from 1995 to 1999 the gold prices are stable. From 2002 to 2004 is a slight upward change but afterward, a continuous rapid increase can be seen up to 2011. Some variation with no trend can be seen between 2012 and 2013 and some increase and decrease can be observed. Overall, the pattern of the series seems to be nonstationary. Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 314 0 40,000 80,000 120,000 160,000 200,000 96 98 00 02 04 06 08 10 12 14 16 18 Figure 1: Gold Price Series We have transformed the price series by taking its log to reduce the variability depicted in the data. Figure 2 shows the log price series denoted by , showing a similar pattern as the price series with a smaller variation. 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 96 98 00 02 04 06 08 10 12 14 16 18 Figure 2: Log of gold Price Series To test the stationarity of the log series, we have applied the augmented Dickey Fuller test and the results are given in Table 1. Null hypothesis of the unit root is accepted indicating the non- stationarity of the series. Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 315 Table 1: Unit Root Test Results t-Statistic Prob.* Augmented Dickey-Fuller test statistic -0.130288 0.9437 Test critical values at the level: 1% -3.452911 5%l -2.871367 10% -2.572078 To investigate the characteristics of the data set, we have regressed the series on constant and obtained the residuals. The results reported in Table 2, for the LM-ARCH test to check the heteroscedasticity exhibits the conditional heteroscedasticity of the residuals series. Table 2: Heteroscedasticity Test: ARCH The correlogram of ACF and PACF of the residuals and squared residuals along with Ljung Box Q-test results are given in Figure 3 and Figure 4 respectively. These results demonstrate that the residuals are autocorrelated showing the nonstationarity of the data. Furthermore, conditional heteroscedasticity can also be observed in Figure 2. Under these conditions simple AR model seems to be inappropriate to model this series as these models are suitable under the assumption of stationarity and homoscedasticity. This leads to apply some sort of nonlinear models to handle this problem. F-statistic 3432.404 P-value F(5,278) 0.0000 Obs*R-squared 279.4729 P-value 0.0000 Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 316 Figure 3: Correlogram of the Residuals Figure 4: Correlogram of the Squared Residuals -100 0 100 200 300 400 96 98 00 02 04 06 08 10 12 14 16 18 CUSUM 5% Significance Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 317 Figure 5: Cusum Plot of the Residuals -0.2 0.0 0.2 0.4 0.6 0.8 1.0 1.2 96 98 00 02 04 06 08 10 12 14 16 18 CUSUM of Squares 5% Significance Figure 6: Cusum Plot of the Squared Residuals Figure 5 and Figure 6 represent the plots of the cusum and cusum squares of the residuals which are outside the significant limits showing structural breaks in the series and the variance. So it is also confirmed that the simple linear AR models are not suitable to model and forecast this series. After achieving the justification of the application of nonlinear models to the log price series we have applied regime switching AR (MRS-AR) with different orders and check the diagnostics. During this process, it is found that the ACF is significant at lag 11, so the AR term at lag 11 has been included in the model along with initial orders. It is surprising that for each model the ACF and PACF of squared residuals remained insignificant at each lag with a high p-value showing no conditional heteroscedasticity is left in the series. The estimation results of the model satisfying all the diagnostics are reported in Table 4. This is a partial regime switching model in which the constant parameter and for i =1, 2 switch across regimes. But the coefficients of the autoregressive terms at lag 2 and 11 are nonswitching parameters denoted by and . In other words, the selected model is partially regime switching in which some of the parameters switch across regimes and some do not. It is obvious by Table 4, that the coefficient of first order autoregressive term and log of the standard deviation in each regime is highly significant. However, the constant parameter in both regimes is insignificant. The variance in each regime is very small. The non-switching parameters are also highly significant with a p-value equal to zero. Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 318 Table 4: Markov Regime Switching AR Model - Estimation Results Variable Coefficient Std. Error z-Statistic Prob. Regime 1 0.040191 0.115226 0.348801 0.7272 0.998321 0.010309 96.83633 0.0000 Log( ) -3.089229 0.133701 -23.10551 0.0000 0.002074 Regime 2 0.033581 0.047396 0.708517 0.4786 0.996958 0.004860 205.1365 0.0000 Log( ) -3.565029 0.085006 -41.93833 0.0000 0.000801 Common -0.185074 0.076953 -2.405015 0.0162 0.174410 0.064946 2.685466 0.0072 Transition Probabilities Constant Expected Duration Regime 1 Regime 2 20.56045 38.38149 The value of the transition probabilities also shows that the regime switching in the process is important. Expected duration of the system in regime 1 is approximately 21 months and in regime 2, it is 38 months approximately. The predicted filtered regime switching probabilities of the selected model are displayed in Figure 7 also confirming that the regime switching is significant. Regime 1 2 1 0.951363 0.048637 2 0.026054 0.973946 Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 319 0.0 0.2 0.4 0.6 0.8 1.0 96 98 00 02 04 06 08 10 12 14 16 Regime 1 0.0 0.2 0.4 0.6 0.8 1.0 96 98 00 02 04 06 08 10 12 14 16 Regime 2 Filtered Regime Probabilities Figure 7: Filtered Regime Switching Probabilities Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 320 Figure 8: Correlogram of the Residuals of the Estimated Model Figure 9: Correlogram of the Squared Residuals of the Estimated Model Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 321 Figure 8 and Figure 9 display the correlogram of the residuals and squared residuals respectively demonstrating that the residuals are independent and there is no conditional heteroscedasticity in the residuals. The ADF test results to test the stationarity of the residuals are given in Table 5. The ADF test-statistics is more negative than the critical value at 1% level of significance showing that the residuals are stationary. It is worthwhile to note that the response variable was nonstationary and after fitting a Regime switching model the residuals become stationary indicating that regime switching models are also suitable even in case nonstationary time series. Table 5: Unit Root Test of the Residuals t-Statistic Prob.* ADF test statistic -15.07555 0.0000 Test critical values at the level 1% -3.456197 5% -2.872811 10% -2.572851 4.1 Forecast Evaluation The diagnostic checks of the fitted regime switching autoregressive model showed the suitability of the model for forecasting. The forecasts of the fitted models are obtained for the period from Jan, 2017 to Jan 2019 based on the estimated model. To assess the forecasting suitability of the estimated model, the forecasts are evaluated on the basis of loss functions, RMSE, MAE, MAPE and Thiel U inequality (for specification see Pasha, Qasim and Aslam, 2007) and the results are given in Table 6. The small values of these loss functions demonstrate that the forecasted values are close to the actual values showing the suitability of the fitted model. Moreover, it is also confirmed by the plot of the forecast and actual values displayed in Figure 10. Table 6: Forecast Evaluation Loss Function Value RMSE 0.03104 MAE 0.02594 MAPE 0.21825 Thiel-U 0.00131 Figure 10: Comparison of Forecast and Actuality 11.4 11.6 11.8 12 12.2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Forecast Comparison: Actuals VS Forecasts Actual Forecast Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 322 5. Conclusion and Recommendations In this study, the Markov Regime switching autoregressive model is applied to estimate and forecast the monthly gold prices from Jan 1995 to Jan 2019 in Pakistan. Initial analysis of the selected data set exhibits nonstationary, autoregressive conditional heteroscedasticity and structural changes. This justified the use of the Markov regime switching model. A large number of two state MRS-AR have been fitted to the given data and the final model is selected fulfilling the diagnostics. All the switching and common autoregressive coefficients are found to be significant. High transition probability shows the regime switching is mattered. It is worthwhile to note that the regime process removes the nonstationarity as well as the conditional heteroscedasticity. The forecasting performance of this model also justified the importance of regime switching models. Based on this study and literature review, it strongly recommended the use of regime switching models in other fields of life. Moreover, for suitable forecasting, the use of these models may further be extended with non-normal distributions. The performance MRS-AR models may also be compared with GARCH-type models. References Abdullah, L. (2012). ARIMA Model for Gold Bullion Coin Selling Prices Forecasting. International Journal of Advances in Applied Sciences 1(4):153-158. Adejumo, O.A., Albert, S. and Asemota, O.J.(2020). Markov Regime-Switching Autoregressive Model of Stock Market Returns in Nigeria. CBN Journal of Applied Statistics, 11(2), 65-83. Akhtaruzzaman, M., Boubaker, S., Lucey, B. M., & Sensoy, A. (2020). Is gold a hedge or safe haven asset during COVID–19 crisis? Economic Modeling, 102, 1-26. Alizadeh, A.H., Nomikos, N.K., Pouliasis, P.K., (2008). A Markov regime switching approach for hedging energy commodities. Journal of Banking & Finance, 32(9) 1970–1983.Bahrami Moghadam, S., & Baghernia, N. (2020). The Political Economy of Gold in Geo-Economic Evolving Conditions. Geopolitics Quarterly, 16(60), 209-233. Bakhsh, R. P., & Khan, B. (2019). Interdependencies of Stock Index, Oil Price, Gold Price and Exchange Rate: A Case Study of Pakistan. International Journal of Experiential Learning & Case Studies, 4(2). Cai, J. (1994). A Markov Model of Unconditional Variance in ARCH. Journal of Business and Economic Statistics, 12, 309-316. Caporale. G.M and Zekokh. T (2019). Modelling volatility of cryptocurrencies using Markov- Switching GARCH models. Research in International Business and Finance 48 , 143–155. Davis R, Dedu V K, Bonye F (2014). Modeling and Forecasting of Gold Prices on Financial Markets. American International Journal of Contemporary Research, 4, 107-113. Gray, S. F. (1996). Modeling the Conditional Distribution of Interest Rates as a Regime-Switching Process. Journal of Financial Economics, 42, 27-62. Guha, B., & Bandyopadhyay, G. (2016). Gold price forecasting using ARIMA model. Journal of Advanced Management Science, 4(2). Haas, M, Mittnik, S, and Paolella, S.M.(2004). A New Approach to Markov- Switching GARCH Models. Journal of Financial Econometrics, 2, 493-530. Hamilton, J. D. (1989). A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle. Econometrica, Vol. 57, No. 2, 357-384. Ismail, M.T., and Isa, Z.(2006). Modeling Exchange Rates Using Regime Switching Models. Sains Malaysiana, 35(2), 55-62. Ismail, Z., Yahya, A., & Shabri, A. (2009). Forecasting gold prices using multiple linear regression Review of Economics and Development Studies, Vol. 7 (3) 2021, 309 - 323 323 method. American Journal of Applied Sciences, 6(8), 1509. Khaemasunun, P., (2009). Forecasting Thai gold prices. Available from http://www.wbiconpro.com/3-Pravit-.pdf. Khalid, M., Sultana, M., & Zaidi, F. (2014). Forecasting Gold Price: Evidence from Pakistan Market. Research Journal of Finance and Accounting, 5(3), 70-74. Khan M M (2013). Forecasting of Gold Prices (Box Jenkins Approach). International Journal of Emerging Technology and Advanced Engineering 3(3):662-670. Klaassen, F. (2002). Improving GARCH Volatility Forecasts. Empirical Economics 27, 363-394. Marcucci, J. (2005). Forecasting Stock Market Volatility with Regime-Switching GARCH Models. Studies in Nonlinear Dynamics & Econometrics, 9(4), 1-55. Massarrat, A.K.M., 2013. Forecasting of gold prices (Box Jenkins Approach). International Journal of Emerging Technology and Advanced Engineering, 3(3): 662-670. McKay, D. R., & Peters, D. A. (2017). The midas touch: gold and its role in the global economy. Plastic Surgery, 25(1), 61-63. Moore, W. and Whitehall, P. (2005). The Tourism Area Lifecycle and Regime Switching Models. Annals of Tourism Research, 32(1), 112-126. Salisu, A. A., Raheem, I. D., & Ndako, U. B. (2020). The inflation hedging properties of gold, stocks and real estate: A comparative analysis. Resources Policy, 66, 101605. Shabbir, A., Kousar, S., & Batool, S. A. (2020). Impact of gold and oil prices on the stock market in Pakistan. Journal of Economics, Finance and Administrative Science. Shafiee, S. and Topal, E. (2010). An overview of global gold market and gold price forecasting. International Journal of Minerals Policy and Economics, 35(3): 178-189. Sujit, K.S. and Kumar, B.J. (2011). Study on dynamic relationship among gold price, oil price, exchange rate and stock market returns. International Journal of Applied Business and Economic Research, 9(2): 145-165. Tripathy N (2017). Forecasting Gold Price with Auto Regressive Integrated Moving Average Model. International Journal of Economics and Financial, 7, 324-329. Trück, S., & Liang, K. (2012). Modelling and forecasting volatility in the gold market. International Journal of Banking and Finance, 9(1), 48-80. Zhu, Y., Fan, J., & Tucker, J. (2018). The impact of monetary policy on gold price dynamics. Research in International Business and Finance, 44, 319-331. http://www.wbiconpro.com/3-Pravit-.pdf