[go: up one dir, main page]

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

Pairwise paired contrasts? #237

Open
jmgirard opened this issue Oct 7, 2023 · 0 comments
Open

Pairwise paired contrasts? #237

jmgirard opened this issue Oct 7, 2023 · 0 comments

Comments

@jmgirard
Copy link
jmgirard commented Oct 7, 2023

This may be an {emmeans} question, but if I run a one-way repeated measures ANOVA and give it to estimate_contrasts(), is it doing paired t-tests for each pair? I'm confused by the dfs listed.

data("selfesteem", package = "datarium")
selfesteem
#>    id       t1       t2       t3
#> 1   1 4.005027 5.182286 7.107831
#> 2   2 2.558124 6.912915 6.308434
#> 3   3 3.244241 4.443434 9.778410
#> 4   4 3.419538 4.711696 8.347124
#> 5   5 2.871243 3.908429 6.457287
#> 6   6 2.045868 5.340549 6.653224
#> 7   7 3.525992 5.580695 6.840157
#> 8   8 3.179425 4.370234 7.818623
#> 9   9 3.507964 4.399808 8.471229
#> 10 10 3.043798 4.489376 8.581100
library(easystats)
#> # Attaching packages: easystats 0.6.0
#> ✔ bayestestR  0.13.1   ✔ correlation 0.8.4 
#> ✔ datawizard  0.9.0    ✔ effectsize  0.8.6 
#> ✔ insight     0.19.5   ✔ modelbased  0.8.6 
#> ✔ performance 0.10.5   ✔ parameters  0.21.2
#> ✔ report      0.5.7    ✔ see         0.8.0
sel <- data_to_long(selfesteem, select = c(t1, t2, t3))
fit <- aov(value ~ name + Error(id), data = sel)
estimate_contrasts(fit, contrast = "name", method = "pairwise")
#> Warning: Could not recover model data from environment. Please make sure your
#>   data is available in your workspace.
#>   Trying to retrieve data from the model frame now.
#> Note: re-fitting model with sum-to-zero contrasts
#> Marginal Contrasts Analysis
#> 
#> Level1 | Level2 | Difference |         95% CI |   SE | t(26.00) |      p
#> ------------------------------------------------------------------------
#> t1     |     t2 |      -1.79 | [-2.83, -0.76] | 0.40 |    -4.45 | < .001
#> t1     |     t3 |      -4.50 | [-5.53, -3.46] | 0.40 |   -11.16 | < .001
#> t2     |     t3 |      -2.70 | [-3.73, -1.67] | 0.40 |    -6.71 | < .001
#> 
#> Marginal contrasts estimated at name
#> p-value adjustment method: Holm (1979)

Created on 2023-10-07 with reprex v2.0.2

If each contrast is a paired $t$-test, then shouldn't its df be the number of paired differences minus 1 (e.g., 9 in this case)? Instead, it lists the df as 26 (presumably n - g - 1). Is this a mistake or am I misunderstanding something about how contrasts work?

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

No branches or pull requests

1 participant