Simulation of multivariate time series according to a TAR model
Simulation of multivariate time series according to a TAR model
This function simulates multivariate time series according to a user-specified TAR model.
simtar( n, k =2, ars = list(p =1), Intercept =TRUE, parms, delay =0, thresholds =0, t.series, ex.series, dist ="gaussian", extra
)
Arguments
n: a positive integer value indicating the length of the desired output series.
k: a positive integer value indicating the dimension of the desired output series.
ars: a list composed of three objects, namely: p, q and d, each of which corresponds to a vector of l non-negative integers, where l represents the number of regimes in the TAR model.
Intercept: an (optional) logical variable. If TRUE, then the model includes an intercept.
parms: a list with as many sublists as regimes in the user-specified TAR model. Each sublist is composed of two matrices. The first corresponds to location parameters, while the second corresponds to scale parameters.
delay: an (optional) non-negative integer value indicating the delay in the threshold series.
thresholds: a vector with l−1 real values sorted ascendingly.
t.series: a matrix with the values of the threshold series.
ex.series: a matrix with the values of the multivariate exogenous series.
dist: an (optional) character string which allows the user to specify the multivariate distribution to be used to describe the behavior of the noise process. The available options are: Gaussian ("Gaussian"), Student-t ("Student-t"), Slash ("Slash"), Symmetric Hyperbolic ("Hyperbolic"), Laplace ("Laplace"), and contaminated normal ("Contaminated normal"). As default, dist is set to "Gaussian".
extra: a value indicating the value of the extra parameter of the noise process distribution, if any.
Returns
a data.frame containing the output series, threshold series (if any), and multivariate exogenous series (if any).
Examples
###### Simulation of a trivariate TAR model with two regimesn <-2000k <-3ars <- list(p=c(1,2))Z <- as.matrix(arima.sim(n=n+max(ars$p),list(ar=c(0.5))))Intercept <-TRUEparms <- list()for(i in1:length(ars$p)){ np <- Intercept + ars$p[i]*k
parms[[i]]<- list() parms[[i]]$location <- c(ifelse(runif(np*k)<=0.5,1,-1)*rbeta(np*k,shape1=4,shape2=16)) parms[[i]]$location <- matrix(parms[[i]]$location,np,k) parms[[i]]$scale <- rgamma(k,shape=1,scale=1)*diag(k)}thresholds <- quantile(Z,probs=seq(1,length(ars$p)-1)/length(ars$p))out1 <- simtar(n=n,k=k,ars=ars,Intercept=Intercept,parms=parms, thresholds=thresholds,t.series=Z,dist="Student-t",extra=6)str(out1)###### Simulation of a trivariate VAR modeln <-2000k <-3ars <- list(p=2)Intercept <-TRUEparms <- list()for(i in1:length(ars$p)){ np <- Intercept + ars$p[i]*k
parms[[i]]<- list() parms[[i]]$location <- c(ifelse(runif(np*k)<=0.5,1,-1)*rbeta(np*k,shape1=4,shape2=16)) parms[[i]]$location <- matrix(parms[[i]]$location,np,k) parms[[i]]$scale <- rgamma(k,shape=1,scale=1)*diag(k)}out2 <- simtar(n=n,k=k,ars=ars,Intercept=Intercept,parms=parms, dist="Slash",extra=2)str(out2)