ARTool icon indicating copy to clipboard operation
ARTool copied to clipboard

Provide option to use Satterthwaite’s approximation

Open chatchavan opened this issue 3 years ago • 1 comments

This package uses function car::Anova() that implements Kenward-Roger's approximation (KR) to find the degrees of freedom in mixed-effects models. KR could be very slow for a large number of data points. The implementation of KR in the car package is slower than the implementation in the pbkrtest package.

This issue could causes ART to behave strangely from the users' perspective

  • Assigning art() result to a variable is working as expected.
  • However, printing that variable (or directly calling art() without assigning the result to any variable) becomes unresponsive. This was because printing an art object also runs ANOVA behind the scene.

Luke (2017) found that KR and Satterthwaite’s approximation are comparable in terms of Type 1 error. Satterthwaite's method is less time-consuming.

I suggest the following:

  1. Replace the call to car::Anova() with a call to lmerTest::anova(). The latter function uses KR from the pbkrtest package that is a bit faster than the car package. From the current implementation of the ARTool, I extracted the model using artlm() and convert it to lmerModLmerTest class before calling anova():
art_result <- art(y ~ x1 * x2 + (1 | id), data = df_wpm_bkgnd)
m_art_typing_style <- 
  artlm(art_result, "x1") %>% 
  as_lmerModLmerTest()

anova(m_art_typing_style, ddf= "Kenward-Roger")
  1. Allow the user to pass a parameter to choose the approximation method when call art()
  2. Set the default approximation method to Satterthwaite's. This is done by using the "Satterthwaite" for the ddf parameter above.

chatchavan avatar May 02 '21 17:05 chatchavan