Issues with powerSim: new levels detected in new data: 120, 125, 336, 347"

37 views Asked by At

I'm running into an issue where I receive the following error when trying to use powerSim to estimate power for my multilevel model. All my variables including DV and IV are continuous variables. Here are my codes for my model and powerSim.

#sample data can be download from:
https://github.com/Keykiwinnie/myproject/blob/main/sampledata.csv

#My model:
m1<- lmer(a_p2relsat ~ (Avoidance_centering + Anxiety_centering) * Identification_centering+
(1|ID), control = lmerControl(optimizer = "bobyqa"),data = S2)

#changing effect size of ['Avoidance_centering:Identification_centering'] to 0.2:
model_size <- m1
fixef(model_size) ['Avoidance_centering:Identification_centering'] <- 0.2

# performing power analysis using powerSim()
power_m1 <- powerSim(model_size, test=fcompare(a_p2relsat~Avoidance_centering:Identification_centering),
nsim=400)
power_m1

#the output for power_m1 is listed below:
>power_m1
Power for model comparison, (95% confidence interval):
0.00% ( 0.00, 0.92)
Test: Likelihood ratio
Comparison to a_p2relsat ~ Avoidance_centering:Identification_centering + [re]
Based on 400 simulations, (0 warnings, 400 errors)
alpha = 0.05, nrow = NA
Time elapsed: 0 h 0 m 5 s

#I checked lastResult()$errors, and the output showed:
>lastResult()$errors
stage index message
1 Simulating 1 new levels detected in newdata: 120, 125, 336, 347
2 Simulating 2 new levels detected in newdata: 120, 125, 336, 347
3 Simulating 3 new levels detected in newdata: 120, 125, 336, 347
4 Simulating 4 new levels detected in newdata: 120, 125, 336, 347
5 Simulating 5 new levels detected in newdata: 120, 125, 336, 347
6 Simulating 6 new levels detected in newdata: 120, 125, 336, 347
7 Simulating 7 new levels detected in newdata: 120, 125, 336, 347
8 Simulating 8 new levels detected in newdata: 120, 125, 336, 347
9 Simulating 9 new levels detected in newdata: 120, 125, 336, 347
10 Simulating 10 new levels detected in newdata: 120, 125, 336, 347


0

There are 0 answers