Skip to content

Suggestion: Add Examples with Error(subject/(A*B)) for Repeated Measures in ARTool Documentation #45

@hynchl

Description

@hynchl

I’d like to propose adding examples for n-factor repeated measures designs using error terms like Error(subject/(A*B)), where A and B are fixed effects, to the official documentation:
https://cran.r-project.org/web/packages/ARTool/ARTool.pdf

To incorporate an error term, I tried the formula art(Y ~ A*B + Error(S), data = ElkinAB). While this syntax executes without issue, it seems to result in the invalid residual degrees of freedom for all main and interaction effects. This user behavior can potentially lead to invalid or misleading test results.

m <- art(Y~A*B + Error(S), ElkinAB)
anova(m)

Result:

Analysis of Variance of Aligned Rank Transformed Data

Table Type: Repeated Measures Analysis of Variance Table (Type I) 
Model: Repeated Measures (aov)
Response: art(Y)

      Error Df Df.res F value              Pr(>F)    
1 A   Withn  1     21 561.556 <0.0000000000000002 ***
2 B   Withn  1     21  14.372               0.001  **
3 A:B Withn  1     21  16.403              0.0006 ***
---
Signif. codes:   0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Result from Error(S/(A+B))

m <- art(Y~A*B + Error(S/(A*B)), ElkinAB)
anova(m)

Result:

Analysis of Variance of Aligned Rank Transformed Data

Table Type: Repeated Measures Analysis of Variance Table (Type I) 
Model: Repeated Measures (aov)
Response: art(Y)

      Error Df Df.res F value    Pr(>F)    
1 A     S:A  1      7 379.050 0.0000002 ***
2 B     S:B  1      7  24.155     0.002  **
3 A:B S:A:B  1      7  29.319 0.0009927 ***
---
Signif. codes:   0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Because of this, I believe such usage (i.e., Error(S)) should either be discouraged or clearly explained in case of repeated measures design. Therefore, I suggest including an example using Error(subject/(A*B)).

Currently, the documentation provides a repeated measures example only via a linear mixed-effects model (lmer) with (1|S). Including a parallel example using
Error(subject/(A*B)) would be highly useful for those not working with mixed models.

Could you consider adding such an example or clarifying this behavior in the documentation? I’d appreciate any feedback.

Thank you!

Related Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions