Power analysis errors with simr

267 Views Asked by At

HI I am trying to run a power analysis with simr and I am getting some errors. This is my model code and simr code. The error I get is "non-conformable arguments"

I do not have any NAs, so I am not sure what might be causing the error. How do I fix this? I am not sure what could be wrong.

Update I noticed that this particular lmer model stated "Large lmerModLmerTest", while other lmer models (that I have used with simr) stated "Formal class lmerModLmerTest"

I was able to run the simr functions but I had to delete a lot of my data. The data was all data that was being filtered by the model anyways.

data=bsmu[bsmu$ACC == 1 & bsmu$English_comp >= .60 & bsmu$Span_comp >= .60,]

Indeed, the environment changed from "Large lmerModLmerTest" to lmerModLmerTest" and I was able to use the functions in simr.

> summary(rtlmer <- lmer(RT ~Language*DOB + (1|Probe) + (1|Story_order) + (1|Subject), data=bsmu[bsmu$ACC == 1 & bsmu$English_comp >= .60 & bsmu$Span_comp >= .60,]))
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: RT ~ Language * DOB + (1 | Probe) + (1 | Story_order) + (1 |      Subject)
   Data: bsmu[bsmu$ACC == 1 & bsmu$English_comp >= 0.6 & bsmu$Span_comp >=      0.6, ]

REML criterion at convergence: 125294.2

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.3849 -0.4550 -0.1815  0.1684 13.8652 

Random effects:
 Groups      Name        Variance Std.Dev.
 Probe       (Intercept)  194742   441.3  
 Subject     (Intercept)  449359   670.3  
 Story_order (Intercept)  101385   318.4  
 Residual                2700600  1643.4  
Number of obs: 7069, groups:  Probe, 380; Subject, 94; Story_order, 8

Fixed effects:
                    Estimate Std. Error       df t value Pr(>|t|)    
(Intercept)         2620.321    139.702   14.935  18.756  8.6e-12 ***
LanguageSpanish      218.495     56.796  643.690   3.847 0.000131 ***
DOB                   -7.895      8.142  105.927  -0.970 0.334393    
LanguageSpanish:DOB  -10.074      4.294 6831.693  -2.346 0.019007 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) LnggSp DOB   
LangugSpnsh -0.201              
DOB         -0.138  0.037       
LnggSpn:DOB  0.028 -0.146 -0.266
> print(PS_RT <- powerSim(rtlmer, nsim=10, test = fcompare(RT ~ Language*DOB)))
Power for model comparison, (95% confidence interval):======================================================================================================|
       0.00% ( 0.00, 30.85)

Test: Likelihood ratio
      Comparison to RT ~ Language * DOB + [re]

Based on 10 simulations, (0 warnings, 10 errors)
alpha = 0.05, nrow = NA

Time elapsed: 0 h 0 m 0 s

nb: result might be an observed power calculation
Warning message:
In observedPowerWarning(sim) :
  This appears to be an "observed power" calculation
> lastResult()$errors
        stage index                   message
1  Simulating     1 non-conformable arguments
2  Simulating     2 non-conformable arguments
3  Simulating     3 non-conformable arguments
4  Simulating     4 non-conformable arguments
5  Simulating     5 non-conformable arguments
6  Simulating     6 non-conformable arguments
7  Simulating     7 non-conformable arguments
8  Simulating     8 non-conformable arguments
9  Simulating     9 non-conformable arguments
10 Simulating    10 non-conformable arguments
0

There are 0 best solutions below