########################################################################
# Simulate ARIMA(2,1,0) process with phi = c(1.3, -0.35), Gaussian innovations
# The series is truncated at lag 50
Trunc.Series <- 40
n <- 1000
phi <- c(1.3, -0.35)
theta <- NULL
d <- 1
sigma <- 1
constant <- NA
trend <- NA
demean <- NA
StableParameters <- NA
set.seed(1)
x <- varima.sim(phi,theta,d,sigma,n,constant,trend,demean,StableParameters,Trunc.Series)
coef(arima(x,order=c(2,1,0)))
########################################################################
# Simulate univariate ARMA(2,1) process with length 500,
# phi = c(1.3, -0.35), theta = 0.1. Drift equation is 8 + 0.05*t
# Stable innovations with: ALPHA = 1.75, BETA = 0, GAMMA = 1, DELTA = 0
n <- 500
phi <- c(1.3, -0.35)
theta <- 0.1
constant <- 8
trend <- 0.05
demean <- 0
d <- 0
sigma <- 0.7
ALPHA <- 1.75
BETA <- 0
GAMMA <- 1
DELTA <- 0
StableParameters <- c(ALPHA,BETA,GAMMA,DELTA)
Z <- varima.sim(phi,theta,d,sigma,n,constant,trend,demean,StableParameters)
plot(Z)
########################################################################
# Simulate a bivariate VARMA(1,1) process with length 300.
# phi = array(c(0.5,0.4,0.1,0.5), dim=c(k,k,1)),
# theta = array(c(0,0.25,0,0), dim=c(k,k,1)).
# The process have mean c(10,12),
# Drift equation a + b * t, where a = c(2,5), and b = c(0.01,0.08)
# The variance covariance is sigma = matrix(c(1,0.71,0.71,2),2,2).
# The series is truncated at default value: Trunc.Series=ceiling(100/3)=34
k <- 2
n <- 300
Trunc.Series <- 50
phi <- array(c(0.5,0.4,0.1,0.5),dim=c(k,k,1))
theta <- array(c(0,0.25,0,0),dim=c(k,k,1))
d <- c(0,0)
sigma <- matrix(c(1,0.71,0.71,2),k,k)
constant <- c(2,5)
trend <- c(0.01,0.08)
demean <- c(10,12)
Z <- varima.sim(phi, theta, d,sigma, n, constant,trend,demean)
plot(Z)
########################################################################
# Simulate a bivariate VARIMA(1,d,1) process with length 300, where d=(1,2).
# phi = array(c(0.5,0.4,0.1,0.5), dim=c(k,k,1)),
# theta = array(c(0,0.25,0,0), dim=c(k,k,1)).
# The process have mean zero and no deterministic terms.
# The variance covariance is sigma = matrix(c(1,0.71,0.71,2),2,2).
# The series is truncated at default value: Trunc.Series=ceiling(100/3)=34
k <- 2
n <- 300
Trunc.Series <- 50
phi <- array(c(0.5,0.4,0.1,0.5),dim=c(k,k,1))
theta <- array(c(0,0.25,0,0),dim=c(k,k,1))
d <- c(1,2)
sigma <- matrix(c(1,0.71,0.71,2),k,k)
Z <- varima.sim(phi, theta, d, sigma, n)
plot(Z)
########################################################################
# Simulate a bivariate VAR(1) process with length 600.
# Stable distribution: ALPHA=(1.3,1.6), BETA=(0,0.2), GAMMA=(1,1), DELTA=(0,0.2)
# The series is truncated at default value: Trunc.Series=min(100,200)=100
k <- 2
n <- 600
phi <- array(c(-0.2,-0.6,0.3,1.1),dim=c(k,k,1))
theta <- NULL
d <- NA
sigma <- matrix(c(1,0.71,0.71,2),k,k)
ALPHA <- c(1.3,1.6)
BETA <- c(0,0.2)
GAMMA <-c(1,1)
DELTA <-c(0,0.2)
StableParameters <- c(ALPHA,BETA,GAMMA,DELTA)
varima.sim(phi,theta,d,sigma,n,StableParameters=StableParameters)
Run the code above in your browser using DataLab