## verify MVN with base R
set.seed(732)
Lex <- chol_s2Dp(corr.structure = "ar1",
im.res = c(3, 3),
rho = 0.25,
sigma = 1,
use.spam = FALSE,
corr.min = 0.02,
triangle = "lower",
return.cov = TRUE)
XbR = sim_MVN_X(N = 1000, mu = 0, L = Lex$L)
apply(XbR, 2, mean)
cov(XbR)
Lex$S
## verify MVN with \code{spam}
set.seed(472)
Rex <- chol_s2Dp(im.res = c(3, 3), matrix.type = "prec",
use.spam = TRUE, neighborhood = "ar1",
triangle = "upper", return.prec = TRUE)
Xspam = sim_MVN_X(N = 1000, mu = 0, R = Rex$R, Q = Rex$Q)
apply(Xspam, 2, mean)
solve(cov(Xspam))
as.matrix(Rex$Q)
## Categories
set.seed(832)
Xtest <- sim_MVN_X(N = 30, mu = 0, L = Lex$L,
X.categorical = TRUE,
X.num.categories = 3,
X.category.type = "percentile",
X.cat.names = c("A", "B", "C"))
Xtest
Run the code above in your browser using DataLab