# \donttest{
# simulation of healthy controls data
Sigma.ctrl <- matrix(cbind(1, .7, .7, 1) ,nrow=2)
U <- t(chol(Sigma.ctrl))
numobs <- 100
set.seed(123)
random.normal <- matrix( rnorm( n = ncol(U) * numobs, mean = 3, sd = 1),
nrow = ncol(U), ncol = numobs)
X = U %*% random.normal
dat.ctrl <- as.data.frame(t(X))
names(dat.ctrl) <- c("y","x")
cor(dat.ctrl)
# simulation of patient data
Sigma.pt <- matrix(cbind(1, 0, 0, 1) ,nrow=2)
U <- t(chol(Sigma.pt))
numobs <- 20
set.seed(0)
random.normal <- matrix( rnorm( n = ncol(U) * numobs, mean = 3, sd = 1),
nrow = ncol(U), ncol = numobs)
X = U %*% random.normal
dat.pt <- as.data.frame(t(X))
names(dat.pt) <- c("y","x")
cor(dat.pt)
# fit the single case model
mdl.reg <- BMSC(y ~ x, data_ctrl = dat.ctrl, data_sc = dat.pt, seed = 10)
# posterior-predictive check of the model
pp_check(mdl.reg)
# summarize the results
summary(mdl.reg)
# plot the results
plot(mdl.reg)
# }
Run the code above in your browser using DataLab