indsim | R Documentation |
A dataset containing values of 10 interested variables over 50 periods.
indsim
An object of class matrix
(inherits from array
) with 50 rows and 10 columns.
## Generated by the following R codes
set.seed(1000)
n = 50; p = 10
Precision = diag(rep(2, p)) # generate precision matrix
for (i in 1 : (p - 1)){
temp = ifelse(i > 2 * p / 3, 0.4, 1)
Precision[i, i + 1] = temp
Precision[i + 1, i] = temp
}
# R=-cov2cor(Precision) + diag(rep(2, p)) # real partial correlation matrix
Sigma = solve(Precision) # generate covariance matrix
rho = 0.5
y = matrix(0, n, p) # generate observed time series data
Epsilon = MASS::mvrnorm(n, rep(0, p), Sigma)
y[1, ] = Epsilon[1, ]
for (i in 2 : n){
y[i, ] = rho * y[i - 1, ] + sqrt(1 - rho^2) * Epsilon[i, ]
}
indsim = y
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.