user7892705
user7892705

Reputation: 147

Simulate time series from a fitted model

How to simulate a time series from a fitted model with different length?
Here is the R code that I used.

library(forecast)
x <- rnorm(14)
arima_mtd <- auto.arima(x)
simulate(arima_mtd, future=FALSE, obs=20)

The output is

Time Series:
Start = 1 
End = 14 
Frequency = 1 
 [1]  2.5615390  2.5141284  4.2861222  3.6109683  3.3430394  1.2106125  0.6632493  0.3742014 -0.9513123 -0.3542338  0.5117973 -0.3833429 -0.2657833 -0.8910624

Instead of generating 14 observations I want to generate 20 observations from the fitted model.

Upvotes: 0

Views: 333

Answers (1)

AK88
AK88

Reputation: 3026

IMHO, when you have only 14 observations and future = FALSE then you can only generate 14 simulated observations. If you require 20 you wither have to generate 6 more observations by setting future = TRUE:

a = simulate(arima_mtd, future = FALSE, nsim = 14)
b = simulate(arima_mtd, future = TRUE, nsim = 6)

Or you will have to increase the number of observations in your initial x.

Upvotes: 0

Related Questions