set.seed(13)
temps_obs <- 5
n_subj <- 50
sig <- diag(rep(1,temps_obs))
id <- rep(1:n_subj, each=temps_obs)
rvec <- c(mvtnorm::rmvnorm(n_subj, sigma = sig))
fvec <- (1 + rep(rnorm(n_subj) , each=temps_obs))
xmat <- cbind(rt(n_subj*temps_obs, df=2, ncp=1.3),
1.2 * fvec + rnorm(n_subj * temps_obs, mean = 0.85, sd = 1.5) )
yvec <- 0.6*xmat[, 1] + xmat[, 2] + fvec + rvec
asym <- 0.5
panSizeVec <- unname(unlist(lapply(split(id, id), function(x) length(x))))
erfeVecR(xmat, yvec, panSizeVec, asym, id)
Run the code above in your browser using DataLab