I would like to conduct a power analysis for a linear mixed model with fixed effects for `Treatment`

(two levels) and `Time`

(four time points: `pre`

, `mid`

, `post treatment`

, `3 months post treatment`

) and correlated random effects for children (intercepts and slopes). I am using the following code in R using the `lmer`

function:

```
expdat <- expand.grid(kid = factor(1:500), Time = factor(1:4), Treat = c("XTx", "BAU"))
expdat$obs <- factor(seq(nrow(expdat)))
set.seed(101)
nsim <- 20
beta <- c(100, -7, 8, 15, 20, 0, 0, 0)
theta <- c(15.000000, 7.500000, 7.500000, 7.500000, 12.990381, 4.330127, 4.330127,
12.247449, 3.061862, 11.858541)
ss <- simulate(~Treat*Time + (1+Time | kid), nsim = nsim, family = gaussian,
weights = rep(25, nrow(expdat)), newdata = expdat, newparams =
list(theta = theta, beta = beta, sigma = 1))
expdat$Outcome <- ss[, 1]
fit1 <- lmer(Outcome ~ Treat*Time + (1+Time | kid), data = expdat)
```

I have the following questions:

- In the output I see the variance associated with the random intercepts at each time point and their correlation. However, I cannot find in the output the variance associated with the slopes, and I cannot find information about the correction between the intercepts and the slopes. Where is that information?
- How does the
`lmer`

know that `Time`

has levels and that it should estimate a unique effect for each level of the `Time`

factor instead of a general slope parameter?

I am attaching the summary statement of the model:

```
Linear mixed model fit by REML ['lmerMod']
Formula: Outcome ~ Treat * Time + (1 + Time | kid)
Data: expdat
REML criterion at convergence: 22951.8
Scaled residuals:
Min 1Q Median 3Q Max
-2.55473 -0.47186 -0.00007 0.47268 2.57786
Random effects:
Groups Name Variance Std.Dev. Corr
kid (Intercept) 235.4531 15.3445
Time2 230.9249 15.1962 0.43
Time3 220.6076 14.8529 0.52 0.53
Time4 213.2725 14.6039 0.48 0.51 0.52
Residual 0.9749 0.9874
Number of obs: 4000, groups: kid, 500
Fixed effects:
Estimate Std. Error t value
(Intercept) 100.92006 0.68765 146.76
TreatBAU -6.94796 0.06245 -111.26
Time2 7.39371 0.68246 10.83
Time3 15.17849 0.66717 22.75
Time4 19.27623 0.65608 29.38
TreatBAU:Time2 -0.16052 0.08831 -1.82
TreatBAU:Time3 -0.05291 0.08831 -0.60
TreatBAU:Time4 -0.14215 0.08831 -1.61
Correlation of Fixed Effects:
(Intr) TrtBAU Time2 Time3 Time4 TBAU:T2 TBAU:T3
TreatBAU -0.045
Time2 0.422 0.046
Time3 0.510 0.047 0.528
Time4 0.468 0.048 0.506 0.520
TretBAU:Tm2 0.032 -0.707 -0.065 -0.033 -0.034
TretBAU:Tm3 0.032 -0.707 -0.032 -0.066 -0.034 0.500
TretBAU:Tm4 0.032 -0.707 -0.032 -0.033 -0.067 0.500 0.500
```