Cointegration Analysis with Econometrics Toolbox - MATLAB
Video Player is loading.
Current Time 0:00
Duration 43:28
Loaded: 0.38%
Stream Type LIVE
Remaining Time 43:28
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 43:28

    Cointegration Analysis with Econometrics Toolbox

    Cointegration is a relationship among macroeconomic time series that follow a shared stochastic trend. Identifying cointegration, distinguishing it from common notions of deterministic trend, and accurately modeling it are essential for meaningful forecasting. Econometrics Toolbox™ has a versatile collection of tools for cointegration testing and parameter estimation of the associated vector error-correction models.

    In this webinar, basic concepts of cointegration are reviewed in the context of real economic data. Both the Engle-Granger and Johansen frameworks for cointegration analysis are discussed, using hypothesis testing functions from the toolbox. Cointegrating relationships, when identified, are estimated and plotted. Within the Johansen framework, various null hypotheses for the cointegrating relationship are compared, together with corresponding methods for estimating model parameters. Finally, constraints on the cointegrating relationship and their effects on model estimation are considered as an extension of the standard Johansen framework, with relevant modeling strategies demonstrated.

    Published: 26 Apr 2023

    Hi, I'm Bill Mueller. I'm a developer for Econometrics Toolbox. And I'm here to tell you a little bit about a group of features that we have in the Econometrics Toolbox for cointegration, analysis, and modeling. To get started, let's look at an example of some data. We're going to take a look here at some interest rates over a long period of about 40 years for government bonds in Canada.

    You can see here, we've got plotted short term rates in blue, medium term rates in green, and long term rates in red. And if you just take a look at this data, you can see that it has several characteristics that you'd probably expect of interest rates. First of all, the long term rates are generally larger than the short term rates, with the exception of a couple of inversions that you might notice at the beginning of the 80s and the end of the 80s.

    That's the property of these time series, that one is larger than the other is something you would typically capture in a mean model for the different series. You also probably can tell that these series are highly correlated, which means that at any particular time, the interest rates tend to either move up or move down together. That kind of relationship is something that you would typically try and capture in a covariance matrix among the three time series.

    There's something else going on here, though, if you take a look at this. It appears that this data may not be stationary. It does seem to have a bit of an upward trend, at least over this period of history. And there does seem to be some heterogeneity here. So it's not clear that we're going to be able to model this as a stationary process with a stationary mean and covariance.

    The thing we want to look at is that over this long period of history, these three rates, as you might expect, move along pretty much together. They seem to stay with each other, even as they spread out and come back together. It's not that they're reverting to a particular mean over time, as something that a stationary process would do. It's not that they're reverting to a deterministic time trend, something that a trend stationary process would tend to do.

    But rather, what we see is that there seems to be some kind of invisible stochastic trend between these three variables that the three variables never stray too far from. And it's that characteristic, it's that behavior that we call cointegration. And what I want to show you is how we can identify that in a system of time series and then how we can model it. So just to get on the same page with some terminology, any single time series, y sub t, we'll say is integrated if we can bring it to stationarity through differencing.

    And the number of times we have to difference the data to get stationary data we call the order of integration. We're going to be looking here mostly at variables that have order of integration 1 or 0. So either it takes one difference to bring them stationarity, a typical unit root process, or they're already stationary.

    In the second paragraph here, if we have a vector times series, y sub t boldface there, with n different components, we say that the time series in this vector process are cointegrated if there's some linear combination of the individual processes that's stationary. Typically, we're not interested in having any of these series be stationary individually.

    That would lead to kind of a trivial cointegration where I could make one of the betas in this linear combination 1 on the stationary variable and 0 on all the non-stationary variables. And that would give me a stationary combination. That's not very interesting. Typically, we'll be interested in, for purposes of this demo, i of 1 variables that, when you form the linear combination, you get an i of 0 variable. And we're going to think of this linear combination as a new variable.

    So we start with the levels data. And instead of the usual strategy of differencing the data to form a new variable that's easier to model, we're going to think about forming this linear combination to get a stationary variable that's easier to model. And this combination of variables that forms a stationary process, we're going to call a cointegrating relation. And the vector of coefficients that gives us this combination, we're going to call the cointegrating vector.

    So let's take a look at this data in MATLAB. I've got a script here that we'll have available on MATLAB Central. We have this Canadian data that ships in the Econometrics Toolbox. You can load it up. And we'll just peel off the last three variables here, the last three columns of the data. Typically, we're going to arrange our data where the individual time series are. The columns of y and the individual observations are represented by the rows.

    So these last three columns in this data are the short, medium, and long term rates that we just looked at. And then this is just a plot command that we'll format to reproduce the figure that we just saw. So I'll evaluate this cell. And there we see the potentially cointegrated data that we looked at before. Now, typically in a cointegration analysis, the first thing that you want to look at is the order of integration of the individual variables.

    Like I said, if one of the variables is stationary, you usually don't want to include it in the analysis because it's going to lead to trivial sorts of cointegration. What we'll do here just to illustrate is we'll strip off just the short term rate. We'll take all rows in the first column of our data. That's our short term rate. And then we're going to run a couple of tests to see whether this data has a unit root, first of all, right here.

    And secondly, as an inverse of that, we're going to run a test to see if the data is stationary. So when I talk about a unit root test or a stationary test, I'm talking about the null hypothesis for this test. So for each of these tests-- here we have an augmented Dicky Fuller test, which is a typical test you would use to test for a unit root. And we're going to put in the levels data y of 1.

    And then down here, we have a KPSS test, which is a typicals test for stationary. And again, we're going to put in the levels data, y of 1. Now, we could just run this with all of the defaults for the tests. But what I want to emphasize is that it's very important when running these tests to take a look at the different parameter settings for the test to make sure that you're coming up with reasonable alternatives to test against so that you have informative inferences that you draw from these things.

    So if we go back and we just look at this data, although it does seem to be trending upwards over this 40 year period more or less, these are interest rates. And we don't expect them to trend upwards forever. We do expect they're probably going to come back down and go back up over time, but stay around this mid-range of about 8% that we see in this data here. So if we want to test for a unit root, we probably don't want to use an alternative that is a trend stationary data with a deterministic trend.

    We probably want an alternative like an autoregressive process with maybe a drift in it. So that's what I've chosen here, thinking that this is not going to keep trending upwards. My alternative is going to be an ARD model, autoregressive with drift model that will test against the null hypothesis of a unit root. And same thing down here, we're going to test the null hypothesis of y of 1 being stationary against an alternative that is trend stationary, OK?

    So let me just run this section of the code here where I strip off the variable and run these two tests. And we'll take a look at the results here in MATLAB. And you can see that for the test for unit root, we get a 0 result. That means we failed to reject the null hypothesis. Remember, the null hypothesis, unit root. So there's evidence for a unit root.

    And you can see that the p value is about 29%, quite a bit above the default 5% significance level that we set for these tests. You can adjust that significance level to whatever you want. And then when we go down and look at the test for stationarity, we see that in this case, the result is a true value, a logical one, which says it does reject the null hypothesis-- in this case, the null hypothesis of stationarity. And it does that with a p value of about 1% down here.

    So these are consistent. These are consistently telling us that this data does have a unit root, that we can't reject the hypothesis of a unit root. And we can reject the hypothesis that it's stationary. That seems to indicate that we've got an integrated process here, not a stationary process, which is what we want for doing a cointegration analysis. Now, just to get the order of integration, we can go ahead and difference the data.

    So here, in this next section, I'm going to just run the same two tests. But now, instead of putting in the levels data, I'm going to put the differenced data into both of the tests. And let's just run these two. Go back to MATLAB. And now, when we test the difference data for a unit root, we reject that. So it looks like the difference data. And you can see that the p value here now is very low. It very strongly rejects null hypothesis or unit root for the difference data.

    In fact, notice this warning. It says that the test statistic was actually so large that it was beyond the tabulated values, the critical values that are tabulated in the test. And so what the test is returning here is just the minimum p value in the tabulated values here. So that's a very strong rejection-- and the same thing down here for the stationary test.

    You can see that we're getting the same kind of warning that the test statistic was so large that what's being reported here is just maximum p value. In this case, it's a maximum p value because we have a left-handed test on the one hand and a right-handed test on the other hand. But the important point is that both of these are very strong either rejections of the unit root hypothesis or failure to reject the stationary process.

    So this is exactly what we want. We have this short term interest rate. We see that in levels. It appears to be integrated. But when we difference the data one time, we seem to get a stationary process. So this seems to be an i of 1 variable. And if you go and check the medium and long term rates, you'll find something similar.

    So finally, here, let's just look at the different data-- same data we had before, just differenced now one time. And it does look like it's moving along some stationary mean there around 0. We do seem to have some heteroscedasticity that I noted earlier in the early 80s there. But it looks like it might be reasonable to model this system as a stationary process. Now, here's the turning point, though, in the analysis.

    If you observe this and you decide to go ahead and model your difference to data as a stationary process with some sort of ARMA model, for example, and it turns out that these variables are cointegrated, then simply treating this as an ARMA model in differences and a ARIMA model would be a missed specification. Basically, what you've done by differencing the data is you've removed the information about the levels. And all of the cointegration behavior is in the levels data.

    So you really want to-- when you get to this point, you want to make some more tests and see if this data is in fact cointegrated because if it is cointegrated and you go on and just treat it as an ARIMA model, you're going to be specifying the process that produced the data. And you're going to resultingly get poor forecasts, et cetera. On the other hand, if it is cointegrated, then we have alternative ways to model this kind of data.

    That kind of cointegration testing is what a lot of these new features in Econometrics Toolbox for 11a are concerned with, both testing for cointegration and then helping you estimate the parameters in an appropriate model. Let me go back to my slides for a moment here and say a little bit about the first test we'll look at, which is the older, more classic test for integration called the Engle-Granger test. And the way it works is very easy to describe, which is one of the reasons that many people continue to use this.

    It's an easy test to understand. You start with your data in a matrix y there just like we have, where the rows represent observations. And the columns represent the different variables. And then what you do is you pick one of the variables in this cointegrating regression here. I've just stripped off the first column. And I say that first variable is going to be the regressant. And I'm going to use the remaining variables as regressors.

    And I'm just going to regress the first variable on the other variables. I may include x times a term in the model, deterministic terms. I might want to include an intercept or a deterministic trend or something like that. And what I'm going to do is I'm going to form this regression and then look at the residual series. Now, here's the logic of the Engle-Granger test.

    If I look at that residual series, imagine more or less solving this equation, the regression equation for e and throwing everything else on the left hand side-- so I'd have the first variable minus this linear combination of the second variables minus whatever intercepts and so forth that I have, equals e. If that residual series turns out to be stationary, then that would be evidence that the linear combination of variables that I found in b by the regression with a coefficient of 1 in the first variable-- normalizing the first variable there to have a coefficient of 1-- if I have a stationary process on the right hand side and then this linear combination on the left hand side, that means I found a linear combination of the variables that's stationary.

    And then I can read right off the regression results just a simple multivariate least squares regression here. I can read the b. And that will give me my cointegrating relationship. Now, here's the twist. And here's a common mistake that people often make with this test. You want to take the residual series that you get from performing a regression like this and put it into a unit root test.

    But you have to recognize that what you're putting in to the unit root test is not an observed series like you typically do with something like the Dickey Fuller test that we just looked at. What you're putting in is an estimated series. You have these estimated residuals that are the result of a regression. And it turns out that if you put this into a Dickey Fuller test, you can use the same test statistics as you would.

    But the distributions of those test statistics change. I've certainly seen people who say they're doing an Engle-Granger test where they take the residual series from a regression, put it into a Dickey Fuller test and take the results of the Dickey Fuller test and use that to evaluate whether or not cointegration is present. That's a mistake.

    You have to use new distributions for the test statistics that account for the fact that the series that you're testing is estimated. And that's what we do in the EGCI test in Econometric Toolbox. We have the proper distributions tabulated. And so you want to use it. That function will call Dickey Fuller or the Phillips-Peron test or whatever you want to use for unit root test to compute the test statistic.

    But it will then use the correct cointegration distributions for the Engle-Granger test to draw the inference about whether or not cointegration is present. OK, so it's easy enough to run. Here's the EGCI test. And what we're going to do is put in our whole matrix of data here. So this includes our three variables as columns. And just to show you that we can run multiple tests with a single call, I'm going to compute two different test statistics, the so-called tau and z statistics here, with one call to this function.

    So let's just go ahead and evaluate this cell. And what we see here is that we get mixed results. On the null hypothesis for the Engle-Granger test is that there is no cointegration. So if I get a 0 here, it says it fails to reject-- no integration. So that's not evidence for integration. On the other hand, if you look at the p value, you can see it just missed. The default significance level of 5%, this is just a little over.

    If we had set our significance level at 6%, this would have rejected the null of no cointegration. In other words, it would have provided evidence for cointegration. On the other hand, if we use this other test statistic, which is typically used in Dickey-Fuller tests, we get rejection at a 2% level here, rejection of the null of no cointegration. So it seems like there's some evidence here at least that these variables might be integrated.

    Now, once you've determined that there might be cointegration among the variables, you might want to actually look at, what is the relationship? We can just pull out that regression, the vector of regression coefficients, b, that we saw earlier on the slide here, this coefficient b from the regression, which is performed by EGCI test. That's available in an optional if output argument from EGCI test here. We can just pull it out and then pull out the intercept and the regression coefficients here.

    And then I can form the linear combination in the regression. And I can plot it. So if I just go ahead and I do all of this, we get a plot of a new variable, which is a linear combination of the three interest rates that we started with. And it does indeed look stationary more or less. It does seem to revert to a mean around 0, although we see some volatility clusters, I suppose, at different points in time. It seems more or less stationary-- so again, evidence that there may be some integration here and that we've actually found a cointegrating relationship.

    Once you've found a cointegrating relationship, to create a model that takes this into account is pretty straightforward. The model that we typically use for cointegrated systems is something called a vector error correction model, or in the case of cointegration, we usually just call it the cointegrated VAR model. So it looks something like this. You work with the differenced data on the left hand side. So this would be for i of 1 processes like we have. This would be stationary variables.

    And let me just skip this term for a moment. Over here, we have a sum of lagged differences-- so again, stationary variables. This is your typical VAR model in differences. So you can choose how many lags you want to use here in your model to capture the dynamics of the process. That's another topic altogether about how to pick that value for q. But you're modeling the differenced y data in terms of lagged differences here.

    And you're basically just throwing in all of the variables as regressors for all of the other variables. That's how a VAR model works. We can also include deterministic terms like time trends or seasonal dummies or interventional dummies and so forth in a deterministic term over here. What makes this model unique is this one term here that would not be stationary if these variables are integrated of order 1. And this is called the error correction term.

    It works with the levels, the lagged levels of y, which would be integrated. And this coefficient, this matrix coefficient of lagged y, in the presence of cointegration, this will factor. And it will factor in a non-unique way, which is one of the issues with cointegration analysis. What you're going to get here is two matrices, A and B-- are both of the same size.

    They'll be n by r, where n is the number of variables that you're dealing with, three in our case. And r is the rank of this coefficient of the error correction term. So it's going to be a matrix. And you compute its rank. If the rank is full rank, then what you get here is an error correction term where we have a full rank matrix. And you can conclude that the process is stationary in levels. You can just solve for that error correction term and put all the stationary terms on the left hand side.

    And you can conclude that your original data was stationary in levels-- not very interesting. On the other hand, if the rank of that coefficient to AB prime is 0, then that term just drops out. And you get a VAR model that's stationary in differences. The cointegration case, the interesting case, is when you have a rank that's somewhere between 0 and n-- in our case, between 0 and 3, where you get this factorization. And you can interpret the columns of B as being your cointegrating relationships.

    There may be more than one. And then the A's, the values in the matrix A, are going to tell us something about how fast the model adjusts to this equilibrium. If you think of the B prime times lagged y as giving how far the model is from this stochastic trend, this is stochastic equilibrium at time t minus 1, then we use the A to give the speed at which the spread adjusts and comes back to the stochastic trend. So that's a very brief introduction to cointegrated VAR models.

    But what I want to point out is that once you've determined the B-- say you have a cointegrating relationship, which we just did here. And you come back here. And now, you know what B is here. Now, you just have pretty much a least squares problem for estimation. If you didn't know what B was, then you have this problem that you have to estimate A and B separately. And that's a non-linear problem because of the product.

    So you wouldn't be able to do that with least squares. But if you identify B first, then you can go and solve for the rest of the coefficients in the VEC model just using least squares. I'm not going to go through all of that since that's not really cointegration analysis. But I will point out that we do do that in our documentation. If you look at this section of the documentation, I'll just show you what it looks like.

    Here in Econometrics Toolbox under the Users Guide, there's a section on multivariate time series model and a new section on cointegration and error correction. And if we go down here to the section on single cointegrating relations like we've just looked at, there's this example that I've been talking about where we identify the cointegrating relation. And then we plug the B into the error correction model.

    And we pretty much use least squares to solve for the other coefficients. That's this code here. You can take a look at it. It's really just a call to the MATLAB backslash operator to find the least squares coefficients. And here are the coefficients of your vector error correction model. So that's just basic least squares in MATLAB to get the rest of your coefficients in the error correction model.

    Once you've got that, of course, once you've got your error correction model, you can go on and do simulation forecasting. And there's some discussion of that, how to set that up for an error correction model here. And here, we do a little bit of a forecast forward using the error correction model. So that's all very straightforward least squares estimation simulation and forecasting once you've identified the cointegrating relationships in B.

    Now, there are some limitations of the Engle-Granger test. And I'll just point that out here. The problem with the Engle-Granger, test or one of the problems with the Engle-Granger test is that we arbitrarily almost, or almost always arbitrarily have to pick one of the variables to be the regressant and the other variables to be the regressor. And we might expect that the b we get and maybe even the inference we get from the test will depend on our choice of this first variable that we're going to put on the left hand side.

    And indeed, that's the case. If you just do a permutation of the variables and run the Engle-Granger test for each permutation of the variables-- that's what I'm doing here. You can take a look at this code more closely later. But it's essentially just running the Engle-Granger test with each of the three variables as a regressant and then regressing it against the other two. Let me go here to MATLAB and show you that we get different results.

    In two of the cases, we reject the null of no cointegration. That means we have evidence for cointegration at about the 2% or 3% level. But if we pick the third variable as a regressant, this time, we fail to reject the null of no cointegration. And although, again, we're only at about 6%, just a little bit above the significance level that we've set at 5%. So the point here is that we get different inferences depending on how we make that arbitrary choice for the first variable.

    And we also get different cointegrating relations. The first cointegrating relationship here is the one we found before. You can see that there are two others that we find by doing the same regression with the variables switched around in the other two ways that we can do it. Now, there's no guarantee with the Engle-Granger test here that we found three independent cointegrating relationships.

    There may be some linear dependence or even nonlinear dependence, some dependence among these relationships. And so you'd have to go and do that analysis separately. So the point is that the Engle-Granger test, although it's classic and nice and easy to understand, is it has its limitations. It's limited to finding a single cointegrating relation at a time. And it does have this possibility where you could be drawing different inferences depending on how you make some arbitrary choices.

    Let's compare the Engle-Granger test with a more modern, more complete test. Actually, calling this a test is somewhat misleading because this is really more of a framework. This is something that has been developed by Soren Johansen. It's a whole framework for testing for cointegration, estimating coefficients in an error correction model and even then, testing hypotheses about the cointegrating vectors and the adjustment speeds.

    Johansen has developed this framework where you can do all of this in the same setting, test for multiple cointegrating relationships all at once at the same time-- basically, make up for all of the shortcomings of the Engle-Granger test and do a lot more. So we also have a Johansen test, a couple of Johansen tests in the Econometrics Toolbox, which, by manipulating the parameters and values, you can carry out all of the different analyzes that you would typically do in this Johansen framework.

    One of the things you're going to have to do when you're using the Johansen test, something you have to do in the unit root stationarity test that we spoke of earlier, you have to pick an appropriate model to be testing against. And Johansen lists these five models, five types of cointegration here. They're basically just looking at this error correction term plus the deterministic terms in the error correction model. And Johansen lists five cases here that typically come up in Econometric data, some of them not so typically, like the H and H2.

    He considers five cases. And our framework allows you to consider five cases as well for cointegration, depending on whether you want to include intercepts and time trends in the data as an alternative, whether you want to have intercepts and time trends in the cointegrating relations and so forth. So I won't talk a lot about the details of how you make that choice. But there's a lot more about that in the documentation. And you can read a little bit more about these different options for cointegrating relationships. As far as running this, though, it's very simple to run in Econometrics Toolbox.

    The Johansen test looks just like the Engle-Granger test. You input the levels data in the form of a matrix. You pick some appropriate model of cointegration. I'm going to pick Johansen's H1 model here. And again, just to show you that we can run multiple tests in one call to the data, I've picked two different legs for the error correction model. Remember, that's the q.

    The q here is the number of lags in the error correction model, something that you want to choose. What Johansen test is going to do is it's going to test for cointegration. But at the same time, if it finds that there's no cointegration with a certain constraint on the rank of that error correction matrix, it will estimate the error correction model with each of those ranks. So let's just run this cell.

    Let's see what the output looks like. And you can see, it's a little more descriptive than what we got for the Engle-Granger test. We've got two results summaries here for test one. This is the model with one lag in the error correction model. And down here is the results summary, with two lags for the error correction model. And this table here summarizes the results.

    We consider the whole range of cases for the rank of that error correction coefficient, 0, 1, and 2. Again, rank equal 3 is not an interesting case. That's full rank for it. That means that the data is stationary and levelled already. And you can take a look here at the p values and so forth. But what we've decided here is that it's going to reject the null hypothesis of cointegration for rank 0.

    So that's pretty much no cointegration because that would mean that matrix has rank 0. It rejects rank 1. But it fails to reject rank 2. So there's some evidence here that there is cointegration here with a rank 2 matrix for b, meaning that there would be two cointegrating relationships that this test has found. If we change the model a little bit, you can see that our results are a little less conclusive, a little less informative. They fail to reject. Any of the ranks could be 0, could be 1, could be 2.

    The statistics fail to reject that. So there's some evidence here. You can play around. I mean, this is just good evidence that it's important to pick an appropriate model for your data, play around with the lags a little bit and look at the evidence here. But it does look like there's some evidence for maybe two cointegrating relations in the data. Now, just like the Engle-Granger test returns that rank structure as an optional fifth output, the Johansen test is a maximum likelihood framework the way it does its estimation.

    And testing is not through least squares but through maximum likelihood. And the mles are returned in a fifth output. And what I'm going to do here is-- these won't be computed unless you actually ask for this output, if I do. And I'm just going to turn on a display here-- parameter, to actually show the estimated parameters. We'll look at this lag 2 model that we looked at earlier.

    And what you're going to get is this mles structure out. And if you want to get things like the b matrix that includes the cointegrating relations, you just index into it using a syntax like this. That is all documented in terms of the field names in the structure-- but just mles.r2 for rank 2 if you want to get the matrix for the rank 2 case, paramVals.B.

    So I'll run this. Go back to MATLAB. And what we have here is, here's the test again that we ran. And in this case, we asked the mles output. And we had the display on. So here are the coefficients in the Vec model for the rank 0 case. Now, remember, rank 0 means there's no error correction term. So there is a. And there's no b. What I've got here these are the lag delta y's at lag 1 and lag 2.

    And here's my intercept term in my Vec model. In the case of rank 1, well, now we have one column for a and one column for b. And the product, ab prime, then, is our error correction coefficient. And here are the values for our lag coefficients. This is the intercept term. And then we also have the constant that's included in the cointegrating relationship that we estimated by default here.

    You can choose the model that you want, one of Johansen's models, to either include that or not. And then finally, the rank 2 case, now, a and b both have two columns, representing two cointegrating relationships. And these are the coefficients of the corresponding Vec model for modeling those two cointegrating relationships in the data together.

    So you can see already that this is much more powerful than what you can do with the Engle-Granger test. You can evaluate all the different possible ranks for the error correction term and estimate them in one call. You can estimate the model for each of those cases and get your coefficients and compare.

    Finally, let me just say a word about some additional tests we have. We have a function called jcontest, which allows you to put constraints on either the cointegrating vectors or the adjustment speeds in the error correction model and test to see whether those constraints are supported by the data. Just to give you an idea of what I'm talking about here, imagine that we're working in a case where our matrix B of cointegrating relations is n-by-r.

    So remember, n is our number of variables. It would be three in the case of our interest rate data. And r is the rank of the error correction term. And the matrices, A and B, it represents the number of cointegrating relationships that we've found by testing. So typically, r is going to be less than n in the cases of cointegration. And if you look at the columns of B, the vectors that represent the cointegrating relationships-- so here, I've got the first column and the second column.

    They're going to span-- these are going to be n-dimensional vectors. But they're going to span a subspace of dimension r in n-dimensional space. And the issue is that the estimates for A and B depend on how that factorization of the error correction term is done. And it's non-unique. And you can do it in an infinite number of ways. So it may be that you run this test. You get estimates for the cointegrating relationships.

    But they're hard to interpret in terms of, say, the economic data, the economic situation that you're trying to model. So you might want to ask the question, well, is there another cointegrating vector that actually makes sense based on economic theory that lies within the subspace that's been identified by the Johansen test? So I've just indicated two other n-dimensional vectors here, one in green that does lie in the subspace span by our cointegrating vectors and one that does not.

    And that's the kind of thing that jcontest looks like. It'll allow you to make inferences about questions like this. Does this particular vector suggested by theory, say, lie within the space of cointegrating relations that has been estimated or not? And there are also versions of it that will allow you to look at linear combinations, put constraints on certain linear combinations of the variables-- have to be true, purchasing power parity or something, where you have one variable is equal to the sum of two others.

    Is that constraint satisfied in the subspace of cointegrating relationships? You can test all of those kinds of hypotheses on both cointegrating vectors and on adjustment speeds using this function, jcontest. So just to illustrate and to wrap up here, I'll check something that we've already checked. I'm going to look at each of the variables individually by just giving these indicators here. There's three.

    And I'm going to run three tests to see, is this a cointegrating vector? Is this a cointegrating vector? And is this a cointegrating vector? Now, look at these vectors. These are putting a 1 on one of the variables and 0 on the others. So if it's a cointegrating vector, that means that that combination of the variables is stationary, which means in this case, variable y1 is stationary. Variable y2 is stationary. And variable y3 is stationary.

    That's what we're testing. Basically, we're doing the pre-testing that we did earlier to see if we're working with stationary or non-stationary data within the Johansen framework. So you don't really have to pre-test. You can do it within the same framework. It's another nice feature of what Johansen has worked out with this framework.

    So if we run this-- we'll go back to MATLAB. We get strong evidence of what we already discovered. There's strong rejection of each of these three hypotheses, that the variables individually are stationary. And you can see the p values are quite low. So we get rejection of stationarity. We found that earlier.

    But we were able to do it for all three variables at one time. And we were able to do it within the same framework that we're using for testing for cointegration and estimating our model, which is really nice. OK, I think I'll leave it at that. I hope that gives you a little taste of some of the new things we have for doing cointegration analysis and Econometrics Toolbox. And I hope that you'll go and have a look for yourself.

    View more related videos