Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide option to use Satterthwaite’s approximation #30

Open
chatchavan opened this issue May 2, 2021 · 1 comment
Open

Provide option to use Satterthwaite’s approximation #30

chatchavan opened this issue May 2, 2021 · 1 comment

Comments

@chatchavan
Copy link

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.
@mjskay
Copy link
Owner

mjskay commented May 5, 2021

This all sounds very reasonable. I don't currently have a ton of cycles for this, so I'm not likely to get to it in the short term, but I am happy to accept pull requests :). The changes would probably have to happen in flat.anova.R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants