The affinity propagation clustering algorithm can be summarized as follows:
4.5 Implementation of the Johansen cointegration test
[π¦1,π‘ π¦2,π‘] = [π1
π2] + [Π€1,1 Π€1,2
Π€2,1 Π€2,2] [π¦1,π‘β1
π¦2,π‘β1] + [π1,π‘ π2,π‘]
The model in equation (4.8) can be rewritten as (see Appendix B):
π¦π‘ = π + ππ¦π‘β1+ π½1βπ¦π‘β1+ β― + π½πβ1βπ¦π‘βπ+1+ ππ‘ (4.9) where Ξπ¦π‘ = π¦π‘β π¦π‘β1, π = Π€1+ Π€2+ β― + Π€π and
π½π = β(Π€π+1+ Π€π+2+ β― + Π€π), πππ π = 1,2, β¦ , π β 1.
By subtracting π¦π‘β1 from both sides of equation (4.9), the following equation is obtained:
βπ¦π‘ = π + π½0π¦π‘β1+ π½1βπ¦π‘β1+ β― + π½πβ1βπ¦π‘βπ+1+ ππ‘ (4.10) with
πΈ(ππ‘) = 0
πΈ(ππ‘ππ) = { Ξ© for t = Ο 0 ππ‘βπππ€ππ π
The above statement indicates that the contemporaneous covariance matrix of error terms is Ξ© (a π Γ π positive-semidefinite matrix2).Johansen [23] showed that under the null hypothesis of β cointegrating relations, only β separate linear combinations of π¦π‘ appear in equation (4.10).
Johansenβs work implies that π½0 in equation (4.10) can be expressed in the form:
π½0 = βπ΅π΄β² (4.11)
where π΅ is an π Γ β matrix and π΄β² is an (β Γ π) matrix.
Consider a sample of π + π observations symbolised as π¦βπ+1, π¦βπ+2, β¦ , π¦π. If the errors ππ‘ are Gaussian, the log likelihood of π¦1, π¦2, β¦ , π¦π conditional on π¦βπ+1, π¦βπ+2, β¦ , π¦0 is given by:
β(Ξ©, π, π½0, π½1, β¦ , π½πβ1)
=βππ
2 log(2π) βπ 2log|Ξ©|
β1
2β[(Ξπ¦π‘β π β π½0π¦π‘β1β π½1Ξπ¦π‘β1β β― β π½πβ1Ξπ¦π‘βπ+1)β²
π
π‘=1
Γ Ξ©β1(βπ¦π‘β π β π½0π¦π‘β1β π½1βπ¦π‘β1β β― β π½πβ1βπ¦π‘βπ+1)]
(4.12)
The objective is to choose (Ξ©, π, π½0, π½1, β¦ , π½πβ1) such that equation (4.12) is maximized with the constraint of being able to express π½ in the form of equation (4.11). The Johansen method calculates the maximum likelihood estimates of (Ξ©, π, π½0, π½1, β¦ , π½πβ1).
4.5.3 Johansen method: Input
The Johansen method is supplied with three variables:
ο· A π Γ π matrix π¦π‘ containing the time series that are to be tested for cointegration where there are π time series with π data points
ο· A parameter π indicating the order of the time polynomial in the null hypothesis:
o If π = β1, there is no constant or time-trend o If π = 0, there is only a constant term
o If π = 1, there is a constant and a time-trend
ο· A parameter π that represents the number of lagged difference terms to be used when computing the estimator
4.5.4 Johansen method: Step 1
In the first step of the Johansen cointegration test it is necessary to estimate a VAR(π β 1) model for the matrix βπ¦π‘. This task can be done by regressing βπ¦ππ‘ on a constant and all elements of the vectors βπ¦π‘β1, β¦ , βπ¦π‘βπ+1 with ordinary least squares (OLS). The steps to achieving this is discussed next.
The time series matrix π¦π‘ is first detrended according to the value of π. A time differenced matrix of π¦π‘ is calculated by:
πΏπ¦π‘ = { 0 , π‘ < 2 π¦π‘β π¦π‘β1, π‘ = 2, β¦ , π
Notice that the first row of πΏπ¦π‘ is zero since differences cannot be calculated on the first values.
The first row of zero values is not of use and is removed from πΏπ¦π‘. Next a matrix π§π‘ is calculated which contains the time-lagged values of πΏπ¦π‘. The input parameter π is used to determine the number of time lags which will be contained in matrix π§π‘:
π§π‘ = π§π,π‘β1, π§π,π‘β2, β¦ , π§π,π‘βπ , π = 1,2, β¦ , π
where π is the number of column vectors in πΏπ¦π‘. The first π rows of both matrices πΏπ¦π‘ and π§π‘ are removed and the matrices are detrended. It is now possible to achieve the objective of the first step of the Johansen test by performing two regressions to obtain the residual processes.
As explained in section 4.5.2, if the series in π¦π‘ are cointegrated, there exists a VECM representation of the cointegrated system (equation (4.10)):
βπ¦π‘ = π + π½0π¦π‘β1+ π½1βπ¦π‘β1+ β― + π½πβ1βπ¦π‘βπ+1+ ππ‘
where π½0= βπ΅π΄β² has reduced rank π which indicates the number of cointegrating vectors. Since interest is placed on π½0, it is more convenient to model π½1, β¦ , π½πβ1 by a partial regression.
First, πΏπ¦π‘ is regressed on π§π‘ = π + π½1βπ¦π‘β1+ β― + π½πβ1βπ¦π‘βπ+1 with the objective of obtaining the residuals matrix π0π‘:
π0π‘ = πΏπ¦π‘β π§π‘Γ ππΏπ(π§π‘, πΏπ¦π‘) (4.13) where ππΏπ indicates the application of ordinary least squares. The second regression will be of π¦π‘β1 on π§π‘ = π + π½1βπ¦π‘β1+ β― + π½πβ1βπ¦π‘βπ+1. Before the second regression step can be performed, it is necessary to calculate the π-lagged lagged matrix π¦π‘βπ as follows:
ο· Obtain the π-lagged matrix of the input matrix
ο· Remove the π + 1 first rows from the obtained matrix
ο· Detrend the obtained matrix with respect to the parameter input π
The residuals matrix πππ‘ can now be calculated as follows:
πππ‘= π¦π‘βπβ π§π‘Γ ππΏπ(π§π‘, π¦π‘βπ) (4.14) The residual processes have now been obtained and further inference will be drawn on these matrices in section 4.5.5.
4.5.5 Johansen method: Step 2
The second step of the Johansen test is to calculate the sample covariance matrices of the OLS residuals π0π‘ and πππ‘ and find the eigenvalues of these covariance matrices. The sample covariance matrices are calculated as:
π ππ=1
πβ πππ‘πππ‘β²
π
π‘=1
(4.15)
π 00=1
πβ π0π‘π0π‘β²
π
π‘=1
(4.16)
π 0π =1
πβ π0π‘πππ‘β²
π
π‘=1
(4.17)
π π0 = π 0πβ² (4.18)
where T is the size of the matrices π0π‘ and πππ‘. To further investigate the properties of the sample covariance matrices, Johansen [23] performs an eigenvalue decomposition of the matrix:
π ππβ1π π0π 00β1π 0π (4.19)
The eigenvalues are sorted from largest to smallest and their corresponding eigenvectors are also ordered according to the eigenvalues: πΜ1> πΜ2> β― > πΜπ. The maximum value of the log likelihood function in equation (4.12), subject to the constraint that there exists β cointegrating relations, can be expressed as:
β0β = βππ
2 log(2π) βππ 2 βπ
2log|π 00| βπ
2β log(1 β πΜπ)
β
π=1
(4.20)
4.5.6 Johansen method: Step 3
In the third step of the Johansen cointegration test, the maximum likelihood estimates of the parameters are calculated. Let the π Γ 1 eigenvectors associated with the β largest eigenvalues of equation (4.19) be denoted πΜ1, β¦ , πΜβ. The eigenvectors provide a basis for the space of cointegrating relations. The maximum likelihood estimate is that a cointegrating vector can be written in the form:
π = π πΜ + π πΜ + β― + π πΜ
where π1, β¦ , πβ are scalars. Johansen [23] made the suggestion that the vectors πΜπ should be normalized such that πΜπβ²π πππΜπ = 1. The β normalized vectors are inserted into an π Γ β matrix π΄Μ = [πΜ1 πΜ2β¦ πΜβ]. The maximum likelihood estimate of π½0 from equation (4.10) can be expressed as:
π½Μ0= π 0ππ΄Μπ΄Μβ²
The maximum likelihood of π in equation (4.10) is given by:
πΜ = πΜ0β π½Μ0
4.5.6.1 Hypothesis testing
The hypothesis testing of the Johansen method is discussed in this section. The null hypothesis states that there are exactly β cointegrating relations. In this case, the largest value of the log likelihood function is given by equation (4.20). The alternative hypothesis is that there are π cointegrating relations. The alternative hypothesis implies that every linear combination of π¦π‘ is stationary, which entails that π¦π‘β1 would appear in equation (4.10) without constraints and no restrictions will be placed on π½0. The value of the log likelihood function in the absence of constraints is given by:
β1β = βππ
2 log(2π) βππ 2 βπ
2log|π 00| βπ
2β log(1 β πΜπ)
π
π=1
(4.21)
The first likelihood ratio test of β0: β πππππ‘ππππ against the alternative β1: π πππππ‘ππππ is based on
2(β1ββ β0β) = βπ β log(1 β πΜπ)
π
π=β+1
(4.22)
The test in equation (4.22) is referred to as the trace test by Johansen [23].
A likelihood ratio test of β0: β πππππ‘ππππ against the alternative β1: β + 1 πππππ‘ππππ is based on 2(β1ββ β0β) = βπ log(1 β πΜβ+1) (4.23) The test in equation (4.23) is referred to as the maximum eigenvalue test.
As was discussed briefly in section 4.5.3, there are three possible cases that the Johansen test has to consider:
πΆππ π 1: The true value of the constant π in equation (4.9) is zero. This means that there is no
elements of π¦π‘. In this case there is no constant term included in the regressions performed in section 4.5.4.
πΆππ π 2: The true value of the constant in π in equation (4.9) is such that there are no deterministic time trends in any of the elements of π¦π‘. In this case there are no restrictions on the constant term in the estimation of the regressions in section 4.5.4.
πΆππ π 3: The true value of the constant in π in equation (4.9) is such that there are deterministic time trends in the elements of π¦π‘. In this case there are no restrictions on the constant term in the regressions in section 4.5.4.
The critical values for the trace and maximum eigenvalue tests in equations (4.22) and (4.23) are found in the tabulations that were estimated by MacKinnon, Haug, and Michelis [24]. These critical values allow for the tests to have a certain statistical significance level such as 90%, 95% and 99%. If not explicitly mentioned in further parts of the study, the default setup for the Johansen test will be that of case 1, mentioned in this section.
4.6 Implementation of GARCH model