# Variance and covariances from linear mixed model for power simulation using R

I am working with longitudinal data where the outcome is the number of steps per minute. My LMM fit would look like:

lme(step ~ predictor, random = ~1|person, data = df, na.action = na.omit, method = "ML")


Another component of my project is power simulation from simulated data, and I am confused with how I can compute the variance and covariances for step data that are needed to compute "Sigma" from the mvrnorm function.

My sigma function current looks like

Sigma <- matrix(c(varSteps,rep(covSteps,(nRep))),nRep,nRep,byrow=T)


So I am trying to compute "varSteps" and "covSteps" that are needed to construct a sigma matrix that will be used in my mvrnorm function.

How can I compute these two using R or SAS? Your help will be greatly appreciated.