données simulées
[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{
0b216f85 11 covX = diag(p)
d1531659 12 covY = array(0, dim=c(m,m,k))
13 for(r in 1:k)
14 {
d1531659 15 covY[,,r] = diag(m)
16 }
17
18 pi = rep(1./k,k)
19
20 beta = array(0, dim=c(p,m,k))
21 for(j in 1:p)
22 {
23 nonZeroCount = ceiling(m * runif(1))
24 beta[j,1:nonZeroCount,] = matrix(runif(nonZeroCount*k), ncol=k)
25 }
26
27 sample_IO = generateIO(covX, covY, pi, beta, n)
28 return (list(X=sample_IO$X,Y=sample_IO$Y))
39046da6 29}