easystats / easystats/modelbased

Prediction plots for logistic models: improvements

Open
#120 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Plot :sparkler:
Dominant language
R
Stars
263
Forks
22
Avg merge
1h 22m
Merged PRs (30d)
11

Description

The current default plot for logistic models is like that:

p <- plot(modelbased::estimate_relation(glm(vs ~ mpg, data = mtcars, family = "binomial")))
p

However, when the outcome variable is not on the 0-1 scale, but is a factor (and thus 1-2 by default), the plot is messed up:

p <- plot(modelbased::estimate_relation(glm(sex ~ body_mass_g, data = palmerpenguins::penguins, family = "binomial")))
p

Created on 2021-06-09 by the reprex package (v1.0.0)

What would be the most elegant solution to plot the line on the outcome's scale?


On a related note, I'm thinking about moving from a pseudo-rug geoms for data points towards maybe something that would look like this:

image

What's the best way to create something like that? Using ggdists?

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 the estimate_relation() and plot() examples in the issue, comparing the 0–1 logistic outcome with the factor outcome shown in the linked images. Review the referenced barelysignificant.com example and the question about ggdists; done should define an agreed approach for plotting the line on the outcome scale and replacing the pseudo-rug presentation.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.