Add argument to force continuous or discrete Mode#240
Open
bwiernik wants to merge 2 commits intomjskay:masterfrom
Open
Add argument to force continuous or discrete Mode#240bwiernik wants to merge 2 commits intomjskay:masterfrom
bwiernik wants to merge 2 commits intomjskay:masterfrom
Conversation
Contributor
Author
library(tidyverse)
library(ggdist)
dat <- data.frame(x = as.numeric(datasets::AirPassengers))
data.frame(x = datasets::AirPassengers) |>
ggplot2::ggplot(ggplot2::aes(x = x)) +
ggdist::stat_slab(ggplot2::aes(height = max(ggplot2::after_stat(pdf)))) +
ggdist::stat_spike(
ggplot2::aes(height = max(ggplot2::after_stat(pdf))),
at = Mode
)
#> Don't know how to automatically pick scale for object of type <ts>. Defaulting
#> to continuous.data.frame(x = datasets::AirPassengers) |>
ggplot2::ggplot(ggplot2::aes(x = x)) +
ggdist::stat_slab(ggplot2::aes(height = max(ggplot2::after_stat(pdf)))) +
ggdist::stat_spike(
ggplot2::aes(height = max(ggplot2::after_stat(pdf))),
at = \(x) Mode(x, type = "continuous")
)
#> Don't know how to automatically pick scale for object of type <ts>. Defaulting
#> to continuous.Created on 2024-07-18 with reprex v2.0.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR adds an argument to
Mode()to allow users to force computation of the discrete mode or continuous MAP, for cases where the defaultis_integerish()check makes the incorrect call. Some examples include Poisson or other variables with many distinct discrete values (#236) or dosage data with a small number of discrete decimal values.Closes #236