title: Vector Error Correction Model in r
body: <p>I have to estimate the relationship between prices in New York(N) and London(L) using a vector error correction model adapted from Joel Hasbrouck. After much research online, I still have not made much headway so I thought that I would ask you experts to see if I can get some direction in getting this model done.</p>
  
  <p>My dataset is a dataframe with date, time, symbol, price. </p>
  
  <p>Return(r_t) is defined as the log difference between price for each fifteen minute interval (p(t) - p(t-1)) for both New York and London (equation 1 and 2). </p>
  
  <p>The model uses r_t in New York to model on 2 lags of returns in new york and London (equation 3). </p>
  
  <p>Then uses in r-t in London to model on 2 lags of returns in new york and london (equation 4).</p>
  
  <p>N and L represent New York and London respectively anywhere seen in the model and t represents time.</p>
  
  <pre><code>r_t^N=∆ log(P_t^N )
  r_t^L=∆ log(P_t^L )
  r_t^N=α(log(P_(t-1)^N)-log(P_(t-1)^L))+∑_(i=1)to 2(γ_i^(N,N) r_(t-i)^N) + ∑_(i=1)to 2(γ_i^(N,L) r_(t-i)^L)+ ε_t^N
  r_t^L=α(log(P_(t-1)^L)-log(P_(t-1)^N))+∑_(i=1)to 2(γ_i^(L,L) r_(t-i)^L) + ∑_(i=1)to 2(γ_i^(L,N) r_(t-i)^N)+ ε_t^L
  </code></pre>
  
  <p>Any help will be soooooo appreciated. Thank you in advance for your help!!</p>
  
  <p>I am new to R and have a bit more experience using SAS and the time series procedures there. I have seen reference to using vars() but the examples I have looked at do not seem applicable so I am pretty much stuck. I have done the DW statistic and there is co-integration. </p>
  
  <p>I just can't figure out how to write the code for this ...</p>