Plotting contrasts for categorical model with interaction
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- r
- Domain
- data-visualization
Research direction
Start by running the supplied Arabidopsis example with estimate_means(), estimate_contrasts(), and plot(contrasts, means), including facet_wrap(vars(status)). Inspect how the plotting entry point combines contrasts and means; the work is done when the categorical interaction contrasts render in separate status facets without changing their calculated values.
Written by the indexing model from the issue text.
Description
When plotting contrasts for a model with an interaction term between two categorical variables, is it possible to split the lighthouse plots into facets?
It seems to me that the contrast are correctly calculated, but the output plot is not what I would expect.
library(ggplot2)
library(modelbased)
library(see)
data("Arabidopsis", package = "lme4")
model = lm(total.fruits ~ amd*status, Arabidopsis)
means = estimate_means(model)
#> We selected `by = c("amd", "status")`.
contrasts = estimate_contrasts(model, contrast = "amd", by = "status")
contrasts
#> Marginal Contrasts Analysis
#>
#> Level1 | Level2 | status | Difference | 95% CI | SE | t(619) | p
#> ----------------------------------------------------------------------------------------
#> clipped | unclipped | Normal | -5.73 | [-14.02, 2.56] | 4.22 | -1.36 | 0.175
#> clipped | unclipped | Petri.Plate | -4.62 | [-21.61, 12.38] | 8.65 | -0.53 | 0.594
#> clipped | unclipped | Transplant | 0.37 | [-12.48, 13.21] | 6.54 | 0.06 | 0.955
#>
#> Marginal contrasts estimated at amd
#> p-value adjustment method: Holm (1979)
plot(contrasts, means) +
facet_wrap(vars(status))

Created on 2024-10-28 with reprex v2.1.0
- Dominant language
- R
- Stars
- 263
- Forks
- 22
- Avg merge
- 1h 22m
- Merged PRs (30d)
- 11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from easystats/modelbased
-
What's your opinion :hear_no_evil:
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
easystats/modelbased#651 · 3 comments ·
-
What's your opinion :hear_no_evil:
Difficulty 5/5 Over a week Newbie friendliness 35/100
easystats/modelbased#609 · 3 comments ·
-
Bug :bug: Consistency :green_apple: :apple:
Difficulty 3/5 1-2 days Newbie friendliness 50/100
easystats/modelbased#605 ·
-
Enhancement :boom:
Difficulty 5/5 Over a week Newbie friendliness 25/100
easystats/modelbased#591 · 3 comments ·
-
3 investigators :grey_question::question: Consistency :green_apple: :apple:
Difficulty 4/5 3-5 days Newbie friendliness 35/100
easystats/modelbased#579 · 9 comments ·
All issues in easystats/modelbased
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
robjhyndman/forecast#1220 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
JamesHWade/deputy#192 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug triage_needed
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
pharmaverse/rtables#1123 · 1 comment ·