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?
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)