ajout des commentaires Roxygen - anglicisme de certains noms de fonctions et de variables
[valse.git] / R / generateIOdefault.R
CommitLineData
d1531659 1#' Generate a sample of (X,Y) of size n with default values
2#' @param n sample size
3#' @param p number of covariates
4#' @param m size of the response
5#' @param k number of clusters
6#' @return list with X and Y
7#' @export
8#-----------------------------------------------------------------------
39046da6
BA
9generateIOdefault = function(n, p, m, k)
10{
d1531659 11 covX = array(0, dim=c(p,p,k))
12 covY = array(0, dim=c(m,m,k))
13 for(r in 1:k)
14 {
15 covX[,,r] = diag(p)
16 covY[,,r] = diag(m)
17 }
18
19 pi = rep(1./k,k)
20
21 beta = array(0, dim=c(p,m,k))
22 for(j in 1:p)
23 {
24 nonZeroCount = ceiling(m * runif(1))
25 beta[j,1:nonZeroCount,] = matrix(runif(nonZeroCount*k), ncol=k)
26 }
27
28 sample_IO = generateIO(covX, covY, pi, beta, n)
29 return (list(X=sample_IO$X,Y=sample_IO$Y))
39046da6 30}