set.seed(13)
temps_obs <- 5
n_subj <- 50
id <- rep(1:n_subj, each=temps_obs)
asym <- 0.5
panSizeVec <- unname(unlist(lapply(split(id, id), function(x) length(x))))
ymat <- matrix(NA, nrow = n_subj * temps_obs, ncol = 5)
ymat <- matrix(mvtnorm::rmvnorm(n_subj * ncol(ymat),
sigma = diag(rep(1, temps_obs))), ncol = ncol(ymat))
aweight <- rep(asym, temps_obs * n_subj)
aweight[!(ymat[, 1] > mean(ymat[, 1]))] = 1 - asym
dexpectilizeMatR(ymat, aweight, panSizeVec)
Run the code above in your browser using DataLab