Skip to content

Commit f01e5ff

Browse files
committed
Second full-book sweep: fix errors in math, code, prose, and alt text
A deeper read-through of every chapter, the appendices, and the glossary, following up on the sweep merged in #579. Beyond typos, this pass caught several errors in displayed numbers and worked examples: Numeric/math errors: - Ch7: the standard deviation worked example computed the mean of {3, -1, 5, 9} as 2 instead of 4, making the whole example wrong (SD is sqrt(13) = 3.61, not sqrt(17) = 4.12); the population sigma formula was missing its square root (also in ch8); a Bernoulli trial list had 26 values instead of 25; the SE-vs-sample-size summary claimed SE is inversely proportional to the "squared sample size" rather than the square root. - Ch8: the displayed t-based 95% CI (3.498, 3.846) was computed from the wrong data frame (the 25-almond sample instead of almonds_sample_100), contradicting the correct R output (3.610, 3.754) right below it; "when sigma is unknown" appeared twice where the first should read "known". - Ch10: the displayed 95% CI for beta_0 was computed from b1 instead of b0, printing (-14.112, 14.854) instead of roughly (65, 94); the model-comparison H0 displayed the wrong reduced model (dropped X3 instead of X2 as the text states). - Ch2: "10 divided by 8, or 1.125" -> 1.25; a plot title said "mpg" for wind speed; the April boxplot passage claimed the whiskers reach the max (23.1 whisker limit vs 29.92 max - there are outliers). - Ch6: three display equations used the credit-limit slope 0.263 where the rendered coefficient is 0.264. Stale-edition leftovers and code/prose mismatches: - Ch1: the flights bullet piped an already-computed count through nrow() again, rendering "Information on all flights." with no number; "lat and long" -> "lat and lon". - Ch2: "Envoy Airlines" -> "Envoy Air"; fruits_counted's variable is number, not count; stale carrier facts in alt text (EV is not in nycflights23; YX has the tallest bar); the ch2 recap code plotted temp where the chapter plotted wind_speed. - Ch3: two leftover "temperature"/temp references in the wind-speed example; a garbled group_by transition sentence (with the stale summary_temp name); VX (defunct, not in the data) -> G4; LC3.5 and its solution still discussed monthly temperatures - both now use the chapter's wind-speed analysis; Q3-5 used the reversed gain formula. - Ch5: "five levels ... Americas" leftovers in the six-continent section; "21st through 24th courses" (from the old evals data) -> countries; captions saying "out of 193"/"out of 142" where the filtered data has 181/188 rows. - Ch7: two wrong cross-references (@sec-sampling-simulation vs @sec-sampling-manual); mislabeled SE_Xbar_50/100 for the n=25/50 simulations; X-bar minus Y-bar notation where X1-bar minus X2-bar is defined; CLT statements about X_1, X_2 that should be about the sample means. - Ch9: leftover promotions-era wording ("value of 50" -> "above 50", not_popular -> "not popular", "songs with metal names"); the Welch-conditions check said the sample sizes were "not skewed". - Ch10: country_of_origin -> continent_of_origin; moisture_precentage/moisture_content -> moisture_percentage; H_1 -> H_A; "sample of `r n` courses" -> eruptions; b_1 = sum(c_i y_i) stated for b_3; D_{04} dummy subscripts for observation five; two chunks piped coffee_quality where the narrative builds coffee_data; a residual-plot axis labeled "duration" while plotting fitted values. - Preface: "Both of us" (two-author leftover, twice) -> "All of us"; index.Rmd -> index.qmd; a doubled colon and misindented bullets in the version history. - Appendix A: quartiles called "quantiles" in the five-number summary; "0.05/2 - 0.025" -> "= 0.025". - Appendix C: mean_profit naming for a median revenue; "lessor" -> "lesser". Also: alt-text corrections where descriptions contradicted the plotted data (axes swapped in chs 5/6, Halloween dip vs the 9/9/99 spike in ch11, bell-shaped claim for the deliberately non-normal almonds bowl), removal of duplicated "Difficulty stars" lines in chs 2-4, and assorted grammar fixes throughout. cspell issue count is unchanged from baseline; Learning Check question/solution counts are unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EBuUHZXFqZKh7hEJxw5KvT
1 parent c657c90 commit f01e5ff

16 files changed

Lines changed: 137 additions & 140 deletions

00-preface.qmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Finally, you'll learn the importance of literate programming. \index{literate pr
7878

7979
> Programs must be written for people to read, and only incidentally for machines to execute.
8080
81-
We understand that there may be challenging moments as you learn to program. Both of us continue to struggle and find ourselves often using web searches to find answers and reach out to colleagues for help. In the long run though, we all can solve problems faster and more elegantly via programming. We wrote this book as our way to help you get started and you should know that there is a huge community of R users that are happy to help everyone along as well. This community exists in particular on the internet on various forums and websites such as [stackoverflow.com](https://stackoverflow.com/).
81+
We understand that there may be challenging moments as you learn to program. All of us continue to struggle and find ourselves often using web searches to find answers and reach out to colleagues for help. In the long run though, we all can solve problems faster and more elegantly via programming. We wrote this book as our way to help you get started and you should know that there is a huge community of R users that are happy to help everyone along as well. This community exists in particular on the internet on various forums and websites such as [stackoverflow.com](https://stackoverflow.com/).
8282

8383

8484
### Data/science pipeline {.unnumbered}
@@ -208,7 +208,7 @@ If you would like to contribute to *ModernDive*, there are many ways! We would l
208208

209209
The authors would like to thank [Nina Sonneborn](https://github.com/nsonneborn), [Dr.\ Alison Hill](https://alison.rbind.io/), [Kristin Bott](https://twitter.com/rhobott?lang=en), Dr.\ Jenny Smetzer, [Prof. Katherine Kinnaird](https://www.smith.edu/academics/faculty/katherine-kinnaird), and the participants of our [2017](https://www.causeweb.org/cause/uscots/uscots17/workshop/3) and [2019](https://www.causeweb.org/cause/uscots/uscots19/workshop/4) USCOTS workshops for their feedback and suggestions. We'd also like to thank Dr.\ Andrew Heiss for contributing nearly all of @sec-tips-code on "Errors, warnings, and messages," [Evgeni Chasnovski](https://github.com/echasnovski) for creating the `geom_parallel_slopes()` extension to the `ggplot2` package for plotting parallel slopes models, and Smith College Statistical & Data Sciences students [Starry Zhou](https://github.com/Starryz) and [Marium Tapal](https://github.com/mariumtapal) for their many edits to the book. A special thanks goes to Dr.\ Jude Weinstein-Jones, co-founder of [The Learning Scientists](https://www.learningscientists.org), for their extensive feedback. Much appreciation also goes to [Jasmin Lörchner](https://jasminloerchner.de/) for her thorough read, continued support, and thoughtful edits for the second edition of this book!
210210

211-
We were honored to have [Dr.\ Kelly S. McConville](https://mcconville.rbind.io/) write the [Foreword](#foreword) of both editions of the book. Dr.\ McConville is a pioneer in statistics education and was a source of great inspiration to both of us as we continued to update the book to get it to its current form. Thanks additionally to the [continued contributions by members of the community](https://github.com/moderndive/ModernDive_book/graphs/contributors) to the book on GitHub and to the many individuals that have recommended this book to others. We are so very appreciative of all of you!
211+
We were honored to have [Dr.\ Kelly S. McConville](https://mcconville.rbind.io/) write the [Foreword](#foreword) of both editions of the book. Dr.\ McConville is a pioneer in statistics education and was a source of great inspiration to all of us as we continued to update the book to get it to its current form. Thanks additionally to the [continued contributions by members of the community](https://github.com/moderndive/ModernDive_book/graphs/contributors) to the book on GitHub and to the many individuals that have recommended this book to others. We are so very appreciative of all of you!
212212

213213
Lastly, a special shout out to any student who has ever taken a class with us at Pacific University, Reed College, Middlebury College, Amherst College, Smith College, or Indiana University. We couldn't have made this book without you!
214214

@@ -232,13 +232,13 @@ This book was written using the [quarto](https://quarto.org/) system. This syste
232232
- **Learning scaffolding:** Learning objectives at the top of each chapter, "common mistake" callouts at predictable trouble spots, per-chapter cheatsheets of the functions introduced, and a glossary appendix whose terms are automatically linked on first use in each chapter with definitions shown on hover.
233233
- **Accessibility:** Every figure now carries descriptive alt text for screen-reader users, equations are announced semantically rather than symbol-by-symbol, custom callouts meet WCAG contrast guidelines in both light and dark mode, and keyboard-focus and reduced-motion preferences are respected throughout.
234234
- **Expanded Appendix B:** All of the inference case studies are now interactive, and two new sections were added — correlation and simple linear regression, and multiple regression with `infer`'s `fit()` function.
235-
* **Print second edition** The CRC Press print edition corresponds to Version 2.0.0 and released on `r latest_release_date` ([source code](https://github.com/moderndive/moderndive_book/releases/tag/v`r latest_release_version`)). We welcomed Dr.\ Arturo Valdivia as a co-author for this edition. His deep knowledge of statistics and superb teaching experience have been invaluable in improving the book. Here is a summary of what was updated from v1.0.0 to v2.0.0 (first print edition to second print edition). Additional information about changes to the book over time are available on our GitHub page [here](https://github.com/moderndive/ModernDive_book/blob/v2/NEWS.md).
235+
* **Print second edition** The CRC Press print edition corresponds to Version 2.0.0 and was released on `r latest_release_date` ([source code](https://github.com/moderndive/moderndive_book/releases/tag/v`r latest_release_version`)). We welcomed Dr.\ Arturo Valdivia as a co-author for this edition. His deep knowledge of statistics and superb teaching experience have been invaluable in improving the book. Here is a summary of what was updated from v1.0.0 to v2.0.0 (first print edition to second print edition). Additional information about changes to the book over time are available on our GitHub page [here](https://github.com/moderndive/ModernDive_book/blob/v2/NEWS.md).
236236
- **Updated Datasets and Code:** Replaced datasets (`promotions`, `evals`, and `pennies`) with new ones (`un_member_states_2024`, `spotify_by_genre`, and `almonds_bowl`). Adopted the `nycflights23` package instead of `nycflights13` and introduced the base R pipe (`|>`) instead of the tidyverse pipe (`%>%`). Also incorporated `envoy_flights` and `early_january_2023_weather` in the `moderndive` package.
237237
- **Content Reorganization:** Restructured sections in Chapters 7 and 10 for improved readability. Moved "Model Selection" from Chapter 6 to Chapter 10 and split it into two new subsections as per suggestions.
238238
- **Enhanced Theoretical Discussions:** Improved theory-based discussions in Chapters 7, 8, 10, and 11, and added sections to better connect statistical inference based on reviewer feedback.
239239
- **New Examples and Functions:** Introduced `coffee_quality` and `old_faithful_2024` datasets with examples in Chapter 10, added use of the `fit()` function from the `infer` package for simulation-based inference with multiple linear regression, and added `infer` coverage into Chapter 11.
240-
- **Code Enhancements and Clarifications:** Standardized code to use `|>`, addressed warnings for `group_by()`, and added `relocate()` to Chapter 3.
241-
- **Revamped Learning Checks:**: Updated and designed new Learning checks throughout the book to better assess student understanding.
240+
- **Code Enhancements and Clarifications:** Standardized code to use `|>`, addressed warnings for `group_by()`, and added `relocate()` to Chapter 3.
241+
- **Revamped Learning Checks:** Updated and designed new Learning checks throughout the book to better assess student understanding.
242242
* **Print first edition** The CRC Press [print edition](https://www.taylorfrancis.com/books/mono/10.1201/9780367409913/statistical-inference-via-data-science-moderndive-tidyverse-chester-ismay-albert-kim) of *ModernDive* corresponds to Version 1.1.0 (with some typos fixed). Available at <https://moderndive.com/>.
243243
* **Previous online versions** Older versions that may be out of date:
244244
+ [Version 1.0.0](previous_versions/v1.0.0/index.html) released on November 25, 2019 ([source code](https://github.com/moderndive/ModernDive_book/releases/tag/v1.0.0))
@@ -253,7 +253,7 @@ This book was written using the [quarto](https://quarto.org/) system. This syste
253253

254254
Could this be a new paradigm for textbooks? Instead of the traditional model of textbook companies publishing updated *editions* of the textbook every few years, we apply a software design influenced model of publishing more easily updated *versions*. We can then leverage open-source communities of instructors and developers for ideas, tools, resources, and feedback. As such, we welcome your GitHub pull requests.
255255

256-
Finally, since this book is under a [Creative Commons Attribution - NonCommercial – ShareAlike 4.0 license](https://creativecommons.org/licenses/by-nc-sa/4.0/), feel free to modify the book as you wish for your own non-commercial needs, but please list the authors at the top of `index.Rmd` as: "Chester Ismay, Albert Y. Kim, Arturo Valdivia, and YOU!"
256+
Finally, since this book is under a [Creative Commons Attribution - NonCommercial – ShareAlike 4.0 license](https://creativecommons.org/licenses/by-nc-sa/4.0/), feel free to modify the book as you wish for your own non-commercial needs, but please list the authors at the top of `index.qmd` as: "Chester Ismay, Albert Y. Kim, Arturo Valdivia, and YOU!"
257257

258258
\newpage
259259

01-getting-started.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ flights_rows <- flights |>
323323
flights_cols <- flights |> ncol()
324324
```
325325

326-
* `flights`: Information on all `r flights_rows|> nrow() |> comma()` flights.
326+
* `flights`: Information on all `r flights_rows` flights.
327327
* `airlines`: A table matching airline names and their two-letter International Air Transport Association (IATA) airline codes (also known as carrier codes) for `r airlines |> nrow()` airline companies. For example, "DL" is the two-letter code for Delta.
328328
* `planes`: Information about each of the `r planes |> nrow() |> comma()` physical aircraft used.
329329
* `weather`: Hourly meteorological data for each of the three NYC airports. This data frame has `r weather |> nrow() |> comma()` rows, roughly corresponding to the $365 \times 24 \times 3 = 26,280$ possible hourly measurements one can observe at three locations over the course of a year.
@@ -445,7 +445,7 @@ There is a subtle difference between the kinds of variables that you will encoun
445445
glimpse(airports)
446446
```
447447

448-
The variables `faa` and `name` are *identification variables* that uniquely identify each airport. `faa` provides the airport's unique FAA code, while `name` gives its official name. These variables are used to uniquely identify each row in a data frame. The remaining variables (`lat`, `lon`, `alt`, `tz`, `dst`, `tzone`) are often called *measurement* or *characteristic* variables: variables that describe properties of each observational unit. For example, `lat` and `long` describe the latitude and longitude of each airport.
448+
The variables `faa` and `name` are *identification variables* that uniquely identify each airport. `faa` provides the airport's unique FAA code, while `name` gives its official name. These variables are used to uniquely identify each row in a data frame. The remaining variables (`lat`, `lon`, `alt`, `tz`, `dst`, `tzone`) are often called *measurement* or *characteristic* variables: variables that describe properties of each observational unit. For example, `lat` and `lon` describe the latitude and longitude of each airport.
449449

450450
Furthermore, sometimes a single variable might not be enough to uniquely identify each observational unit: combinations of variables might be needed. While it is not an absolute rule, for organizational purposes it is considered good practice to have your identification variables in the leftmost columns of your data frame.
451451

@@ -468,7 +468,7 @@ cat(lc_solution(1, 6))
468468

469469
### Help files
470470

471-
Another nice feature of R are help files, which provide documentation for various functions and datasets. You can bring up help files by adding a `?` \index{operators!?} before the name of a function or data frame and then run this in the console. You will then be presented with a page showing the corresponding documentation if it exists. For example, let's look at the help file for the `flights` data frame.
471+
Another nice feature of R is help files, which provide documentation for various functions and datasets. You can bring up help files by adding a `?` \index{operators!?} before the name of a function or data frame and then run this in the console. You will then be presented with a page showing the corresponding documentation if it exists. For example, let's look at the help file for the `flights` data frame.
472472

473473
```{r getting-started-demo-code-v2, eval=FALSE}
474474
?flights

0 commit comments

Comments
 (0)