## Not run: ------------------------------------
# # We sample from a graph with 400 time steps.
# # In the first 200 steps the underlying graph is graph A,
# # and in the last 200 steps graph B
#
# p <- 4 # 4 variables
# n <- 400 # number of time steps
# graphA <- graphB <- matrix(0, p, p)
# graphA[2,1] <- graphA[1,2] <- 1 # graphA has edge (2,1)
# graphB[3,4] <- graphB[4,3] <- 1 # graphB has edge (3,4)
# graphs <- array(dim=c(p, p, n))
# graphs[,,1:(n/2)] <- graphA
# graphs[,,(n/2+1):n] <- graphB
#
# # specify type and thresholds
# type <- c('g', 'g', 'c', 'c') # two Gaussian, two Binary
# lev <- c(1, 1, 2, 2)
# # zero means (Gaussians) and thresholds (Binary)
# thresh <- list(0, 0 , c(0, 0), c(0, 0))
# # same means/thresholds at all time steps
# threshs <- list(); for(nIter in 1:n) threshs[[nIter]] <- thresh
#
# # sample
# set.seed(1)
# data <- tv.mgmsampler(type, lev, graphs, threshs)
#
# # look at sampled data
# dim(data)
# head(data)
## ---------------------------------------------
Run the code above in your browser using DataLab