Skip to content

ppc_stat for discrete test statistics? #330

Open
@santikka

Description

@santikka

It seems that ppc_stat always assumes that the test statistic defined by stat is continuous, and thus draws a histogram, which is fine but sometimes looks quite ugly, for example:

set.seed(0)
y <- rbinom(20, 1, 0.2)
yrep <- matrix(rbinom(2000, 1, prob = 0.4), 1000, 20, byrow = TRUE)
bayesplot::ppc_stat(y, yrep, function(x) sum(abs(diff(x))))
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Created on 2024-10-14 with reprex v2.1.1

Is there an option (or another function) to specify that the test statistic is discrete, so that ppc_stat would produce a barplot instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions