easystats / easystats/modelbased
estimate_means() : option for prediction interval/include sigma
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 263
- Forks
- 22
- Avg merge
- 1h 22m
- Merged PRs (30d)
- 11
Description
I'd like to be able to make this plot, visualizing a discrete predictor, with estimated group means and prediction intervals. I'd also like to include densities.
library(see)
dat_mtcars <- transform(mtcars, am = factor(am))
m <- lm(mpg ~ am, data = dat_mtcars)
modelbased::estimate_means(m, at = "am") |> plot() + ggdist::stat_dist_halfeye(ggplot2::aes(x = am, dist = distributional::dist_normal(Mean, sqrt(SE^2 + sigma(m)^2)), fill = am), alpha = .5, width = .2) + see::theme_modern() + ggplot2::guides(fill = "none")

Created on 2021-09-08 by the reprex package (v2.0.1)
To accomplish this, we would need two changes:
- Add option to estimate_means() for prediction intervals
- Add option to include densities to estimate means / estimate_prediction family with discrete x
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.
Research direction
Start with estimate_means() and the estimate_prediction family, using the supplied mtcars and lm() example as the expected use case. Determine how prediction intervals and densities should be exposed for discrete x values; done means both requested options work for the demonstrated plot.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100