Dear All, Suppose I have a regular linear mixed model Y|b~ X*beta+Z*b+error; b~N(0, Psi) and would like to fit it to a simulated data, where Y, X and Z are known. I checked some reference but examples are given with the specified variable names. Could some one help me out, please? # R code to try require(MASS) require(lme4) n <- 20 beta <- c( -0.5, 1) psi <- matrix(c(1,0.2,0.2,1),2,2) b <- mvrnorm(n=1, mu=c(0,0), Sigma=psi ) X <- cbind(rep(1,n),1:n) Z <- X Y <- X%*%beta+ Z%*%b+rnorm(n,0,1) ?lmer Thank you. Best wishes, Jie [[alternative HTML version deleted]]