mjskay / mjskay/ARTool

Provide option to use Satterthwaite’s approximation

Open
#30 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
R
Stars
66
Forks
9
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how art() printing invokes ANOVA through the current car::Anova() path, then compare the artlm() and lmerTest::anova() flow described in the issue. The work is done when users can choose the degrees-of-freedom approximation in art(), with Satterthwaite as the default, without breaking existing ANOVA behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.