How to simulate type I error for random-effects model? Building upon this post How to simulate type I error and type II error. I would like to simulate type I error for a random-effects model I generated. The statistic of interest is standard deviations of the random intercept and random slope. Specifically, for random intercept, $H_{0}$: $\lambda_{0} =2$ and $H_{1}$: $\lambda_{0} \neq 2$; for random slope, $H_{0}$: $\lambda_{1} =1$ and $H_{1}$: $\lambda_{1} \neq 1$. I assume the test would be likelihood ratio test but please correct me if I am wrong. How do I assess type I error for the random-effects model I specified below:
        set.seed(323)
        # The following code is to specify the structure and 
        # parameters of the random-effects model
        dtfunc = function(nsub){
          time = 0:9
          rt = c() 
          time.all = rep(time, nsub)
          subid.all = as.factor(rep(1:nsub, each = length(time)))
          
          # Step 1:  Specify the lambdas.  
          G = matrix(c(2^2, 0, 0, 1^2), nrow = 2)  
          int.mean = 251  
          slope.mean = 10  
          sub.ints.slopes = mvrnorm(nsub, c(int.mean, slope.mean), G)
          sub.ints = sub.ints.slopes[,1]
          time.slopes = sub.ints.slopes[,2]
          
          # Step 2:  Use the intercepts and slopes to 
          # generate RT data
          sigma = 30      
          for (i in 1:nsub){
            rt.vec = sub.ints[i] + time.slopes[i]*time + 
                       rnorm(length(time), sd = sigma)
            rt = c(rt, rt.vec)
          }
          
          dat = data.frame(rt, time.all, subid.all)
          return(dat)
        }
        
        #Here I run one random-effects model
        set.seed(10) 
        dat = dtfunc(16)
        lmer(rt~time.all + (1+time.all |subid.all), dat)

Assuming the test for significance is likelihood ratio test and so in the end, I want to see if I run the test 1000 times, what is the probability of rejecting null hypothesis when it is TRUE. Also, how do I plot the behavior of type I error if I change the values of standard deviations?
 A: You reject when $p\le\alpha$ for some $\alpha$ like $0.05$, right? When do you that over the course of the $1000$ iterations, how many rejections do you have?
If the test is doing what it claims, you will have about $1000\alpha$ rejections of the true null hypothesis, so $\sim50$ rejections at the $0.05$-level.
I have not done this for a random effects model, but I have gotten into a habit of plotting the empirical CDF of all of the p-values from my simulations like this. This is a way to visualize the type I error rate across a spectrum of $\alpha$-levels.
EDIT
I will demonstrate this with a t-test.
set.seed(2022)
N <- 100 # sample size
R <- 1000 # Number of repetitions 
ps <- rep(NA, R)
for (i in 1:R){

    # Simulate draws from two equal distributions
    #
    x <- rnorm(N)
    y <- rnorm(N)

    # Run the t-test
    #
    ps[i] <- t.test(x, y, var.equal = TRUE)$p.value
}

# Plot the p-value CDF, along with y = x line 
#
plot(ps, ecdf(ps)(ps))
abline(0, 1)

# State type I error rates at common levels
# alpha = 0.10
# alpha = 0.05
# alpha = 0.01
#
print(paste("Type I error rate at 0.10-level is:", ecdf(ps)(0.10)))
print(paste("Type I error rate at 0.05-level is:", ecdf(ps)(0.05)))
print(paste("Type I error rate at 0.01-level is:", ecdf(ps)(0.01)))

