# NOT RUN {
## the data was generated by
# }
# NOT RUN {
set.seed(1234)
## simulated data
mu <- cbind(
x = c(0, 0.2,1,0.9),
y = c(0, 0.7,1,0.2)
)
sd_rho <- cbind(
x = c(0.2, 0.15, 0.05, 0.02),
y = c(0.1, 0.04, 0.03, 0.05),
rho = c(0, 0.7, 0.3, -0.4)
)
Sigma <- lapply(1:nrow(sd_rho), FUN = function(i) rbind(
c(sd_rho[i,"x"]^2, sd_rho[i,"rho"]*sd_rho[i,"x"]*sd_rho[i,"y"]),
c(sd_rho[i,"rho"]*sd_rho[i,"x"]*sd_rho[i,"y"], sd_rho[i,"y"]^2)))
sequence <- c(1,2,1,3,4)
EMMsim_sequence_train <- rep(sequence, 40)
EMMsim_sequence_test <- rep(sequence, 5)
library("MASS")
EMMsim_train <- t(sapply(EMMsim_sequence_train, FUN = function(i)
mvrnorm(1, mu=mu[i,], Sigma=Sigma[[i]])))
EMMsim_test <- t(sapply(rep(EMMsim_sequence_test), FUN = function(i)
mvrnorm(1, mu=mu[i,], Sigma=Sigma[[i]])))
# }
Run the code above in your browser using DataLab