Skip to content

Create option to use a dot-plot in visualize() #548

@kzembower

Description

@kzembower

Create the ability for visualize() to display a dotplot, in addition to a barchart

As a first-year statistics student, I think it would be useful for visualize() to be able to display a dotplot, in addition to a barchart.

I realize that this would just be a cosmetic change, and would not add to the information already displayed by visualize(). However, in my course, we are using the popular statistics textbook, "Statistics: Unlocking the Power of Data" by Lock, Lock, Lock, Lock and Lock (third edition). This textbook makes heavy use of dotplots in their examples of hypothesis tests and computation of confidence intervals.

Even though I don't think it's needed, here's a MWE:

library(infer)

set.seed(1)

df <- data.frame(d = rnorm(100))
str(df)

(xbar <- df %>%
     specify(response = d) %>%
     calculate(stat = "mean"))

null_dist <- df %>%
    specify(response = d) %>%
    hypothesize(null = "point", mu = 0) %>%
    generate(reps = 1000, type = "bootstrap") %>%
    calculate(stat = "mean")

visualize(null_dist) +
    shade_p_value(obs_stat = xbar, direction = "two-tailed")

As I said, this would not add anything of significance to the infer library, but may make it more approachable for beginning statistics students.

Thanks for considering this feature request.

-Kevin

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