I want to answer the following question, I know that I can use the arima.sim function but I am not sure how to simulate model asked:
I want to simulate the following:
yt =α+βt+φyt−1 +εt, εt ∼IIDN(0,1)
when: alpha=1, beta=0 and theta=0.8
Before each simulation we should set the seed to 100,000. Assume a starting value of y0=0 and obtain 500 observations. I have tried the following but it doesn't seem to work:
set.seed(seed = 100000)
e <- rnorm(500)
m1 <- arima.sim(model = list(c(ma=0.8,alpha=1,beta=0)),n=500)
I have to simulate 4 different models for 4 different values of beta, theta and alpha. Any suggestions?
Thanks in advance.
set.seed(seed = 1232020)
e <- rnorm(500,mean=0,sd=1)
alpha <- 1
beta <- 0
theta <- 0.8
m_1 <- 0
for(i in 2:length(e)){
m_1[i] <- alpha+beta*i+theta*m_1[i-1]+e[i]
}
Think this should do the trick :)