Renaming xreg variables names in arima summary() output in R forecast package

Viewed 39

I use forecast package in R.

Hyndman says:

The arima() function in R (and Arima() and auto.arima() from the forecast package) fits a regression with ARIMA errors.

I have an output for auto.arima()

Regression with ARIMA(5,0,0) errors 

Coefficients:
     ar1      ar2     ar3      ar4     ar5  intercept   xreg1    xreg2    xreg3    xreg4   
xreg5   xreg6   xreg7    xreg8   xreg9
  0.0212  -0.0530  0.7005  -0.0232  0.0334   862.0474  -4e-04  -0.0303  -0.0659  -0.1657  4.4673  0.1958  0.3381  -0.4270  5.3478
s.e.  0.0087   0.0086  0.0062   0.0087  0.0087   285.6206   1e-04   0.0604   0.0648   1.7225  0.5952  0.0213  0.0138   0.1415  0.0707

sigma^2 = 15.05:  log likelihood = -37334.05
AIC=74700.1   AICc=74700.14   BIC=74820.22

Training set error measures:
                    ME     RMSE      MAE MPE MAPE      MASE         ACF1
Training set -0.0001219744 3.877156 1.434961 NaN  Inf 0.3321699 -0.007453887

Can I rename all xreg variables somehow and have real names in my summary output?

1 Answers

Name the columns of the matrix to whatever you like.

library(forecast)
xreg <- ts(matrix(rnorm(900), ncol=9))
colnames(xreg) <- LETTERS[1:9]
auto.arima(WWWusage, xreg=xreg)
#> Series: WWWusage 
#> Regression with ARIMA(1,1,1) errors 
#> 
#> Coefficients:
#>          ar1     ma1       A       B       C       D        E       F        G
#>       0.6418  0.6653  0.1122  0.2939  0.0958  0.0923  -0.3412  0.0706  -0.0008
#> s.e.  0.0842  0.0927  0.0986  0.1038  0.0904  0.1061   0.1218  0.0919   0.1074
#>            H        I
#>       0.0137  -0.2185
#> s.e.  0.0773   0.1320
#> 
#> sigma^2 = 9.524:  log likelihood = -247.12
#> AIC=518.24   AICc=521.87   BIC=549.38

Created on 2022-03-01 by the reprex package (v2.0.1)

Related