ARMA model with more than one exog variable

700 views
Skip to first unread message

R. Trott

unread,
Sep 11, 2016, 11:18:46 AM9/11/16
to pystatsmodels
Hi

I'm trying to fit an ARMA model with an exogenous variable: 

import statsmodels.api as sm

arma_mod30 = sm.tsa.ARMA(LowP_RS, (4,0), exog=Temp_RS).fit()


which works fine. 


Next I'd like to add a second exogenous series, i.e.: 


arma_mod30 = sm.tsa.ARMA(LowP_RS, (4,0), exog=[Temp_RS, Inlet_RS]).fit()


But this returns an error: 


ValueError: endog and exog matrices are different sizes 

 
Is it possible to use sm.tsa.ARMA with more than 1 time series as exog, and if so what's the correct syntax/structure? 

Thanks! 

R.

josef...@gmail.com

unread,
Sep 11, 2016, 11:20:54 AM9/11/16
to pystatsmodels
On Sun, Sep 11, 2016 at 11:00 AM, R. Trott <roberto...@gmail.com> wrote:
> Hi
>
> I'm trying to fit an ARMA model with an exogenous variable:
>
> import statsmodels.api as sm
>
> arma_mod30 = sm.tsa.ARMA(LowP_RS, (4,0), exog=Temp_RS).fit()
>
>
> which works fine.
>
>
> Next I'd like to add a second exogenous series, i.e.:
>
>
> arma_mod30 = sm.tsa.ARMA(LowP_RS, (4,0), exog=[Temp_RS, Inlet_RS]).fit()


when we do np.asarray([Temp_RS, Inlet_RS]) internally, then this has
two rows and nobs columns, i.e. it is transposed.

use
exog=np.column_stack([Temp_RS, Inlet_RS])
to get a 2-D array with observation in rows and two columns for the variables

Josef
Reply all
Reply to author
Forward
0 new messages