@@ -292,7 +292,7 @@ sampling distribution directly for learning purposes.
292
292
293
293
``` {r 11-example-proportions7, echo = TRUE, message = FALSE, warning = FALSE, fig.pos = "H", out.extra="", fig.cap = "Sampling distribution of the sample proportion for sample size 40.", fig.height = 3.3, fig.width = 4.2}
294
294
sampling_distribution <- ggplot(sample_estimates, aes(x = sample_proportion)) +
295
- geom_histogram(fill = "dodgerblue3", color = "lightgrey", bins = 12) +
295
+ geom_histogram(color = "lightgrey", bins = 12) +
296
296
labs(x = "Sample proportions", y = "Count") +
297
297
theme(text = element_text(size = 12))
298
298
@@ -340,7 +340,7 @@ options(pillar.sigfig = 5)
340
340
341
341
``` {r 11-example-means2, echo = TRUE, message = FALSE, warning = FALSE, fig.pos = "H", out.extra="", fig.cap = "Population distribution of price per night (dollars) for all Airbnb listings in Vancouver, Canada.", fig.height = 3.5, fig.width = 4.5}
342
342
population_distribution <- ggplot(airbnb, aes(x = price)) +
343
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
343
+ geom_histogram(color = "lightgrey") +
344
344
labs(x = "Price per night (dollars)", y = "Count") +
345
345
theme(text = element_text(size = 12))
346
346
@@ -385,7 +385,7 @@ of our sample.\index{ggplot!geom\_histogram}
385
385
386
386
``` {r 11-example-means-sample-hist, echo = TRUE, message = FALSE, warning = FALSE, fig.pos = "H", out.extra="", fig.cap = "Distribution of price per night (dollars) for sample of 40 Airbnb listings.", fig.height = 3.5, fig.width = 4.5}
387
387
sample_distribution <- ggplot(one_sample, aes(price)) +
388
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
388
+ geom_histogram(color = "lightgrey") +
389
389
labs(x = "Price per night (dollars)", y = "Count") +
390
390
theme(text = element_text(size = 12))
391
391
@@ -433,7 +433,7 @@ sample_estimates <- samples |>
433
433
sample_estimates
434
434
435
435
sampling_distribution_40 <- ggplot(sample_estimates, aes(x = mean_price)) +
436
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
436
+ geom_histogram(color = "lightgrey") +
437
437
labs(x = "Sample mean price per night (dollars)", y = "Count") +
438
438
theme(text = element_text(size = 12))
439
439
@@ -513,29 +513,29 @@ sample_estimates_500 <- rep_sample_n(airbnb, size = 500, reps = 20000) |>
513
513
514
514
## Sampling distribution n = 20
515
515
sampling_distribution_20 <- ggplot(sample_estimates_20, aes(x = mean_price)) +
516
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
516
+ geom_histogram(color = "lightgrey") +
517
517
labs(x = "Sample mean price per night (dollars)", y = "Count") +
518
518
ggtitle("n = 20")
519
519
520
520
## Sampling distribution n = 50
521
521
sampling_distribution_50 <- ggplot(sample_estimates_50, aes(x = mean_price)) +
522
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
522
+ geom_histogram(color = "lightgrey") +
523
523
ylab("Count") +
524
524
xlab("Sample mean price per night (dollars)") +
525
525
ggtitle("n = 50") +
526
526
xlim(min_x(sampling_distribution_20), max_x(sampling_distribution_20))
527
527
528
528
## Sampling distribution n = 100
529
529
sampling_distribution_100 <- ggplot(sample_estimates_100, aes(x = mean_price)) +
530
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
530
+ geom_histogram(color = "lightgrey") +
531
531
ylab("Count") +
532
532
xlab("Sample mean price per night (dollars)") +
533
533
ggtitle("n = 100") +
534
534
xlim(min_x(sampling_distribution_20), max_x(sampling_distribution_20))
535
535
536
536
## Sampling distribution n = 500
537
537
sampling_distribution_500 <- ggplot(sample_estimates_500, aes(x = mean_price)) +
538
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
538
+ geom_histogram(color = "lightgrey") +
539
539
ylab("Count") +
540
540
xlab("Sample mean price per night (dollars)") +
541
541
ggtitle("n = 500") +
@@ -671,7 +671,7 @@ large enough sample.
671
671
sample_10 <- airbnb |>
672
672
rep_sample_n(10)
673
673
sample_distribution_10 <- ggplot(sample_10, aes(price)) +
674
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
674
+ geom_histogram(color = "lightgrey") +
675
675
xlab("Price per night (dollars)") +
676
676
ylab("Count") +
677
677
ggtitle("n = 10")
@@ -680,7 +680,7 @@ sample_20 <- airbnb |>
680
680
rep_sample_n(20)
681
681
682
682
sample_distribution_20 <- ggplot(sample_20, aes(price)) +
683
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
683
+ geom_histogram(color = "lightgrey") +
684
684
xlab("Price per night (dollars)") +
685
685
ylab("Count") +
686
686
ggtitle("n = 20")
@@ -689,7 +689,7 @@ sample_50 <- airbnb |>
689
689
rep_sample_n(50)
690
690
691
691
sample_distribution_50 <- ggplot(sample_50, aes(price)) +
692
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
692
+ geom_histogram(color = "lightgrey") +
693
693
xlab("Price per night (dollars)") +
694
694
ylab("Count") +
695
695
ggtitle("n = 50")
@@ -698,7 +698,7 @@ sample_100 <- airbnb |>
698
698
rep_sample_n(100)
699
699
700
700
sample_distribution_100 <- ggplot(sample_100, aes(price)) +
701
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
701
+ geom_histogram(color = "lightgrey") +
702
702
xlab("Price per night (dollars)") +
703
703
ylab("Count") +
704
704
ggtitle("n = 100")
@@ -707,7 +707,7 @@ sample_200 <- airbnb |>
707
707
rep_sample_n(200)
708
708
709
709
sample_distribution_200 <- ggplot(sample_200, aes(price)) +
710
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
710
+ geom_histogram(color = "lightgrey") +
711
711
xlab("Price per night (dollars)") +
712
712
ylab("Count") +
713
713
ggtitle("n = 200")
@@ -783,7 +783,7 @@ one_sample <- one_sample |>
783
783
one_sample
784
784
785
785
one_sample_dist <- ggplot(one_sample, aes(price)) +
786
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
786
+ geom_histogram(color = "lightgrey") +
787
787
labs(x = "Price per night (dollars)", y = "Count") +
788
788
theme(text = element_text(size = 12))
789
789
@@ -809,7 +809,7 @@ we change the argument for `replace` from its default value of `FALSE` to `TRUE`
809
809
boot1 <- one_sample |>
810
810
rep_sample_n(size = 40, replace = TRUE, reps = 1)
811
811
boot1_dist <- ggplot(boot1, aes(price)) +
812
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
812
+ geom_histogram(color = "lightgrey") +
813
813
labs(x = "Price per night (dollars)", y = "Count") +
814
814
theme(text = element_text(size = 12))
815
815
@@ -849,7 +849,7 @@ six_bootstrap_samples <- boot20000 |>
849
849
filter(replicate <= 6)
850
850
851
851
ggplot(six_bootstrap_samples, aes(price)) +
852
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
852
+ geom_histogram(color = "lightgrey") +
853
853
labs(x = "Price per night (dollars)", y = "Count") +
854
854
facet_wrap(~replicate) +
855
855
theme(text = element_text(size = 12))
@@ -880,7 +880,7 @@ boot20000_means
880
880
tail(boot20000_means)
881
881
882
882
boot_est_dist <- ggplot(boot20000_means, aes(x = mean_price)) +
883
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
883
+ geom_histogram(color = "lightgrey") +
884
884
labs(x = "Sample mean price per night (dollars)", y = "Count") +
885
885
theme(text = element_text(size = 12))
886
886
@@ -898,7 +898,7 @@ sample_estimates <- samples |>
898
898
summarize(mean_price = mean(price))
899
899
900
900
sampling_dist <- ggplot(sample_estimates, aes(x = mean_price)) +
901
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
901
+ geom_histogram(color = "lightgrey") +
902
902
ylab("Count") +
903
903
xlab("Sample mean price per night (dollars)")
904
904
@@ -988,7 +988,7 @@ boot1_dist <- boot1_dist + ggtitle("Samples with Replacement") +
988
988
)
989
989
990
990
boot2_dist <- ggplot(boot2, aes(price)) +
991
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
991
+ geom_histogram(color = "lightgrey") +
992
992
theme(
993
993
axis.title.x = element_blank(),
994
994
axis.ticks.x = element_blank(),
@@ -999,7 +999,7 @@ boot2_dist <- ggplot(boot2, aes(price)) +
999
999
)
1000
1000
1001
1001
boot3_dist <- ggplot(boot3, aes(price)) +
1002
- geom_histogram(fill = "dodgerblue3", color = "lightgrey") +
1002
+ geom_histogram(color = "lightgrey") +
1003
1003
xlab("") +
1004
1004
theme(
1005
1005
axis.ticks.x = element_blank(),
0 commit comments