robjhyndman / forecast

Forecasting Functions for Time Series and Linear Models
http://pkg.robjhyndman.com/forecast
1.13k stars 342 forks source link

xreg not carrying through in arfima #735

Open rkillick opened 6 years ago

rkillick commented 6 years ago

Motivation: I want to fit an arfima model with regressors.

In arfima.R you are allowed to enter additional parameters that are carried forward to auto.arima. This is carried forward to line 156 where auto.arima is used and the ... is present.

However, as the default setting is "mle" fit, when you enter an xreg argument, the final fit doesn't display the xreg and the final arima fit is not working on the residuals of the xreg fit, see line 166 of the file.

I think this just needs a check to see if xreg is specified in ... and if so, the residuals of the xreg fit are carried forward and the xreg parameter estimates from auto.arima are carried forward to the final fit object too.

If you are happy with my (outline) suggested change I can make it in the code for you and commit.

robjhyndman commented 6 years ago

A simpler solution might be to add an xreg argument to arfima with default NULL, then just pass that to both auto.arima() and Arima().

In any case, feel free to make a PR.

Jeremy537 commented 4 years ago

I am facing the same problem right now. Has anyone published a solution in the meantime?