remove testing code in basicInit
[valse.git] / R / generateIO.R
1 library(MASS) #simulate from a multivariate normal distribution
2
3 generateIO = function(meanX, covX, covY, pi, beta, n){ #don't need meanX
4 size_covX = dim(covX)
5 p = size_covX[1]
6 k = size_covX[3]
7
8 size_covY = dim(covY)
9 m = size_covY[1]
10
11 Y = matrix(0,n,m)
12 BX = array(0, dim=c(n,m,k))
13
14 for(i in 1:n){
15 for(r in 1:k){
16 BXir = rep(0,m)
17 for(mm in 1:m){
18 Bxir[[mm]] = X[i,] %*% beta[,mm,r]
19 }
20 Y[i,]=Y[i,] + pi[[r]] * mvrnorm(1,BXir, covY[,,r])
21 }
22 }
23
24 return(list(X,Y))
25 }