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

Contrasting slopes: differences between backends #333

Open
DominiqueMakowski opened this issue Jan 13, 2025 · 1 comment · May be fixed by #332
Open

Contrasting slopes: differences between backends #333

DominiqueMakowski opened this issue Jan 13, 2025 · 1 comment · May be fixed by #332
Labels
Bug 🐛 Something isn't working Consistency 🍏 🍎 Expected output across functions or API design could be more similar

Comments

@DominiqueMakowski
Copy link
Member

emmeans acts up funny:

model <- lm(Petal.Width ~ Petal.Length * Species, data = iris)

modelbased::estimate_contrasts(model, contrast="Petal.Length", by="Species", backend="marginaleffectss")
#> Marginal Contrasts Analysis
#> 
#> Parameter              | Coefficient |   SE |        95% CI |     t |     p
#> ---------------------------------------------------------------------------
#> setosa - versicolor    |       -0.13 | 0.16 | [-0.43, 0.17] | -0.83 | 0.808
#> setosa - virginica     |        0.04 | 0.15 | [-0.26, 0.34] |  0.27 | 0.808
#> versicolor - virginica |        0.17 | 0.07 | [ 0.03, 0.31] |  2.41 | 0.048
#> 
#> Marginal contrasts estimated at Petal.Length
#> p-value adjustment method: Holm (1979)
modelbased::estimate_contrasts(model, contrast="Petal.Length", by="Species", backend="emmeans")
#> Marginal Contrasts Analysis
#> 
#> Level1                       |                       Level2 |    Species
#> ------------------------------------------------------------------------
#> Petal.Length1                | Petal.Length1.65555555555556 |     setosa
#> Petal.Length1                | Petal.Length1.65555555555556 | versicolor
#> Petal.Length1                | Petal.Length1.65555555555556 |  virginica
#> Petal.Length1                | Petal.Length2.31111111111111 |     setosa
#> Petal.Length1                | Petal.Length2.31111111111111 | versicolor
#> Petal.Length1                | Petal.Length2.31111111111111 |  virginica
#> Petal.Length1                | Petal.Length2.96666666666667 |     setosa
#> Petal.Length1                | Petal.Length2.96666666666667 | versicolor
#> Petal.Length1                | Petal.Length2.96666666666667 |  virginica
#> Petal.Length1                | Petal.Length3.62222222222222 |     setosa
#> Petal.Length1                | Petal.Length3.62222222222222 | versicolor
#> Petal.Length1                | Petal.Length3.62222222222222 |  virginica
#> ...
#> 
#> Marginal contrasts estimated at Petal.Length
#> p-value adjustment method: Holm (1979)

Created on 2025-01-13 with reprex v2.1.1

@DominiqueMakowski DominiqueMakowski linked a pull request Jan 13, 2025 that will close this issue
@strengejacke
Copy link
Member

You're a bit out of date with the modelbased version, the first example currently doesn't work. Fixed in #331

@strengejacke strengejacke added Bug 🐛 Something isn't working Consistency 🍏 🍎 Expected output across functions or API design could be more similar labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 Something isn't working Consistency 🍏 🍎 Expected output across functions or API design could be more similar
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants