ARIMA with trends and exogenous

I'm trying to solve a assignment from an university statistic course regarding the ARIMA models using .

The assignment is:

I have:

• an Y vector of size n of data
• an NxK matrix with a trend and an exogenous variable where N ha the same length of Y and K=2

Having

$$y_t=X_t\beta + \mu_t$$

with the following:

The first question is to estimate the 3 models.

After plotting the data I observed that the trend is the second column of NxK matrix and so the exogenous is the first.

Y chart is

Trend chart is

The exogenous chart is

As far as I understand (my Professor is very bad....):

• The first model is arimax(0,0,0)
• The second model is arimax(2,0,1)
• The third model is arimax(3,0,2)

Am I right?

Secondly I don't know how to use regARIMA and estimate commands considering the trend and the exogenous variables.

I come to the following solution, but I'm quite sure it is wrong because I'm considering NxK matrix as previsions of the model

% Model 2 ARIMAX(2,0,1)
mdl_2_p = 2;
mdl_2_q = 1;
mdl_2=regARIMA('AR',nan(mdl_2_p,1), 'MA', nan(mdl_2_q,1), 'Intercept', 0);
[mdl_hat_2,vpar_mdl_2,logl_mdl_2,info_mdl_2]=estimate(mdl_2,Y,'X',X);

• Typically, "ARIMAX" is used for a related but slightly different model, what you have there is actually a "regression with ARIMA errors" (or sometimes "regARIMA"). Aside from that, yes your interpretation of the ARIMA orders is correct. The question about the specific Matlab syntax for the function regARIMA is off-topic here, but your "N x K matrix" (of regressors) is not a prevision of the model (in fact it is not "modeled", that's what makes it exogenous), if that helps. – Chris Haug May 27 '18 at 0:46
• Thank you @ChrisHaug. Sorry to be off topic on matlab code. Where can I ask for it? – LPs May 27 '18 at 7:37
• @ChrisHaug Maybe the exogenous variables must be modeled as linear regression model (fitlm) and then used to perform regARIMA between Y and the fitted value returned by linear regression? – LPs May 27 '18 at 9:23