indsim: Simulation time series data for individual

indsimR Documentation

Simulation time series data for individual

Description

A dataset containing values of 10 interested variables over 50 periods.

Usage

indsim

Format

An object of class matrix (inherits from array) with 50 rows and 10 columns.

Examples

## 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

BrainCon documentation built on May 31, 2023, 6:36 p.m.

Related to indsim in BrainCon...