easystats / easystats/modelbased

estimate_means() : option for prediction interval/include sigma

Open
#146 5 comments 0 reactions 0 assignees View on GitHub

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:

  1. Add option to estimate_means() for prediction intervals
  2. Add option to include densities to estimate means / estimate_prediction family with discrete x

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.