As per my understanding below could be the possible reasons why you are getting constant value as the output of the "forecast" function:
- The (2,0,0) model implies an AR(2) model with no differencing and no MA terms. Ensure this is the correct specification for your data.
- 'k' should be a positive integer indicating how many steps ahead you want to forecast.
- If the model includes a constant term and the data is mean-reverting around a constant level, forecasts can appear constant, especially if no trend or seasonal components are present.
Please try to analyse your code as per the above. Hope it helps!