2
$\begingroup$

I would like to add a positive trend to the following simulated ARIMA variable

price <- arima.sim(n = n, list(ar = c(0.8897, -0.4858), ma = c(0.279, 0.2488)), sd = sqrt(0.001))

In one attempt I tried to change the sign of the second term in ar, but I got the error that this made the series non-stationary. Wether it is stationary or not does not bother me, I just wanted a positive trend.

$\endgroup$

1 Answer 1

1
$\begingroup$

If you want a positive trend, just add it to the series:

n <- 100
foo <- arima.sim(model=list(ar = c(0.8897, -0.4858), ma = c(0.279, 0.2488)), 
  n = n, sd = sqrt(0.001))
plot(foo+0.005*(1:n))

ARIMA with trend

Alternatively, you may be interested in getting an integrated ARIMA process. If so, specify an order in the model parameter:

foo <- arima.sim(model=list(ar = c(0.8897, -0.4858), order=c(2,1,2), ma = c(0.279, 0.2488)),
  n = n, sd = sqrt(0.001))
plot(foo)

ARIMA integrated

$\endgroup$

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.