Johansen test explanation I am trying to understand the whole Johansen procedure via wikipedia and some other articles and I'm a noob in econometrics so there is a lot of notation and jargon that I think I am not familiar with. 

https://en.wikipedia.org/wiki/Johansen_test

First off, the test itself. I'm confused by how we test for the cointegration vectors. Where do these vectors come from? Based on this 

https://en.wikipedia.org/wiki/Error_correction_model

It states that

Step 1: estimate an unrestricted VAR involving potentially non-stationary variables
Step 2: Test for cointegration using Johansen test
Step 3: Form and analyse the VECM.

So is it that we first estimate a VAR, then run the trace or eigenvalue test on the pi matrix, then estimate the VECM? Then when we estimate the vecm, is that where, ultimately, the cointegration vectors come from? And do those ultimate cointegration vectors reside in the pi matrix? How do we know which cointegration vectors to use?

Also I need some slight clarification on the models.

I'll start with the VAR(p) model



I'm relatively confident that Xt is a vector of values at time t, et is a white noise term at time t. I'm not quite sure what mu, phi, and Dt are (although I've heard read it's some sort of "seasonal" term). I'm also assuming that the pi's are matrices that we need to estimate. I'm asking for clarification here but in general I think I understand this VAR(p) representation.



This is where I need some more clarification for the VECM model. What exactly are the delta's? Are they just the first difference i.e. (1-L)? 

Sorry for the noob questions but I'm trying to learn this on my own and haven't found many good resources for johansen test and vecm in particular.
I think that the wikipedia steps are not completely correct. When you perform Johansen cointegration test you first have to pretest the data to find if they have the same order of integration. That is all variables have to be either $I(1)$ or $I(2)$ etc. (see Verbeek, 2008). There are some cointegration tests and models that relax this assumption but Johansen is not one of them. But otherwise the steps 1-3 are correct. 

$\Phi D_t$ are indeed seasonal dummies. However, note they are actually not standard part of the model, they are added when you think series can be affected by seasonal trends and if you dont use some other seasonal adjustment technique or if you dont already have data provided with seasonal adjustment from the source.  

$\mu$ is the constant or 'drift' term. It allows your regression to have different intercept than zero. 

You are correct $\Pi$ are matrices of coefficients but dont forget about $\Phi$. Any coefficient you add there has to be estimated - I know its just nitpicking but still.

The co-integration vectors come from the $\Pi$ in the second equation. This matrix can be decomposed as $\Pi = \gamma \beta'$ where $\gamma$ is the matrix of weights with which the cointegration vectors enter the model and $\beta$ is actually the matrix of cointegrated relationships. I am not really exactly sure what you mean by choosing cointegrated vector from this matrix. Its not like you just somehow extract one of the vectors somewhere into some separate vector.

Afterwards the Johansen test basically tests the rank or the number of columns of the cointegrated matrix (With dimensions $k$x$r$ you test for # of $r$). Intuitively this works because you need one column to represent each cointegrated relationship (note there might be multiple cointegrated relationship at the same time).

The rank of the matrix is tested either by trace or eigenvalue test as you correctly mentioned. The null of trace test is $H_0: r \leq r_0$ against $H_a: r &lt;r_0 \leq k$  and the max eigenvalue test has the same null but alternative hypothesis is slightly different $H_a: r = r_0+1$. However, this might be hard to read in plain English. In practice if you would have only two variables both tests would boil down to first testing 0 cointegrated ($r=0$) relationship vs 1 $(r=1)$, second less or equal to 1 cointegrated relationships $(r\leq 1$) vs 2 ($r=2$), third less or equal to 2 coint. rel. $r\leq 2$ vs 3 ($r=3$). You dont really pick from these vectors although the number of cointegrated vectors can affect functional form of VECM, but with just two variables you are looking for $r=1$, if your test finds there should be more you are missing some important variables in your model.

Also yes $\Delta$ is the first difference $\Delta y_t = y_t - y_{t-1}$. Also including first differences assumes that the variables are all $I(1)$ if they are $I(2)$ you need at least second differences. The reason for that is that outside the cointegrated lagged variables the 'contemporaneous' variables must be stationary otherwise your ECM will be biased.  The whole justification of including level variables in ECM is that as long as there is a cointegrated relationship between those their combination will be stationary and their coefficient will be super consistent, but this does not extend to the variables that are added to the model outside the cointegrated relationship.

References:
Verbeek, M. (2008). A guide to modern econometrics. John Wiley &amp; Sons.