k = dim(covY)[3]
Y = matrix(0,n,m)
- BX = array(0, dim=c(n,m,k))
+ require(mvtnorm)
+ X = rmvnorm(n, mean = rep(0,p), sigma = covX)
require(MASS) #simulate from a multivariate normal distribution
for (i in 1:n)
{
+
for (r in 1:k)
{
BXir = rep(0,m)
for (mm in 1:m)
- Bxir[[mm]] = X[i,] %*% beta[,mm,r]
+ BXir[mm] = X[i,] %*% beta[,mm,r]
Y[i,] = Y[i,] + pi[r] * mvrnorm(1,BXir, covY[,,r])
}
}
#-----------------------------------------------------------------------
generateIOdefault = function(n, p, m, k)
{
- covX = array(0, dim=c(p,p,k))
+ covX = diag(p)
covY = array(0, dim=c(m,m,k))
for(r in 1:k)
{
- covX[,,r] = diag(p)
covY[,,r] = diag(m)
}
Trouver un jeu de données (+) intéressant (que les autres) ?
Ajouter toy datasets pour les tests (ou piocher dans MASS ?)
+
+ED : j'ai simulé un truc basique via 'generateIOdefault(10,5,6,2)'