pitakakariki / simr

Power Analysis of Generalised Linear Mixed Models by Simulation
68 stars 19 forks source link

non-conformable arguments erorr #261

Closed ocarrasco90 closed 1 year ago

ocarrasco90 commented 1 year ago

I am trying to run a power analysis using Powersim. However, I keep getting the same error "non-conformable arguments". I can run other models successfully. However, I noticed other models say "Formal class lmerModLmerTest" in the environment, and the model with the error states "Large lmerModLmerTest". Could it be that I have too much data?

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: 126389.4

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.3955 -0.4533 -0.1789  0.1674 13.9215 

Random effects:
 Groups      Name        Variance Std.Dev.
 Probe       (Intercept)  192886   439.2  
 Subject     (Intercept)  452216   672.5  
 Story_order (Intercept)  102327   319.9  
 Residual                2678943  1636.7  
Number of obs: 7134, groups:  Probe, 380; Subject, 95; Story_order, 8

Fixed effects:
                    Estimate Std. Error       df t value Pr(>|t|)    
(Intercept)         2612.787    140.013   14.833  18.661 1.04e-11 ***
LanguageSpanish      216.638     56.417  641.622   3.840 0.000135 ***
DOB                   -8.171      8.155  106.824  -1.002 0.318663    
LanguageSpanish:DOB  -10.116      4.274 6894.874  -2.367 0.017975 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) LnggSp DOB   
LangugSpnsh -0.199              
DOB         -0.139  0.038       
LnggSpn:DOB  0.028 -0.149 -0.264
> 
> 
> 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
pitakakariki commented 1 year ago

Will need more information. Could you please run doSim(rtlmer) to see what error message it gives, and then traceback() so we can see where it's coming from?

Note that you probably want fcompare(~ Language + DOB) - with fcompare(~ Language * DOB) you would be comparing the model to itself.