Volatility Analysis of Exchange Rate with Correlated Errors: A Sliding Data Matrix Approach

The main objective of this study is to propose a method of analysing the volatility of a seemingly random walk time series with correlated errors without transforming the series as performed traditionally. The proposed method involves the computation of moving volatilities based on sliding and cumulative data matrices. Our method rests on the assumption that the number of subperiods for which the series is available is the same for all periods and on the assumption that the series observations in each subperiod for all the periods under consideration are a random sample from a particular distribution. The method was successfully implemented on a simulated dataset. A paired sample t-test, Wilcoxon signed rank test, repeated measures (ANOVA), and Friedman tests were used to compare the volatilities of the traditional method and the proposed method under both sliding and cumulative data matrices. It was found that the differences among the average volatilities of the traditional method and sliding and cumulative matrix methods were insignificant for the simulated series that follow the random walk theorem. The implementation of the method on exchange rates for Canada, China, South Africa, and Switzerland resulted in adjudging South Africa to have the highest fluctuating exchange rates and hence the most unstable economy.


Introduction
A random walk is a statistical phenomenon where a variable follows no discernible trend and moves seemingly at random. This phenomenon was originally attributed to stock market prices. According to Fama [1], in an efficient stock market, prices should follow a random walk process, where future price changes are random and consequently unpredictable. Phanrattinon et al. [2] posited that for an efficient market, investors may make investments based on shortterm movements and not by applying the technical method, which is based on historical data.
Random walk hypothesis research has been done on many stock markets across the world for both developed and emerging economies. These include markets in Asia [2][3][4][5], Middle East [6][7][8], Eastern Europe [9], Africa [10,11], South America [11,12], etc. The results of these researches are mixed. For example, Phanrattinon et al. [2] found that the stock index returns of China, Indonesia, Korea, and Thailand follow random walk theory while those of Australia, Hong Kong, and Singapore do not. Also, Hoque et al. [13] found the markets of Taiwan and Korea to be inefficient while those of Hong Kong, Indonesia, Malaysia, Philippines, and Singapore were found to be efficient. Though the theory of random walk was originally associated with market returns, many other time series data also exhibit the random walk characteristics.
Charles and Darné [14] conclude that macroeconomic aggregates like exchange rate, gross domestic product, and gross national product data are better modelled as random walk processes rather than stationarity trends. The assumptions of random walk theory postulate that each random variable that obeys a random walk property has the same probability and is independent of every other random variable. Most time series that seem to exhibit random walk violate some or all the assumptions above; this leads to the transformation of such series by researchers.
There is a great deal of literature on series transformation, Salles et al. [15] reviewed the nonstationary methods of time series transformation. Nachane and Clavel [16] also explored several methods of statistical analysis on nonstationary time series. Rahimi et al. [17] also explored a semisupervised regression algorithm that learned to transform one time series into another time series. Other researchers such as Tommaso and Helmut [18] questioned the effectiveness of series transformation. However, series transformation just like any other form of transformation leads to loss of information, bias estimates, and complex interpretation of results [19,20].
There is little or no study to the best of our knowledge that focuses on finding a way to use a seemingly random walk time series data when the error terms are serially correlated other than the conventional way of series transformation. The aim of this research is to propose a novel method for estimating the volatility of serially correlated errors without transforming the data.
The rest of the paper is organised as follows: Section 2 presents the methods and materials which consist of the theoretical framework. This section also provides details of the-orems and corollaries upon which the proposed method is based. Specification of the proposed method and results of the implementation of the proposed method on simulated data are also presented. Section 3 presents the results of the implementation of the proposed method on empirical data. Finally, Section 4 provides discussions and conclusions emanating from the results, and recommendation for future research direction is also presented.

Materials and Methods
This section of the paper involves theoretical framework, model specification, and results of the implementation of the proposed method on simulated data.

Theoretical Framework.
In this subsection, the theorem and some corollaries which form the basis of the methodology for monitoring volatility of a series (e.g., returns) are presented. Theorem 1. Suppose X = ðX 1 , X 2 , ⋯, X m Þ is a random vector of m components with covariance matrix Σ = ðσ ij Þ m×m : Then, the standard error σ X sum of the sum X sum = ∑ m i=1 X i of the components of X is given by where σ ii = σ i 2 , i = 1, 2, ⋯, m: where a is a column vector of m components each of which is unity (one).
Hence, the required result Proof. The proof is trivial by substituting σ i 2 = σ 2 for i = 1, 2, ⋯, m and σ ij = υ for all i ≠ j in Equation (1).

Corollary 3.
If the components of X are independent but not identically distributed, then Proof. Again, the proof is trivial by substituting σ ij = 0 for all i ≠ j in Equation (1).

R Codes
Proof. The proof is clear by substituting υ = 0, in Equation (2).

Model Specification.
The paper assumes that the number of subperiods (e.g., days, months, or quarters) for which the time series is observed is the same for all periods (e.g., months and years) for this proposed methodology. Furthermore, the observations of the series at a particular period for all the years under consideration are assumed to be a random sample from a particular distribution. It is also assumed that all distributions may be independent or not. Thus, by letting X ij represent the observed value of the series at period jðj = 1, 2, ⋯, gÞ in year iði = 1, 2, ⋯, nÞ with g and n representing the number of periods (days/months) in a month (year) and number of months (years) under consideration, respectively, we have a data matrix M given as where for each j = 1, 2, ⋯, g, X j = ½X nj , X n−1j , ⋯, X 1j T is considered a sample from a given distribution. From matrix M, the paper suggests the construction of two kinds of subdata matrices, the moving data matrices and the cumulative data matrices. The first kind is n − l + 1 moving (sliding) data matrices of length l denoted by M k and given as where X k j = ðX l+k,j , X l+k−1,j , ⋯, X 1+k,j Þ T , j = 1, 2, ⋯, g.
The second kind is also n − l + 1 cumulative data matrices of length k denoted by M k * given as where Suppose S k ðk = 0, 1, ⋯, n − lÞ is the unbiased estimate of the covariance matrix, based on M k of the random vector X = ðX 1 , X 2 , ⋯, X g Þ T , where X j ðj = 1, 2, ⋯, gÞ have the same distribution as the population from which the series for the i th period in all the years under consideration. Then, based on the theorem, the paper proposes an l length moving volatility of the series to be defined as   Alternatively, if S k * ðk = l, l + 1, ⋯, nÞ is the unbiased estimate of the covariance matrix based on M k * of the random vector X defined previously, then the proposed cumulative volatility of the series is given by where a is as defined previously. Based on the matrices M k and M k * , the bootstrap confidence intervals can be constructed for σ k and σ k * , respectively.
If X ij 's are investment returns, then moving standardized rates (based on sliding and cumulative data matrices) can be computed, respectively, as follows: where where X k * = 1/g∑ g j=1 X kj with R k being the low-risk return for years l + k and k, respectively, for Equations (10) and (11). Bootstrap confidence intervals of q k and q k * may also be constructed for each k under the two situations. The standardized rates so specified are the same as the Sharpe ratio under certain distributional and dependency conditions. The use of these rates were not considered in this study.
Equations (8) to (11) are with reference to a time series X t , which is governed by the model: On the other hand, if the series X t is governed by the model then Equations (8) to (11), respectively, become where all the symbols as previously defined but the data matrices M,M k , and M k * consist of the first differences of the series X t .

Simulation.
Let us defineσ l+k ðk = 0, 1, 2, ⋯, n − lÞ to be the standard deviation of the series X l+k,1 , X l+k,2 , ⋯, X 1+k,g (which in this case are the consecutive differences in a random walk) in year l + k andσ k to be the square root of the sum of the diagonal elements of the covariance matrix S k in Equation (8) based on the sliding matrix M k of the consecutive differences of a random walk series. For a random walk series with independent and identically distributed errors, an insignificant paired sample t-test of the pairs ð g 1/2 e σ l+k ,σ k Þ,k = 0, 1, 2, ⋯, n − l, will lead to the proposed method as a step in the right direction. Another advantage of the proposed method is that there is a possibility for the estimation of the covariances among the error terms in situations of dependent random errors in a random walk series. This saves the trouble of transforming a random walk series with dependent errors before analysis. Similar test results based on the pairs ðg 1/2 σ k * ,σ k * Þ, k = l, l + 1, ⋯, n, also support the same position, where σ k * denotes the standard deviation of the series X k,1 , X k,2 , ⋯, X k,g in year k andσ k * denotes the square root of the sum of the diagonal elements of the covariance matrix S k * in Equation (9) based on the   In view of the above premise, a sample of 4800 random walk error series was simulated which resulted in a data matrix of order 240 by 20 observations, based on the assumption that the series covers 240 years (n) each of 20 periods (g) with l = 13. The paired sample t-test was then carried out to investigate whether the volatilities of the random walk series for the sliding and cumulative matrices M k and M k * , respectively, are the same or not. The R codes for the computations are attached as Pseudocode 1. Table 1 presents descriptive statistics and the paired sample t-test (parametric) and Wilcoxon signed rank test (nonparametric) of the traditional and proposed methods. It is observed from Table 1 that the annual volatilities based on the existing (traditional) method ranges from 0.1765 to 0.4094 with a standard deviation of 0.0419. However, the annual volatilities based on the proposed method for the sliding and cumulative data matrices range from 0.2464 to 0.3087 and 0.2748 to 0.2863, respectively, with correspond-ing standard deviations of 0.0128 and 0.0025, respectively. The average volatility for the three approaches is approximately 0.28 (0.28 to two decimal places). This is an indication that the volatilities based on the existing method and the proposed method under sliding and cumulative data matrices are approximately the same on average. The paired sample t-tests and the Wilcoxon signed rank tests compared the annual volatilities based on the existing and proposed method using the sliding and cumulative matrices. The two tests recorded p values greater than a significance probability of 0.05. This implies that, on average, the annual volatilities based on the existing and the proposed methods are equal and indicate that the proposed method is a step in the right direction.
The study continued to investigate whether there is a significant difference among the average volatilities when the three methods are considered in a single test: repeated measures ANOVA test (parametric) and Freidman test (nonparametric). Table 2 displays the results for the two tests comparing the average volatilities of the three methods of calculating the volatilities: traditional, sliding matrix, and cumulative matrix methods. Both tests produced p values greater than any significance probability (p = 0:713 and p = 0:734). This implies that there is no significant difference among the averages of volatilities of the three methods at any significance level. Hence, the Friedman and ANOVA tests confirmed the results obtained from the paired sample t-test and Wilcoxon test. Figure 1 shows the pictorial display of the distribution of the volatilities for the three computational methods, namely, traditional, sliding matrix, and cumulative matrix. It is observed that the mean volatilities are approximately the same for all the three methods. It is observed that the traditional computation method showed slightly higher volatilities than the proposed methods: sliding and cumulative matrices.
It can be inferred from the results that the estimates of volatility by the proposed method are approximately equal on average and are similar to those of the existing method (traditional), irrespective of the type of data matrix (sliding or cumulative) considered. The findings from Table 1 support our position that for a series X t , governed by the model where the error terms ε t are not independent, one can use either Equation (12) or (13) on the first difference of the data to estimate the volatility of the series without transforming the series to satisfy the conditions of random walk. However, the results of serial correlation analysis for the first difference may determine whether the covariance matrices S k and S k * of Equations (8) and (9) should be diagonal or not. Here, the data matrix M consists of the first difference of the series X t . Secondly, a series X t , governed by the model where μ is a constant and ε t is the error term, may be    Journal of Applied Mathematics mutually independent or not. One may use Equation (8) or (9) for the series X t to estimate the volatilities. However, the results of serial correlation analysis of the series X t may also determine whether the covariance matrices S k and S k * of Equations (8) and (9) should be diagonal or not, where the data matrix M, in this case, consists of the series X t .

Results from Empirical Data
To apply the proposed method to an empirical situation, data on exchange rates were obtained from the Federal Reserve Economic Data (FRED) for China, South Africa, Canada, and Switzerland. These data consist of daily exchange dollar rates of each country spanning the years 2000 to 2020. The logarithmic growth rates were computed over the period for each country. Descriptive statistics for the exchange and growth rates of each country are presented in Table 3.
It is observed from Table 3 that for the period under investigation, Canada has the highest mean exchange rate of 9.67 and a median of 8.28 with rates ranging from 5.12 to 19.04. South Africa follows with an average rate of 7.19 and a median of 6.88, while the exchange rates range from      Journal of Applied Mathematics 6.04 to 8.28. Furthermore, Switzerland recorded an average rate of 1.14 and a median rate of 1.0, and the rates generally range from 0.73 to 1.83. Finally, the China exchange rate recorded an average rate of 1.23 and a median rate of 1.25 while the minimum and the maximum rates are 0.92 and 1.61, respectively. These show that Canada was saddled with high exchange rates over the period and recorded a rate as high as 19.04 in at least one of the months while China recorded the least exchange rates.
However, in the case of growth rates of the exchange rates, it was observed that Switzerland recorded the highest average reduction (-0.0108) in the exchange rate, followed by South Africa (-0.0036), then China (-0.0018). In addition, Canada recorded an average increase of 0.0186 in exchange rates and has the worst performance over the period despite recording a maximum reduction rate above 9 percent.
The line plots were obtained for the exchange rates and the growth rates for each country to investigate the method that best described the data. Figure 2 presents the pictorial view of the exchange rates over the period under study while Figure 3 presents time series plots of the growth rates.
It is apparent from Figure 2 that the exchange rate time series plots for all the four countries seemingly exhibited the random walk property, and hence, the first differences of the series were computed. However, an augmented Dickey-Fuller test for random walk property of the series for the four countries is presented in Table 4. It is observed from Table 4 that the ADF test for all the four country series produced p values greater than any significance probability (p > 0:05). Therefore, it is concluded that the series for the four countries considered obeys the random walk theory as observed pictorially in Figure 2.
The presence of serial correlation for each country exchange rate was tested to determine whether to use only the diagonal elements of the moving covariance matrices or not, as stated in Equation (12). However, from Figure 3, the time series plots of the growth rates depicted stationary behaviour. So, the serial correlation analysis was performed on the growth rates to investigate dependency among the errors. The results of the tests for serial correlation in the exchange rates and growth rates are presented in Table 5.
The results of Table 5 show that the tests for the presence of serial correlation in the difference of exchange rates for China and Switzerland are significant at a 5 percent significance level. This indicates a dependence among error terms because the corresponding p values are less than 0.05 (p < 0:001 and p = 0:0304, respectively). The growth rates for China also recorded a significant presence of serial correlation at a 5 percent significance level with a p value less than 0.001. Hence, for these three series, all the elements in the estimates of the moving covariance matrices were used in computing the moving volatilities according to Equation (12). However, the growth rates for Switzerland and the first difference in exchange rates and growth rates for South Africa and Canada recorded insignificant presences of serial correlation, hence leading to the use of only the diagonal elements of the estimated moving covariance matrices in computing the moving volatilities. Table 6 shows descriptive statistics for 240 moving volatilities (monthly moving vola-tilities from January 2000 to December 2020) for exchange rates and growth rates for all the countries under study. Figures 4 and 5 display the plots of the moving exchange rates and growth rate volatilities, respectively.
It is revealed from Table 6 that the average volatility for China over the period was 0.0361 with an average growth rate of 0.5346. Though China recorded the second-highest average volatility, it is observed to produce the smallest average growth rate among the four countries considered. South Africa recorded the highest average volatility (0.4448) and average growth rate of 4.5139 over the period of the study. Canada and Switzerland recorded approximately the same average volatility but have a slight difference in their average growth rates over the study period. The maximum volatility was recorded by South Africa (0.8512) and was followed by China (0.1134). However, the minimum volatility was recorded by China (0.0001). Furthermore, the maximum growth rate was recorded by South Africa (7.6505) and was followed by Switzerland (5.4387).
The trend behaviour of the volatilities of the exchange rates for the four selected countries, China, South Africa, Switzerland, and Canada, is presented in Figure 4. It is observed from Figure 4 that the volatility trend plot for South Africa was very volatile with much higher volatilities compared to the other three countries considered. It was revealed over the study period that the volatility for South Africa peaked at three different times, namely, the last quarter of 2002, the last quarter of 2009, and the last quarter of 2016. However, the other three countries show approximately the same pattern and have less volatile moving volatilities for exchange rates over the study period. China is observed to produce a little higher trend of volatility between the third quarter of 2013 and the third quarter of 2020. However, Switzerland and Canada showed approximately the same trend of volatility over the study period.
The trend analysis plots of the volatility growth rates for the four countries are displayed in Figure 5. The line graphs show that there are very high fluctuations over the entire study period and South Africa has higher growth rates than Switzerland, Canada, and China. It is interesting to note that South Africa, Switzerland, and Canada recorded maximum growth rates between May 2008 and September 2009. South Africa was observed to be more volatile, followed by Switzerland and then Canada in terms of growth rates over the period. China was observed to produce more stable and less growth rates over the entire period of the study. It is observed that as China's growth rates showed a progressive increase from 2013, Switzerland and Canada showed declining growth rates from 2016 to 2020.

Discussions and Conclusions
As indicated early on, the paper sought to develop a method of analysing the volatility of a seemingly random walk time series with correlated errors without transforming the series as done traditionally. We showed how to arrange a random walk series into a data matrix based on the assumption that the number of subperiods for which the series is available is the same for all periods. Secondly, the series observations in 8 Journal of Applied Mathematics each subperiod for all the periods under consideration is a random sample from a particular distribution. This led to the computation of moving volatilities based on sliding and cumulative data matrices. The method was successfully implemented on a simulated dataset. The paired sample t -test and the Friedman test were used to compare the volatilities of the traditional method and the proposed method under both sliding and cumulative data matrices. The traditional method was insignificantly different for the simulated series that follows the random walk theorem. The proposed method was also discussed for a seemingly stationary series. The proposed method was also used to compute moving volatilities of exchange rates and their growth rates for Canada, China, South Africa, and Switzerland. The paper used exchange rates because fluctuations in them have been found by several researchers across the world to have a significant relationship with key macroeconomic variables. According to Besnik et al. [21], exchange rate stability led to macroeconomic stability. Others have established a positive relationship between exchange rates and inflation [22][23][24], exchange rates, and international prices [25]. Similar relationships have been established globally including the UK [26,27], Sweden [26], Denmark, and Canada [26]. These go to buttress the point that a less volatile (more stable) exchange rate results in a more stable economy.
Based on the empirical data and the discussions in the previous paragraph, South Africa has a less stable economy as compared to the other countries since South Africa recorded highly fluctuating volatilities in exchange rates. Similar results are portrayed by the volatilities of exchange rates and growth rates with China having an edge over the rest.

Future Research
In view of this paper, recommendation is made on the application of the proposed method (including computation of the specified standardized rate) to other macroeconomic variables such as investment returns to compare stability and performance of stock markets across the world.

Data Availability
The exchange rate data used to support the findings of this study have been deposited in the Federal Reserve Economic Data (FRED) repository (https://fred.stlouisfed.org/ searchresults?st=exchange+rates).