From: emilie Date: Tue, 6 Dec 2016 12:29:09 +0000 (+0100) Subject: données simulées X-Git-Url: https://git.auder.net/js/pieces/css/rpsls.css?a=commitdiff_plain;h=0b216f854a21821f9be375d07c2932b31e227e78;p=valse.git données simulées --- 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 mode 100644 index 0000000..a9f09e1 Binary files /dev/null and b/data/data.RData differ