EXERCISE ON COINTEGRATION
Transcription
EXERCISE ON COINTEGRATION
Hands-on-Session Market Integration, Price Discovery, and Volatility in Agricultural Commodity Futures P.Ramasundaram* and Sendhil R** *National Coordinator (M&E), National Agricultural Innovation Project (NAIP), Krishi Anusandhan Bhavan II, Pusa, New Delhi - 110 012, India. **Scientist, Directorate of Wheat Research, Karnal – 132001, Haryana, India. Cointegration: If a linear combination of two non-stationary time series data results in a stationary error term, then the two series are cointegrated Price Discovery: It is a continuous process of arriving at a price at which a person buys and another sells a futures contract (commodity) in a commodity exchange Volatility: Volatility is an uncertain movement of a random variable over time Steps in Cointegration Test 1. Collect the time series data 2. Convert to natural logarithm 3. Check the original time series for unit root test (Augmented Dickey Fuller or Phillips Perron) 4. Check the first differenced series for unit root 5. Run the cointegration test 6. For cointegrated series, run the error correction model 7. Interpret the coefficients Steps in GARCH Model 1. Collect the time series data 2. Convert to natural logarithm 3. Take first difference (2 and 3 can be performed as a single EVIEWS command) 4. Run ARIMA filtration analysis and find the AR value 5. Run GARCH (Trial and Error). Choose the best fit model 6. Interpret the coefficients A. Cointegration: Illustrated Example in EVIEWS When a time series model is estimated, the first thing to make sure is that either all time series variables in the model are stationary or they are cointegrated, which means that they are integrated of the same order and errors are stationary, in which case the model defines a long run equilibrium relationship among the cointegrated variables. Therefore, a cointegration test generally takes two steps. The first step is to conduct a unit root test on each variable to find the order of integration. If all variables are integrated of the same order, the second step is to estimate the model, also called a “cointegrating equation,” and test whether the residual of the model is stationary. The purpose of this exercise is to implement the cointegration test in EVIEWS and also estimate the error correction model. Hands-on-Session Spot and Futures Prices For this exercise time series data on wheat futures price (FP) of contract ending March 2010 and spot price (SP_Karnal) of Karnal market are used for illustrative purpose (www.ncdex.com). Since the fundamentals evolve over time, the prices changes over time. It may or may not be stationary (checked by unit root test). Date 10-Sep-09 11-Sep-09 12-Sep-09 14-Sep-09 15-Sep-09 16-Sep-09 17-Sep-09 18-Sep-09 19-Sep-09 21-Sep-09 22-Sep-09 23-Sep-09 24-Sep-09 25-Sep-09 26-Sep-09 28-Sep-09 29-Sep-09 30-Sep-09 1-Oct-09 3-Oct-09 5-Oct-09 6-Oct-09 7-Oct-09 8-Oct-09 9-Oct-09 10-Oct-09 12-Oct-09 13-Oct-09 14-Oct-09 15-Oct-09 16-Oct-09 17-Oct-09 19-Oct-09 20-Oct-09 21-Oct-09 22-Oct-09 23-Oct-09 24-Oct-09 26-Oct-09 27-Oct-09 28-Oct-09 29-Oct-09 30-Oct-09 31-Oct-09 2-Nov-09 3-Nov-09 4-Nov-09 5-Nov-09 FP 1234.80 1234.80 1198.00 1198.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1190.00 1220.20 1223.60 1192.40 1209.00 1236.00 1236.00 1249.20 1249.20 1249.20 1249.20 1249.20 1242.80 1242.80 1256.40 1276.60 1276.60 1276.60 1277.40 1305.20 1336.80 1349.00 1349.00 1349.00 1378.40 1352.20 1358.20 SP_Karnal 1132.50 1140.00 1137.50 1130.00 1132.50 1157.50 1130.00 1132.50 1130.00 1130.00 1135.00 1140.00 1135.00 1142.50 1125.00 1125.00 1130.00 1130.00 1135.00 1135.00 1140.00 1132.50 1132.50 1140.00 1142.50 1136.00 1167.50 1167.50 1135.00 1125.00 1200.00 1200.00 1200.00 1180.00 1165.00 1145.00 1260.00 1275.00 1250.00 1337.50 1300.00 1250.00 1305.00 1325.00 1325.00 1300.00 1300.00 1350.00 Log_FP 7.12 7.12 7.09 7.09 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.08 7.11 7.11 7.08 7.10 7.12 7.12 7.13 7.13 7.13 7.13 7.13 7.13 7.13 7.14 7.15 7.15 7.15 7.15 7.17 7.20 7.21 7.21 7.21 7.23 7.21 7.21 Log_SP_Karnal 7.03 7.04 7.04 7.03 7.03 7.05 7.03 7.03 7.03 7.03 7.03 7.04 7.03 7.04 7.03 7.03 7.03 7.03 7.03 7.03 7.04 7.03 7.03 7.04 7.04 7.04 7.06 7.06 7.03 7.03 7.09 7.09 7.09 7.07 7.06 7.04 7.14 7.15 7.13 7.20 7.17 7.13 7.17 7.19 7.19 7.17 7.17 7.21 Hands-on-Session 6-Nov-09 7-Nov-09 9-Nov-09 10-Nov-09 11-Nov-09 12-Nov-09 13-Nov-09 14-Nov-09 16-Nov-09 17-Nov-09 18-Nov-09 19-Nov-09 20-Nov-09 21-Nov-09 23-Nov-09 24-Nov-09 25-Nov-09 26-Nov-09 27-Nov-09 30-Nov-09 1-Dec-09 2-Dec-09 3-Dec-09 4-Dec-09 5-Dec-09 7-Dec-09 8-Dec-09 9-Dec-09 10-Dec-09 11-Dec-09 12-Dec-09 14-Dec-09 15-Dec-09 16-Dec-09 17-Dec-09 18-Dec-09 19-Dec-09 21-Dec-09 22-Dec-09 23-Dec-09 24-Dec-09 26-Dec-09 28-Dec-09 29-Dec-09 30-Dec-09 31-Dec-09 1-Jan-10 2-Jan-10 4-Jan-10 5-Jan-10 6-Jan-10 7-Jan-10 8-Jan-10 9-Jan-10 11-Jan-10 12-Jan-10 1353.60 1354.60 1335.20 1307.20 1336.80 1337.20 1317.60 1304.80 1324.20 1343.20 1361.80 1372.00 1357.60 1365.00 1365.00 1370.20 1351.20 1360.00 1358.80 1369.00 1355.20 1355.20 1361.40 1366.00 1367.60 1375.20 1358.00 1363.80 1339.20 1344.00 1342.40 1334.00 1297.40 1276.40 1279.00 1278.40 1297.60 1275.40 1270.80 1266.20 1280.00 1290.60 1284.80 1280.00 1286.00 1285.20 1278.40 1296.80 1291.60 1292.00 1294.00 1299.00 1313.40 1322.80 1327.80 1341.00 1400.00 1400.00 1400.00 1400.00 1412.50 1425.00 1400.00 1405.50 1405.50 1400.00 1400.00 1407.50 1400.00 1400.00 1400.00 1400.00 1390.00 1392.50 1400.00 1400.00 1395.00 1400.00 1390.00 1390.00 1390.00 1400.00 1400.00 1400.00 1400.00 1400.00 1400.00 1400.00 1400.00 1400.00 1400.00 1400.00 1400.00 1390.00 1390.00 1400.00 1370.00 1385.00 1390.00 1390.00 1385.00 1392.50 1395.00 1395.00 1375.00 1390.00 1387.50 1412.50 1400.00 1400.00 1370.00 1370.00 7.21 7.21 7.20 7.18 7.20 7.20 7.18 7.17 7.19 7.20 7.22 7.22 7.21 7.22 7.22 7.22 7.21 7.22 7.21 7.22 7.21 7.21 7.22 7.22 7.22 7.23 7.21 7.22 7.20 7.20 7.20 7.20 7.17 7.15 7.15 7.15 7.17 7.15 7.15 7.14 7.15 7.16 7.16 7.15 7.16 7.16 7.15 7.17 7.16 7.16 7.17 7.17 7.18 7.19 7.19 7.20 7.24 7.24 7.24 7.24 7.25 7.26 7.24 7.25 7.25 7.24 7.24 7.25 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.24 7.22 7.23 7.24 7.24 7.23 7.24 7.24 7.24 7.23 7.24 7.24 7.25 7.24 7.24 7.22 7.22 Hands-on-Session 13-Jan-10 14-Jan-10 15-Jan-10 16-Jan-10 18-Jan-10 19-Jan-10 20-Jan-10 21-Jan-10 22-Jan-10 23-Jan-10 25-Jan-10 27-Jan-10 28-Jan-10 29-Jan-10 30-Jan-10 1-Feb-10 2-Feb-10 3-Feb-10 4-Feb-10 5-Feb-10 6-Feb-10 8-Feb-10 9-Feb-10 10-Feb-10 11-Feb-10 12-Feb-10 13-Feb-10 15-Feb-10 16-Feb-10 17-Feb-10 18-Feb-10 19-Feb-10 20-Feb-10 22-Feb-10 23-Feb-10 24-Feb-10 25-Feb-10 26-Feb-10 27-Feb-10 1-Mar-10 2-Mar-10 3-Mar-10 4-Mar-10 5-Mar-10 6-Mar-10 8-Mar-10 9-Mar-10 10-Mar-10 11-Mar-10 12-Mar-10 13-Mar-10 15-Mar-10 16-Mar-10 17-Mar-10 18-Mar-10 19-Mar-10 1322.80 1325.40 1317.00 1310.60 1296.00 1291.80 1309.00 1295.80 1290.00 1295.20 1285.60 1278.40 1271.40 1279.20 1281.00 1285.00 1292.00 1285.80 1281.00 1286.00 1290.60 1284.00 1285.40 1282.80 1289.60 1289.60 1306.60 1304.20 1309.20 1320.40 1314.80 1312.80 1319.60 1286.60 1287.80 1275.00 1293.20 1290.80 1284.20 1284.20 1266.20 1263.80 1253.00 1260.40 1262.60 1241.60 1220.20 1224.80 1229.80 1234.00 1241.60 1260.00 1266.60 1271.80 1272.80 1279.40 1390.00 1400.00 1400.00 1400.00 1415.00 1407.50 1400.00 1407.50 1400.00 1425.00 1380.00 1400.00 1375.00 1385.00 1410.00 1385.00 1370.00 1385.00 1387.50 1385.00 1400.00 1370.00 1400.00 1390.00 1400.00 1400.00 1392.50 1385.00 1385.00 1387.50 1375.00 1400.00 1400.00 1385.00 1385.00 1370.00 1385.00 1362.50 1387.50 1387.50 1385.00 1385.00 1375.00 1375.00 1350.00 1345.00 1347.50 1320.00 1312.50 1305.00 1300.00 1315.00 1337.50 1300.00 1305.00 1300.00 7.19 7.19 7.18 7.18 7.17 7.16 7.18 7.17 7.16 7.17 7.16 7.15 7.15 7.15 7.16 7.16 7.16 7.16 7.16 7.16 7.16 7.16 7.16 7.16 7.16 7.16 7.18 7.17 7.18 7.19 7.18 7.18 7.19 7.16 7.16 7.15 7.16 7.16 7.16 7.16 7.14 7.14 7.13 7.14 7.14 7.12 7.11 7.11 7.11 7.12 7.12 7.14 7.14 7.15 7.15 7.15 7.24 7.24 7.24 7.24 7.25 7.25 7.24 7.25 7.24 7.26 7.23 7.24 7.23 7.23 7.25 7.23 7.22 7.23 7.24 7.23 7.24 7.22 7.24 7.24 7.24 7.24 7.24 7.23 7.23 7.24 7.23 7.24 7.24 7.23 7.23 7.22 7.23 7.22 7.24 7.24 7.23 7.23 7.23 7.23 7.21 7.20 7.21 7.19 7.18 7.17 7.17 7.18 7.20 7.17 7.17 7.17 Hands-on-Session In this exercise, unit root test and the integration between spot and futures prices are examined for the above dataset. 1. Collect the time series data. Save as a single sheet in Excel 2003 format for compatibility purpose. Recent versions of EVIEWS like EVIEWS 7 (Enterprise Edition) will take any excel extension. 2. Import the original data to EVIEWS just by dragging it to the software window or copy and paste or menu driven 3. Convert the original data to log values in excel and then import to EVIEWS or import the original data to EVIEWS and then convert to log values with the following command. Transform the SP into its natural log by Genr LSP = log(SP), and similarly transform FP also into its natural log and save the newly generated log variables. 4. Do the unit root test. The first step of testing cointegration is to test all the time series variables for stationarity. Therefore, conduct the augmented Dickey Fuller unit root test or Phillips Perron test on each of the series: LFP and LSP_Karnal, and verify that each of these series is integrated of order one. Check the graphs too. Hands-on-Session In the unit root test of levels, always include intercept and also time trend if the data has a trend. In the unit root test of first differences, include only the intercept Note: View – Unit Root Test – Choose the Option – OK 5. Now carry out the cointegration test. If two time series variables are nonstationary, but cointegrated, at any point in time the two variables may drift apart, but there will always be a tendency for them to retain a reasonable proximity to each other. There may be more than one cointegrating relationship among cointegrated variables. Johansen test provides estimates of all such cointegrating equations and provides a test statistic for the number of cointegrating equations.1 1 It is a likelihood ratio test statistic that Johansen test presents along with the critical values. Hands-on-Session Note: Open the Log Transformed Data – View – Cointegration Test - OK. A Johansen cointegration test window appears. Choose linear deterministic trend in data, select Intercept (no trend) in CE and test VAR2 (Option No. 3). Specify the appropriate number of lag intervals (1 1 in our case, i.e., 1 lag and 1 4 if the series is quarterly)3. Finally, if there is any truly exogenous variable it has to be specified, other than the intercept and the time trend, included in the model. In the present illustration there is no such exogenous variable; and therefore, do not enter any name for exogenous series. The Johansen test uses the VAR method, in which all cointegrated series are considered endogenous. Click OK to get the cointegration test result. In the very first table of this result, start from the first row and compare the likelihood ratio (LR) value or trace statistic with the 5 percent critical value. If the value exceeds the critical value, go down to the next row and compare the value with the critical value in that row. Repeat this process until you reach the row in which the trace statistic is lower than the critical value. Stop at that row; do not move down any further. The last column in this row gives you the number of cointegrating equations for the integrated variables, and at the bottom of this table, the conclusion of the test, as to how many cointegrating equations are indicated, is stated. Below the likelihood ratio test table, there would be a number of other tables. Only look for the table(s) that has normalized cointegrating coefficients, in which the coefficient of one of the two variables is normalized to one. There may be more than one table with normalized coefficients (in case of more than two variables). If the above mentioned LR test indicates one cointegrating equation, look at the first normalized coefficient table only. If the test indicates two cointegrating equations, look at the second normalized coefficient table, and so on. A normalized coefficient table presents the estimate of the model (cointegrating equation) with all variables taken to the left hand side. Below each coefficient estimate, the standard error is given within parentheses. The ratio of the coefficient to its standard error is the t-statistic. 2 The test allows a choice among three options regarding the deterministic time trend of data: no trend, linear trend and quadratic trend. Select the appropriate nature of trend. 3 The appropriate lag length may be decided through the AIC or SIC criterion. Hands-on-Session Estimation of Error Correction Model According to the Granger representation theorem, when variables are cointegrated, there must also be an error correction model (ECM) that describes the short-run dynamics or adjustments of the cointegrated variables towards their equilibrium values. ECM consists of one-period lagged cointegrating equation and the lagged first differences of the endogenous variables. Using the Vector Autoregression (VAR) method, ECM can be estimated. The model involves two nonstationary variables; therefore, ECM would be a simultaneous equation system of two equations, one for each variable describing the short run adjustment of that variable towards the long run equilibrium. The adjustment process may take a number of periods and thus each equation in the ECM will have lagged variables. It is important to include the appropriate number of lags. Note: Select the Variables - Open - as VAR. A new window on Vector Autoregression appears. Under VAR specification, click on Vector Error Correction, type in lag intervals 1 1 to allow for one period lag length, check that sample period is correct (if necessary, correct it), type in endogenous variables (which would be all the series in this illustration), type in any exogenous variable (none in this case, leave it blank), choose the trend in the cointegrating equation, as was done above for the Johansen test (VAR assumes linear trend in data: intercept (no trend in CE), type in the number of CE’s (1 in our case), and click OK.4 The ECM estimates will appear immediately. The first table presents the estimates of the cointegrating equation, and the second table presents the rest of the ECM. The first row in the second table presents the estimates of the speed of adjustment coefficient for each variable, their standard errors and the t-statistics. Present the results and interpret the coefficients. 4 See footnote three for the appropriate number of lags. Hands-on-Session B. GARCH: Illustrated Example in EVIEWS For this exercise, time series data on wheat spot price (SP_Karnal) of Karnal market is used for illustration. Since the economic fundamentals evolve over a period of time, prices tends to be volatile (random movement) over time which can be captured by the GARCH coefficients. Note: Import the variable (SP_Karnal) for which volatility has to be measured. Now select Quick – Estimate Equation from the menu. A new window will appear. Under Methods select ARCH, a new window will appear again and in that type the order of ARCH and GARCH coefficients. Type the dependent variable dlog(sp_karnal) in the space and then click OK to get the GARCH estimates. Run different models and choose the best model based on the AIC or LR criterion. Present the results and interpret the coefficients. Hands-on-Session Hands-on-Session Exercise for Trainees Table 1. Estimated ADF and PP statistic for unit root test in wheat Futures market price Test statistic Contract period st Level 1 difference ADF 10.09.09 to 19.03.10 PP Spot market price st Level 1 difference Order Note: * indicates significance at one per cent of MacKinnon (1996) one-sided p-values Table 2. Estimated AIC and SIC value for optimum lag length Criteria Contract period Value AIC SIC Order of lag length 10.09.09 to 19.03.10 Table 3. Estimates of Johansen’s cointegration test Eigen Contract period Correlation value Trace statistic Null hypothesis Log likelihood 10.09.09 to 19.03.10 Note: ***, ** and * denote the rejection of null hypothesis at 1, 5 and 10 per cent level of significance ^ indicates the significance of correlation coefficient at 1 per cent level of probability (2 tailed) Table 4. Estimates of vector error correction model Cointegration equation Contract period Constant Coefficient 10.09.09 to 19.03.10 (0.1704) Error correction estimates Futures price Spot price (0.0340) (0.0276) Note: Figures in parentheses indicate the standard error Table 5. Estimates of fitted GARCH model for wheat spot price Particulars Observations (days) Standard deviation C.V (%) GARCH estimates Estimates GARCH fit order Constant Estimates of ARCH term (αi) 2 t 1 2 t 2 2t 3 Estimates of GARCH term (βi) t21 t22 t23 Log likelihood αi + βi Volatility level Note: ** Significant at 1 per cent level of probability (z statistic) and * Significant at 5 per cent level of probability (z statistic) Hands-on-Session Suggested Readings Bollerslev, T. (1986). “Generalized autoregressive conditional heteroscedasticity”, Journal of Econometrics, 31: 307-327. Dickey, D and Fuller, W.A. (1979). “Distribution of the estimators for autoregressive time series regressions with unit roots”, Journal of American Statistical Association, 74: 427-431. Easwaran, S.R., and Ramasundaram, P., Whether the Commodity Futures in Agriculture are Efficient in Price Discovery? - An Econometric Analysis. Agricultural Economics Research Review, 2008, 21, 337-344. Engle, R.F and Granger, C.W.J. (1987). “Cointegration and error-correction: Representation, estimation and testing”, Econometrica, 55: 251-276. Engle, R.F. (1982). “Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation”, Econometrica, 50(4), 987-1007. Fackler, P. (1996). “Spatial Price Analysis: A Methodological Review”, Mimeo.North Carolina State University. Garbade, K.D and Silber, W.L. (1982). “Price movements and price discovery in future and cash markets”, Review of Economics and Statistics, 65: 289-297. Garbade, K.D and Silber, W.L. (1983). “Dominant satellite relationship between live cattle cash and futures markets”, The Journal of Futures Markets, 10(2): 123-136. Goodwin, B.K and Schroeder, T.C. (1991). “Cointegration tests and spatial price linkages in regional cattle markets”, American Journal of Agricultural Economics, 73: 452-64. Granger, C. (1981). “Some properties of time series data and their use in econometric model specification”, Journal of Econometrics, 16: 121-130. Guida, T and Matringe, O. (2004). Application of GARCH models in forecasting the volatility of Agricultural commodities, UNCTAD Publications. Johansen, S. (1988). “Statistical analysis of cointegration vectors”, Journal of Economic Dynamics and Control, 12: 231-254. Johansen, S. (1991). “Estimation and hypothesis testing of cointegration vectors in Gaussian vectors auto regression models”, Econometrica, 59: 1551-80. Johansen, S. (1994). “The role of the constant and linear terms in cointegration analysis of nonstationary variables”, Econometric Reviews, 13: 205-229. Johansen, S. (1995). Likelihood-based interference in cointegrated vector autoregressive models. Oxford: Oxford University Press. Sendhil, R., Amit Kar, Mathur, V.C. and Jha, G.K., Price discovery, transmission and volatility: Evidence from agricultural commodity futures. Agricultural Economics Research Review, 2013, 26 (1): 41-54. Singh, N.P., Kumar, R., Singh, R.P and Jain, P.K. (2005). “Is futures market mitigating price risk: An exploration of wheat and maize market”, Agricultural Economics Research Review, 18: 35-46.