projects
/
valse.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
progress in debug: fix LLF/llh mismatch, and length + add adapter test in test/
[valse.git]
/
pkg
/
R
/
generateXY.R
diff --git
a/pkg/R/generateXY.R
b/pkg/R/generateXY.R
index
fe86045
..
064b54b
100644
(file)
--- a/
pkg/R/generateXY.R
+++ b/
pkg/R/generateXY.R
@@
-17,14
+17,14
@@
generateXY <- function(n, π, meanX, β, covX, covY)
p <- dim(covX)[1]
m <- dim(covY)[1]
k <- dim(covY)[3]
p <- dim(covX)[1]
m <- dim(covY)[1]
k <- dim(covY)[3]
-
+
X <- matrix(nrow = 0, ncol = p)
Y <- matrix(nrow = 0, ncol = m)
X <- matrix(nrow = 0, ncol = p)
Y <- matrix(nrow = 0, ncol = m)
-
+
# random generation of the size of each population in X~Y (unordered)
sizePop <- rmultinom(1, n, π)
# random generation of the size of each population in X~Y (unordered)
sizePop <- rmultinom(1, n, π)
- class <- c()
#map i in 1:n --> index of class in 1:k
-
+ class <- c() #map i in 1:n --> index of class in 1:k
+
for (i in 1:k)
{
class <- c(class, rep(i, sizePop[i]))
for (i in 1:k)
{
class <- c(class, rep(i, sizePop[i]))
@@
-33,7
+33,7
@@
generateXY <- function(n, π, meanX, β, covX, covY)
Y <- rbind(Y, t(apply(newBlockX, 1, function(row) MASS::mvrnorm(1, row %*%
β[, , i], covY[, , i]))))
}
Y <- rbind(Y, t(apply(newBlockX, 1, function(row) MASS::mvrnorm(1, row %*%
β[, , i], covY[, , i]))))
}
-
+
shuffle <- sample(n)
list(X = X[shuffle, ], Y = Y[shuffle, ], class = class[shuffle])
}
shuffle <- sample(n)
list(X = X[shuffle, ], Y = Y[shuffle, ], class = class[shuffle])
}