0

I want to do multivariate data analysis using vector auto regression (VAR), but want more freedom. For example, the question I am dealing with can look like:

y1(t) = a11*y1(t-1) + a12*y1(t-2) + b11*y2(t-1)               + c11*x1(t) + c12*x2(t) + d1

y2(t) = a21*y1(t-1) +               b21*y2(t-1) + b22*y2(t-2) + c21*x1(t) + c22*x2(t) + d2

So you see, the above equations are not a simple VAR(1) or VAR(2) model, but a mix. Does python's any statistics model package supports such equations, and how to write it in formula or patsy?

Uri Goren
  • 13,386
  • 6
  • 58
  • 110
user2355104
  • 82
  • 1
  • 9
  • by "Writing it in a formula" you mean just simply printing, formatting? if NO, I think you are doing some sort of iterative operation that each step is based on the previous step. – Rebin Apr 21 '19 at 20:38
  • I need to generate a formula to feed to the VAR model, such as statsmodels.tsa.vector_ar.var_model.VAR.from_formula() – user2355104 Apr 22 '19 at 02:40

1 Answers1

2

is the following approach can help?

y1=[0,0]
y2=[0,0]
x1=[0,1,2,3,4,5,6,7,8,9,10]
x2=[0,1,2,3,4,5,6,7,8,9,10]
for t in range (2,11):
    tempY1 = y1[t-1] + y1[t-2] + y2[t-1]+ x1[t] + x2[t] + 1
    tempY2 = y1[t-1] + y2[t-1] + y2[t-2] +x1[t] + x2[t] + 1
    y1.append(tempY1)
    y2.append(tempY2)
Rebin
  • 516
  • 1
  • 6
  • 16
  • I need to generate a formula to feed to the VAR model, such as statsmodels.tsa.vector_ar.var_model.VAR.from_formula() – user2355104 Apr 22 '19 at 02:40