1
$\begingroup$

I am new in R and Timeseries analysis and forecasting. I have 2 questions.

  1. I am detecting three change points in my dataset.

    ts <- ts(y)
    bp <- breakpoints(ts~1) #three breakpoints are detected
    

Can I somehow conclude that any of the breakpoints is not significant and will not change my forecasting? If no, how can I adjust two out of three breakpoints into my forecast dataset?

  1. My timeseries has trend and seasonality. I implement an ARIMA model with auto.arima() function. Do I have to detrend and decompose my series? Is auto.arima() valid if I don't? The code I use:

    fit <- auto.arima(ts2, stationary=FALSE, seasonal = TRUE, trace=TRUE, ) pred <- forecast(fit, h=59) plot(pred, lty = c(1,3), xlab='week', ylab='index', main='Timeseries - Prediction')

Lastly, can I check for a max h for forecast?

EDIT Timeseries plot with breakpoints

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ The first thing I would recommend is plotting your data; that will give you (and us) a lot of information. $\endgroup$
    – jbowman
    Commented Feb 8, 2022 at 15:52
  • $\begingroup$ @jbowman I just edit my post. Thank you $\endgroup$
    – Mgtr
    Commented Feb 8, 2022 at 16:14

1 Answer 1

0
$\begingroup$
  1. The breakpoints() function you have specified is for a mean change (the ~1). If you plot the resulting estimated mean you will see that you have misspecified the model and that is why 3 changepoints have been detected. I am guessing this is why you are asking whether "they are significant". If you believe that your data, within each segment, is generated from a trend+seasonal arima model then that is the model you need to put into the breakpoints() function (if you can, I don't think it handles time series errors, although you could make AR covariates to get an approximation).

  2. Yes, the auto.arima() model is not appropriate if there are changes within the data. It will likely fit an integrated model to deal with the changes as the difference data is stationary except at the changepoint locations.

I'm not sure on your background but the following paper describes different stages to fit changepoints in a modelling pipeline and their influence on the forecasting ability: https://onlinelibrary.wiley.com/doi/10.1002/qre.2712

If your only aim is to forecast and the changepoint is a nuisance then the best approach is to estimate the changes, correct for them and then fit a model to the corrected series. In your example it is clear that there is a steady mean prior to the first change identified. Following this it looks like a slow (and unsteady) return to a new lower steady-state (around 900). You would need more data to see if the return is just over a longer period though or maybe there is knowledge of the specific problem that might help in assessing this?

For the "return to equilibrium" part you might be interested in this recent paper which models a trend followed by equilibrium after a changepoint: https://arxiv.org/pdf/2007.09417.pdf

$\endgroup$
2
  • $\begingroup$ Thank you for your help. Can I use the data after the breakpoint for the forecast? with the same function auto.arima() $\endgroup$
    – Mgtr
    Commented Feb 10, 2022 at 10:33
  • $\begingroup$ Yes, that is one of the points of doing changepoint detection, to know how much data from the past is "relevant" i.e. the same model structure, so that you have the most amount of relevant information possible going into your forecast. $\endgroup$
    – adunaic
    Commented Feb 22, 2022 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.