power analysis in simr - object is not a matrix

76 views Asked by At

I have the following model:

ModelPower <- lmer(DV ~ GroupAbstract * Condition_Cat_Abs + (1|Participant) + (1 + GroupAbstract|Stimulus), data = Dataset)

This model gives the following output:

Random effects:
 Groups      Name                  Variance Std.Dev. Corr 
 Participant (Intercept)           377.401  19.427        
 Stimulus    (Intercept)            91.902   9.587        
             GroupAbstractOutgroup   2.003   1.415   -0.40
 Residual                          338.927  18.410        
Number of obs: 16512, groups:  Participant, 344; Stimulus, 32

Fixed effects:
                                                        Estimate Std. Error         df t value             Pr(>|t|)    
(Intercept)                                              65.8962     2.0239    59.6906  32.559 < 0.0000000000000002 ***
GroupAbstractOutgroup                                    -0.9287     0.5561   129.9242  -1.670               0.0973 .  
Condition_Cat_AbsSecondOrderIn                           -2.2584     0.4963 16103.9277  -4.550           0.00000539 ***
Condition_Cat_AbsSecondOrderOut                          -7.0821     0.4963 16103.9277 -14.270 < 0.0000000000000002 ***
GroupAbstractOutgroup:Condition_Cat_AbsSecondOrderIn     -3.0229     0.7019 16103.9277  -4.307           0.00001665 ***
GroupAbstractOutgroup:Condition_Cat_AbsSecondOrderOut     7.8765     0.7019 16103.9277  11.222 < 0.0000000000000002 ***

I am interested in the interaction "GroupAbstractOutgroup:Condition_Cat_AbsSecondOrderIn" and I am trying to estimate the sample size to detect an effect size of at least -2 using the R package simr. the original slope is -3.02 so I specify the new one:

ModelPower@beta[names(fixef(ModelPower)) %in% "GroupAbstractOutgroup:Condition_Cat_AbsSecondOrderIn"] <- -2

However, regardless of how I specify the powerSim function both for the main effects and interactions (see some examples below), I get power of 0% and the following error when running lastResult()$errors 'object is not a matrix'. I know what the error should mean but even after converting the original data frame and the table of fixed effects to a matrix, the error is still there and I am not sure what it is referring to and how to get the actual output. Any help would be much appreciated!

Examples of the powerSim function:

powerSim(ModelPower, test=fixed("GroupAbstract", "anova"), nsim=10, seed=1)
powerSim(ModelPower, test=fixed("GroupAbstractOutgroup:Condition_Cat_AbsSecondOrderIn", "anova"), nsim=10, seed=1)
0

There are 0 answers