Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow direction = "two.sided" in get_p_value() #355

Closed
richierocks opened this issue Dec 29, 2020 · 2 comments
Closed

Allow direction = "two.sided" in get_p_value() #355

richierocks opened this issue Dec 29, 2020 · 2 comments
Assignees

Comments

@richierocks
Copy link
Contributor

Currently, the direction argument to get_p_value() supports "two-sided", "two_sided", and "two sided". Since "two.sided" is familiar to users of the base-R tests (t.test(), etc.), it seems like a useful alternative.

Here's a reproducible example.

library(infer)
null_distn <- gss %>%
  specify(response = hours) %>%
  hypothesize(null = "point", mu = 40) %>%
  generate(reps = 1000, type = "bootstrap") %>%
  calculate(stat = "mean")

point_estimate <- gss %>%
  specify(response = hours) %>%
  calculate(stat = "mean")

get_p_value(null_distn, point_estimate, direction = "two.sided")
#> Error: The provided value for `direction` is not appropriate. Possible values are "less", "greater", "two-sided", "left", "right", "both", "two_sided", or "two sided"

Rather than throwing an error, I want direction = "two.sided" to be treated the same as direction = "two-sided".

The logic for checking the direction is here: https://github.com/tidymodels/infer/blob/master/R/utils.R#L408-L410

@richierocks richierocks changed the title Allow direction = "two-sided" in get_p_value() Allow direction = "two.sided" in get_p_value() Dec 29, 2020
@simonpcouch
Copy link
Collaborator

Sure thing! Will tack this on to a PR from obs-stat in these next few days. :-)

@github-actions
Copy link

github-actions bot commented Mar 8, 2021

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants