Skip to content

Commit d534de5

Browse files
authored
merge pr #410: standardize distribution naming
2 parents 2615b99 + 2c1c8e2 commit d534de5

File tree

11 files changed

+181
-184
lines changed

11 files changed

+181
-184
lines changed

R/get_confidence_interval.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@
6464
#'
6565
#' @examples
6666
#'
67-
#' boot_distr <- gss %>%
67+
#' boot_dist <- gss %>%
6868
#' # We're interested in the number of hours worked per week
6969
#' specify(response = hours) %>%
7070
#' # Generate bootstrap samples
7171
#' generate(reps = 1000, type = "bootstrap") %>%
7272
#' # Calculate mean of each bootstrap sample
7373
#' calculate(stat = "mean")
7474
#'
75-
#' boot_distr %>%
75+
#' boot_dist %>%
7676
#' # Calculate the confidence interval around the point estimate
7777
#' get_confidence_interval(
7878
#' # At the 95% confidence level; percentile method
@@ -84,7 +84,7 @@
8484
#' specify(response = hours) %>%
8585
#' calculate(stat = "mean")
8686
#'
87-
#' boot_distr %>%
87+
#' boot_dist %>%
8888
#' get_confidence_interval(
8989
#' point_estimate = sample_mean,
9090
#' # At the 95% confidence level

R/shade_p_value.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
#'
5656
#' # you can shade confidence intervals on top of
5757
#' # theoretical distributions, too!
58-
#' null_dist_theoretical <- gss %>%
58+
#' null_dist_theory <- gss %>%
5959
#' specify(response = hours) %>%
6060
#' assume(distribution = "t")
6161
#'
62-
#' null_dist_theoretical %>%
62+
#' null_dist_theory %>%
6363
#' visualize() +
6464
#' shade_p_value(obs_stat = point_estimate, direction = "two-sided")
6565
#'

README.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ F_hat <- gss %>%
8686
Then, generating the null distribution,
8787

8888
```{r, message = FALSE, warning = FALSE}
89-
null_distn <- gss %>%
89+
null_dist <- gss %>%
9090
specify(age ~ partyid) %>%
9191
hypothesize(null = "independence") %>%
9292
generate(reps = 1000, type = "permute") %>%
@@ -96,7 +96,7 @@ null_distn <- gss %>%
9696
Visualizing the observed statistic alongside the null distribution,
9797

9898
```{r viz, message = FALSE, warning = FALSE, eval = FALSE}
99-
visualize(null_distn) +
99+
visualize(null_dist) +
100100
shade_p_value(obs_stat = F_hat, direction = "greater")
101101
```
102102

@@ -107,7 +107,7 @@ knitr::include_graphics("https://raw.githubusercontent.com/tidymodels/infer/mast
107107
Calculating the p-value from the null distribution and observed statistic,
108108

109109
```{r, message = FALSE, warning = FALSE}
110-
null_distn %>%
110+
null_dist %>%
111111
get_p_value(obs_stat = F_hat, direction = "greater")
112112
```
113113

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ F_hat <- gss %>%
129129
Then, generating the null distribution,
130130

131131
``` r
132-
null_distn <- gss %>%
132+
null_dist <- gss %>%
133133
specify(age ~ partyid) %>%
134134
hypothesize(null = "independence") %>%
135135
generate(reps = 1000, type = "permute") %>%
@@ -139,7 +139,7 @@ null_distn <- gss %>%
139139
Visualizing the observed statistic alongside the null distribution,
140140

141141
``` r
142-
visualize(null_distn) +
142+
visualize(null_dist) +
143143
shade_p_value(obs_stat = F_hat, direction = "greater")
144144
```
145145

@@ -155,7 +155,7 @@ Calculating the p-value from the null distribution and observed
155155
statistic,
156156

157157
``` r
158-
null_distn %>%
158+
null_dist %>%
159159
get_p_value(obs_stat = F_hat, direction = "greater")
160160
```
161161

man/get_confidence_interval.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/shade_p_value.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-get_confidence_interval.R

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ test_that("theoretical CIs align with simulation-based (mean)", {
255255
generate(reps = 1e3, type = "bootstrap") %>%
256256
calculate(stat = "mean")
257257

258-
null_dist_theor <- gss %>%
258+
null_dist_theory <- gss %>%
259259
specify(response = hours) %>%
260260
hypothesize(null = "point", mu = 40) %>%
261261
assume(distribution = "t")
@@ -268,7 +268,7 @@ test_that("theoretical CIs align with simulation-based (mean)", {
268268
point_estimate = x_bar
269269
),
270270
get_confidence_interval(
271-
null_dist_theor,
271+
null_dist_theory,
272272
.95,
273273
type = "se",
274274
point_estimate = x_bar
@@ -290,7 +290,7 @@ test_that("theoretical CIs align with simulation-based (prop)", {
290290
generate(reps = 1e3, type = "draw") %>%
291291
calculate(stat = "prop")
292292

293-
null_dist_theor <- gss %>%
293+
null_dist_theory <- gss %>%
294294
specify(response = sex, success = "female") %>%
295295
assume(distribution = "z")
296296

@@ -302,7 +302,7 @@ test_that("theoretical CIs align with simulation-based (prop)", {
302302
point_estimate = p_hat
303303
),
304304
get_confidence_interval(
305-
null_dist_theor,
305+
null_dist_theory,
306306
.95,
307307
type = "se",
308308
point_estimate = p_hat
@@ -324,7 +324,7 @@ test_that("theoretical CIs align with simulation-based (diff in means)", {
324324
generate(reps = 3e3, type = "permute") %>%
325325
calculate(stat = "diff in means", order = c("degree", "no degree"))
326326

327-
null_dist_theor <- gss %>%
327+
null_dist_theory <- gss %>%
328328
specify(age ~ college) %>%
329329
assume(distribution = "t")
330330

@@ -336,7 +336,7 @@ test_that("theoretical CIs align with simulation-based (diff in means)", {
336336
point_estimate = diff_bar
337337
),
338338
get_confidence_interval(
339-
null_dist_theor,
339+
null_dist_theory,
340340
.95,
341341
type = "se",
342342
point_estimate = diff_bar
@@ -358,7 +358,7 @@ test_that("theoretical CIs align with simulation-based (diff in props)", {
358358
generate(reps = 1e3, type = "permute") %>%
359359
calculate(stat = "diff in props", order = c("female", "male"))
360360

361-
null_dist_theor <- gss %>%
361+
null_dist_theory <- gss %>%
362362
specify(college ~ sex, success = "no degree") %>%
363363
assume(distribution = "z")
364364

@@ -370,7 +370,7 @@ test_that("theoretical CIs align with simulation-based (diff in props)", {
370370
point_estimate = diff_hat
371371
),
372372
get_confidence_interval(
373-
null_dist_theor,
373+
null_dist_theory,
374374
.95,
375375
type = "se",
376376
point_estimate = diff_hat
@@ -384,19 +384,19 @@ test_that("theoretical CIs check arguments properly", {
384384
specify(response = hours) %>%
385385
calculate(stat = "mean")
386386

387-
null_dist_theor <- gss %>%
387+
null_dist_theory <- gss %>%
388388
specify(age ~ college) %>%
389389
assume(distribution = "t")
390390

391391
# check that type is handled correctly
392392
expect_equal(
393393
get_confidence_interval(
394-
null_dist_theor,
394+
null_dist_theory,
395395
level = .95,
396396
point_estimate = x_bar
397397
),
398398
get_confidence_interval(
399-
null_dist_theor,
399+
null_dist_theory,
400400
level = .95,
401401
type = "se",
402402
point_estimate = x_bar
@@ -405,7 +405,7 @@ test_that("theoretical CIs check arguments properly", {
405405

406406
expect_error(
407407
get_confidence_interval(
408-
null_dist_theor,
408+
null_dist_theory,
409409
level = .95,
410410
type = "percentile",
411411
point_estimate = x_bar
@@ -415,7 +415,7 @@ test_that("theoretical CIs check arguments properly", {
415415

416416
expect_error(
417417
get_confidence_interval(
418-
null_dist_theor,
418+
null_dist_theory,
419419
level = .95,
420420
type = "boop",
421421
point_estimate = x_bar
@@ -426,7 +426,7 @@ test_that("theoretical CIs check arguments properly", {
426426
# check that point estimate hasn't been post-processed
427427
expect_error(
428428
get_confidence_interval(
429-
null_dist_theor,
429+
null_dist_theory,
430430
level = .95,
431431
point_estimate = dplyr::pull(x_bar)
432432
),
@@ -435,7 +435,7 @@ test_that("theoretical CIs check arguments properly", {
435435

436436
expect_error(
437437
get_confidence_interval(
438-
null_dist_theor,
438+
null_dist_theory,
439439
level = .95,
440440
point_estimate = x_bar$stat
441441
),
@@ -450,7 +450,7 @@ test_that("theoretical CIs check arguments properly", {
450450

451451
expect_error(
452452
get_confidence_interval(
453-
null_dist_theor,
453+
null_dist_theory,
454454
level = .95,
455455
point_estimate = obs_t
456456
),
@@ -468,7 +468,7 @@ test_that("theoretical CIs check arguments properly", {
468468

469469
expect_error(
470470
get_confidence_interval(
471-
null_dist_theor,
471+
null_dist_theory,
472472
level = .95,
473473
point_estimate = p_hat
474474
),

vignettes/anova.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ We can `generate` an approximation of the null distribution using randomization.
6161

6262
```{r generate-null-f, warning = FALSE, message = FALSE}
6363
# generate the null distribution using randomization
64-
null_distribution <- gss %>%
64+
null_dist <- gss %>%
6565
specify(age ~ partyid) %>%
6666
hypothesize(null = "independence") %>%
6767
generate(reps = 1000, type = "permute") %>%
@@ -74,7 +74,7 @@ To get a sense for what this distribution looks like, and where our observed sta
7474

7575
```{r visualize-f, warning = FALSE, message = FALSE}
7676
# visualize the null distribution and test statistic!
77-
null_distribution %>%
77+
null_dist %>%
7878
visualize() +
7979
shade_p_value(observed_f_statistic,
8080
direction = "greater")
@@ -84,11 +84,11 @@ We could also visualize the observed statistic against the theoretical null dist
8484

8585
```{r visualize-f-theor, warning = FALSE, message = FALSE}
8686
# visualize the theoretical null distribution and test statistic!
87-
null_dist_theoretical <- gss %>%
87+
null_dist_theory <- gss %>%
8888
specify(age ~ partyid) %>%
8989
assume(distribution = "F")
9090
91-
visualize(null_dist_theoretical) +
91+
visualize(null_dist_theory) +
9292
shade_p_value(observed_f_statistic,
9393
direction = "greater")
9494
```
@@ -97,7 +97,7 @@ To visualize both the randomization-based and theoretical null distributions to
9797

9898
```{r visualize-indep-both, warning = FALSE, message = FALSE}
9999
# visualize both null distributions and the test statistic!
100-
null_distribution %>%
100+
null_dist %>%
101101
visualize(method = "both") +
102102
shade_p_value(observed_f_statistic,
103103
direction = "greater")
@@ -107,7 +107,7 @@ Either way, it looks like our observed test statistic would be quite unlikely if
107107

108108
```{r p-value-indep, warning = FALSE, message = FALSE}
109109
# calculate the p value from the observed statistic and null distribution
110-
p_value <- null_distribution %>%
110+
p_value <- null_dist %>%
111111
get_p_value(obs_stat = observed_f_statistic,
112112
direction = "greater")
113113

0 commit comments

Comments
 (0)