ARTool
ARTool copied to clipboard
Provide option to use Satterthwaite’s approximation
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 anart
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:
- Replace the call to
car::Anova()
with a call tolmerTest::anova()
. The latter function uses KR from thepbkrtest
package that is a bit faster than thecar
package. From the current implementation of theARTool
, I extracted the model usingartlm()
and convert it tolmerModLmerTest
class before callinganova()
:
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")
- Allow the user to pass a parameter to choose the approximation method when call
art()
- Set the default approximation method to Satterthwaite's. This is done by using the
"Satterthwaite"
for theddf
parameter above.