From 0b216f854a21821f9be375d07c2932b31e227e78 Mon Sep 17 00:00:00 2001 From: emilie <emilie@devijver.org> Date: Tue, 6 Dec 2016 13:29:09 +0100 Subject: [PATCH] =?utf8?q?donn=C3=A9es=20simul=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- R/generateIO.R | 6 ++++-- R/generateIOdefault.R | 3 +-- data/TODO | 2 ++ data/data.RData | Bin 0 -> 1010 bytes 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 data/data.RData diff --git a/R/generateIO.R b/R/generateIO.R index 0e776d0..4527f08 100644 --- a/R/generateIO.R +++ b/R/generateIO.R @@ -16,16 +16,18 @@ generateIO = function(covX, covY, pi, beta, n) 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]) } } diff --git a/R/generateIOdefault.R b/R/generateIOdefault.R index 85213cc..3613f2b 100644 --- a/R/generateIOdefault.R +++ b/R/generateIOdefault.R @@ -8,11 +8,10 @@ #----------------------------------------------------------------------- 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) } diff --git a/data/TODO b/data/TODO index c0603b4..a3bb58d 100644 --- a/data/TODO +++ b/data/TODO @@ -1,2 +1,4 @@ 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)' diff --git a/data/data.RData b/data/data.RData new file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