Modelling is not about selecting a priori a specific type of equation BUT rather extracting the model specifics from the data in an iterative manner as presented here https://autobox.com/pdfs/ARIMA%20FLOW%20CHART.pdf
 in order to optimally/opportunistically combine linear, exponential smoothing and arima components while dealing with latent deterministic structure such as pulses , level/step shifts,local time trends and/or seasonal pulses.


The whole idea is to use Exploratory Data Analysis tools (EDA) to evolve/deterimine the underlying model in order to separate signal and noise via an iterative self-checking approach as originally presented by Box & Jenkins and improved since.

In your first example the deterministic structure required is a level shift (intercept change) and a few pulses with an arima (1,0,0) nearly (0,1,0)  while the second example it is simply two pulses with an arima (0,1,0) .




first example:

There is a very clear pattern in the data as shown here [![enter image description here][1]][1] . Your 20 values are adequately described by a hybrid model using an AR(1) and a step/level shift along with 3 pulses . [![enter image description here][2]][2] and here [![enter image description here][3]][3] and here [![enter image description here][4]][4]

The tools (approaches) that you were considering are presumptive in form whereas your data has it's own message. This data has not only a strong memory but has been affected by external activity causing the step.level shift and the 3 pulses.


here are the forecasts for the next 13 periods [![enter image description here][5]][5]

The method used here to form the model is called Intervention Detection as detailed here and everywhere else http://docplayer.net/12080848-Outliers-level-shifts-and-variance-changes-in-time-series.html . Search SE for "INTERVENTION DETECTION" . It might behoove you to investigate the true cause of the level/step shift in order to more intelligently forecast this series.

Here is the Actual and Cleansed plot [![enter image description here][6]][6]

The reason that arima (memory) doesn't work (alone) is that there is determinstic structure in the data .


second example:

This is also a hybrid model arima (1,1,0) with two pulses reflecting external deterministic inputs. The Actual/Fit and Forecast is here [![enter image description here][7]][7] with equation here [![enter image description here][8]][8] and here [![enter image description here][9]][9] with statistical summary here [![enter image description here][10]][10] and for[![enter image description here][11]][11]ecasts here . The Actual and cleansed graph is here [![enter image description here][12]][12]


It is critical to assess whether the anomaly (pulse) downwards at the last point is "real and to be believed" or "a temporary change" . If it is temporary then the forecasts given are to be used , however if it is permanent then subtract 69.4 for each forecast period.


I used AUTOBOX an integrated piece of software that I have helped to develop but there a number of alternative software tools that can be cobbled together to give similar results as to the ideas that I have presented.


  [1]: https://i.sstatic.net/1N2mT.png
  [2]: https://i.sstatic.net/48cNE.png
  [3]: https://i.sstatic.net/Wldmt.png
  [4]: https://i.sstatic.net/v6WOr.png
  [5]: https://i.sstatic.net/yBvwD.png
  [6]: https://i.sstatic.net/CCmFO.png
  [7]: https://i.sstatic.net/68ZRb.png
  [8]: https://i.sstatic.net/ciNtt.png
  [9]: https://i.sstatic.net/iqI6B.png
  [10]: https://i.sstatic.net/QhPgv.png
  [11]: https://i.sstatic.net/Q1SwI.png
  [12]: https://i.sstatic.net/wjuQI.png