'A priori and post hoc power analyses for a linear mixed-effects model with repeated measures

We conducted a pilot study and we have a linear mixed-effects model for repeated measures results:

lmer(value ~ time * group * condition + (1 | id), 
                   data = data)

value: response times with numeric variables (only this is numeric, the other are for grouping) time: pre and post intervention (t1 - t2) group: three different intervention groups condition: reward and neutral conditions

There are some significant results (p values) like here:

                                t value Pr(>|t|)    
(Intercept)                       8.042 3.89e-10 ***
timeT3                            2.886  0.00517 ** 
groupEF                           0.691  0.49332    
groupUMC                          0.633  0.53014    
conditionreward                   1.360  0.17819    
timeT3:groupEF                   -1.670  0.09942 .  
timeT3:groupUMC                  -1.723  0.08931 .  
timeT3:conditionreward           -2.362  0.02093 *  
groupEF:conditionreward          -0.898  0.37226    
groupUMC:conditionreward         -1.183  0.24060    
timeT3:groupEF:conditionreward    1.195  0.23601    
timeT3:groupUMC:conditionreward   1.860  0.06700 .  

I have to do two things:

  1. I have to conduct a post hoc power analysis to calculate the effect size of this pilot)
  2. I have to conduct an a priori power analysis based on the pilot results to calculate the main study parameters. I failed in the first step.

My first question is whether there is a good R package for this. I found "effectsize" and conducted the same https://cran.r-project.org/web/packages/effectsize/vignettes/from_test_statistics.html#in-linear-mixed-models

However, as far as I understand, it converts the model to ANOVE first. My second question is that I lose the significant results when I get ANOVA results like here, is it normal?:

Type III Analysis of Variance Table with Satterthwaite's method
                     Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)
time                 4147.4  4147.4     1 70.476  2.8898 0.09355
group                   7.7     3.8     2 23.406  0.0027 0.99733
condition             698.1   698.1     1 70.476  0.4864 0.48782
time:group           1961.5   980.8     2 70.479  0.6834 0.50823
time:condition       4529.9  4529.9     1 70.476  3.1563 0.07995
group:condition       124.3    62.2     2 70.479  0.0433 0.95763
time:group:condition 5043.6  2521.8     2 70.479  1.7571 0.18002

Then it changes the f score, which is not given in lmer results (but I assume it changes the t value to eta 2) via F_to_eta2() function.

Unlike in the example link below, it gives me lots of lines, maybe because the model is too complex. So, should I calculate eta for each line separately like this: F_to_eta2(2.88, 2, 23.406)? Isn't there any chance to calculate all?

Is it meaningful to change linear mixed model to ANOVA then calculate the effect size? Finally, how can I run an a priori power analysis based on the effect size (eta 2) I got to detect sample size?



Solution 1:[1]

I don't think I can answer your question regarding the ANOVA, however if you're looking for a procedure to estimate the number of participants needed for a lmer based on a pilot study, the package simr provides just that. I would suggest to look at their paper, which has all the necessary details.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 anna_wgl