Recalculate fitted values/Simulate of an Arima model with different xreg values I have about 100 ARIMA models, where each models the demand of a separate household using the temperature as an exogenous value. I've used the auto.arima from the forecast package on R and used xreg to input the temperature.
Now I changed/simulated several series of temperature values and want to use the new temperature values to recalculate the demand using the previously constructed ARIMA model.
I think I can calculate the values manually by referring to each coefficient value of the model. However, it will be inefficient as I have more than 100 models.
Is there a more efficient way to get this done?
So far my code is
arima_model = 
    auto.arima(sqrt(house_data$demand), 
    xreg = as.matrix(house_data$temp)) 
    # model for demand
temp_auto_arima = auto.arima(house_data$temp) 
    # model for the temperature
new_temperature = simulate(temp_auto_arima) 
    # simulate temperature to get a new series 


You can use simulate(arima_model, xreg = new_x) with a the parameter xreg to simulate a time series with a different regressor vector or matrix.
Below is an example

### generate data
set.seed(1)
t = c(1:1000)
x = sin(t/1000*2*pi*3)
noise = arima.sim(n = 1000, list(ar = c(0.2,-0.5), ma = c(1,0.5)),
                  sd = 0.1)

### plot time series
demand = x + noise
plot(t,demand, 
     main = "black: original model \n red: simulate(mod, xreg = new_x)")

### model time series and plot newly generated series
arima_model  = auto.arima(y, xreg = x)
new_x = sin(t/1000*2*pi*3+pi)
points(t,simulate(arima_model , xreg = new_x), col = 2)
mod

