How do I use the statsmodels ARMA process to fit a difference equation of the form.
y[k] = - a1 * y[k-1] + b0 * u[k] + b1 * u[k-1] + c0 * e[k] + c1 * e[k-1]
I'm not shure how to set up the exog matrix. E.g.
import statsmodels.api as sm
# some stupid data
y = np.random.randn(100)
u = np.ones((100,2))
armax = sm.tsa.ARMA(y, order=(1, 1), exog=u).fit()
results in
ValueError: could not broadcast input array from shape (2) into shape (3)
It's probably easy to solve but I'm new to the field.
Thanks.
(I'm using statsmodels 0.6)
The issue here is that you're passing two constant columns, then telling fit to add another constant column with trend='nc'
. Admittedly, we should fail more gracefully here, but you need to try something like
u = np.random.randn(100, 2)
Instead of the constant exog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With