sim_data {mbsts} | R Documentation |
Simulate data
Description
Generate simulated data in the form of structural time series
Usage
sim_data(
X,
beta,
cov,
k,
mu,
rho,
mean_trend = 1,
sd_trend = 0.5,
mean_season = 20,
sd_season = 0.5,
mean_cycle = 20,
sd_cycle = 0.5,
Dtilde,
Season,
vrho,
lambda
)
## S4 method for signature 'array'
sim_data(
X,
beta,
cov,
k,
mu,
rho,
mean_trend = 1,
sd_trend = 0.5,
mean_season = 20,
sd_season = 0.5,
mean_cycle = 20,
sd_cycle = 0.5,
Dtilde,
Season,
vrho,
lambda
)
Arguments
X |
A ( |
beta |
A ( |
cov |
A ( |
k |
A |
mu |
A |
rho |
A |
mean_trend |
A numerical value standing for the mean of the error term of the trend component. The default value is |
sd_trend |
A numerical value standing for the standard deviation of the error term of the trend component. The default value is |
mean_season |
A numerical value standing for the mean of the error term of the seasonal component. The default value is |
sd_season |
A numerical value standing for the standard deviation of the error term of the seasonal component. The default value is |
mean_cycle |
A numerical value standing for the mean of the error term of the cycle component. The default value is |
sd_cycle |
A numerical value standing for the standard deviation of the error term of the cycle component. The default value is |
Dtilde |
A |
Season |
A |
vrho |
A |
lambda |
A |
Author(s)
Jinwen Qiu qjwsnow_ctw@hotmail.com Ning Ning patricianing@gmail.com
References
Qiu, Jammalamadaka and Ning (2018), Multivariate Bayesian Structural Time Series Model, Journal of Machine Learning Research 19.68: 1-33.
Ning and Qiu (2021), The mbsts package: Multivariate Bayesian Structural Time Series Models in R.
Jammalamadaka, Qiu and Ning (2019), Predicting a Stock Portfolio with the Multivariate Bayesian Structural Time Series Model: Do News or Emotions Matter?, International Journal of Artificial Intelligence, Vol. 17, Number 2.
Examples
###############Setup###########
n<-505 #n: sample size
m<-2 #m: dimension of target series
cov<-matrix(c(1.1,0.7,0.7,0.9), nrow=2, ncol=2) #covariance matrix of target series
###############Regression component###########
#coefficients for predictors
beta<-t(matrix(c(2,-1.5,0,4,2.5,0,0,2.5,1.5,-1,-2,0,0,-3,3.5,0.5),nrow=2,ncol=8))
set.seed(100)
X1<-rnorm(n,5,5^2)
X4<-rnorm(n,-2,5)
X5<-rnorm(n,-5,5^2)
X8<-rnorm(n,0,100)
X2<-rpois(n, 10)
X6<-rpois(n, 15)
X7<-rpois(n, 20)
X3<-rpois(n, 5)
X<-cbind(X1,X2,X3,X4,X5,X6,X7,X8)
###############Simulated data################
set.seed(100)
data=sim_data(X=X, beta=beta, cov, k=c(8,8), mu=c(1,1), rho=c(0.6,0.8),
Dtilde=c(-1,3), Season=c(100,0), vrho=c(0,0.99), lambda=c(0,pi/100))