Skip to content

Commit

Permalink
Merge pull request #58 from moderndive/final-edits
Browse files Browse the repository at this point in the history
Final edits
  • Loading branch information
Chester Ismay authored Jul 22, 2018
2 parents 84b6d0d + 8bd975c commit afba032
Show file tree
Hide file tree
Showing 50 changed files with 169 additions and 1,254 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ r_packages:

r_github_packages:
- moderndive/moderndive
- andrewpbray/infer@83451d0caaa54eeb7f582d5889a6ec1597cd805e
- andrewpbray/infer

before_script:
- chmod +x ./_build.sh
Expand Down
2 changes: 1 addition & 1 deletion 02-getting-started.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ knit_engines$set(asis = function(options) {
if (options$echo && options$eval) knit_child(text = options$code)
})
# This controls which LC solutions to show. Options for solutions_shown: "ALL" (to show all solutions), or subsets of c('2-1', '2-2'), including the null vector c('') to show no solutions.
# solutions_shown <- c(solutions_shown, '2-1', '2-2')
solutions_shown <- c('')
solutions_shown <- c(solutions_shown, '2-1', '2-2')
show_solutions <- function(section){return(solutions_shown == "ALL" | section %in% solutions_shown)}
```

Expand Down
4 changes: 2 additions & 2 deletions 03-visualization.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ knit_engines$set(asis = function(options) {
# (to show all solutions), or subsets of c('3-2', '3-3',
# '3-4','3-5','3-6','3-7'), including the null vector c('') to show no
# solutions.
# solutions_shown <- c('3-1', '3-2', '3-3', '3-4', '3-5', '3-6' ,'3-7', '3-8', '3-9', '3-10', '3-11', '3-12', '3-13', '3-14')
solutions_shown <- c('')
solutions_shown <- c('3-1', '3-2', '3-3', '3-4', '3-5', '3-6' ,'3-7', '3-8', '3-9', '3-10', '3-11', '3-12', '3-13', '3-14')
show_solutions <- function(section){
return(solutions_shown == "ALL" | section %in% solutions_shown)
}
Expand Down Expand Up @@ -1199,7 +1199,7 @@ In addition, we've created a mind map to help you remember which types of plots

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/03-visualization.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/03-visualization.R).



Expand Down
5 changes: 3 additions & 2 deletions 04-tidy.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ knit_engines$set(asis = function(options) {
# This controls which LC solutions to show. Options for solutions_shown: "ALL"
# (to show all solutions), or subsets of c('4-4', '4-5'), including the
# null vector c('') to show no solutions.
solutions_shown <- c('4-1', '4-2', '4-3', '4-4')
# solutions_shown <- c('4-1', '4-2', '4-3', '4-4')
solutions_shown <- c('')
show_solutions <- function(section){
return(solutions_shown == "ALL" | section %in% solutions_shown)
}
Expand Down Expand Up @@ -486,4 +487,4 @@ In Chapter \@ref(wrangling), we'll further explore data in tidy format by groupi

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/04-tidy.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/04-tidy.R).
5 changes: 3 additions & 2 deletions 05-wrangling.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ knit_engines$set(asis = function(options) {
# This controls which LC solutions to show. Options for solutions_shown: "ALL"
# (to show all solutions), or subsets of c('5-1', '5-2','5-3', '5-4', '5-5', '5-6'), including
# the null vector c('') to show no solutions.
solutions_shown <- c('5-1', '5-2', '5-3', '5-4', '5-5', '5-6', '5-7')
# solutions_shown <- c('5-1', '5-2', '5-3', '5-4', '5-5', '5-6', '5-7')
solutions_shown <- c('')
show_solutions <- function(section){
return(solutions_shown == "ALL" | section %in% solutions_shown)
}
Expand Down Expand Up @@ -1121,4 +1122,4 @@ We will focus only on the `dplyr` functions in this book, but you are encouraged

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/05-wrangling.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/05-wrangling.R).
2 changes: 1 addition & 1 deletion 06-regression.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1303,4 +1303,4 @@ In this chapter, you've seen what we call "basic regression" when you only have

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/06-regression.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/06-regression.R).
2 changes: 1 addition & 1 deletion 07-multiple-regression.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -819,5 +819,5 @@ Up next:

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/07-multiple-regression.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/07-multiple-regression.R).

2 changes: 1 addition & 1 deletion 08-sampling.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -679,5 +679,5 @@ This chapter serves as an introduction to the theoretical underpinning of the st

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/08-sampling.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/08-sampling.R).

4 changes: 2 additions & 2 deletions 09-confidence-intervals.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ Theoretical methods like this have largely been used in the past since we didn't

## EXAMPLE: Comparing two proportions

If you see someone else yawn, are you more likely to yawn? In an [episode](http://www.discovery.com/tv-shows/mythbusters/mythbusters-database/yawning-contagious/) of the show *Mythbusters*, they tested the myth that yawning is contagious. The snippet from the show is available to view on the Discovery Network website [here](https://www.discovery.com/tv-shows/mythbusters/videos/is-yawning-contagious).
If you see someone else yawn, are you more likely to yawn? In an [episode](http://www.discovery.com/tv-shows/mythbusters/mythbusters-database/yawning-contagious/) of the show *Mythbusters*, they tested the myth that yawning is contagious. The snippet from the show is available to view in the United States on the Discovery Network website [here](https://www.discovery.com/tv-shows/mythbusters/videos/is-yawning-contagious). More information about the episode is also available on IMDb [here](https://www.imdb.com/title/tt0768479/).

Fifty adults who thought they were being considered for an appearance on the show were interviewed by a show recruiter ("confederate") who either yawned or did not. Participants then sat by themselves in a large van and were asked to wait. While in the van, the Mythbusters watched via hidden camera to see if the unaware participants yawned. The data frame containing the results is available at `mythbusters_yawn` in the `moderndive` package. Let's check it out.

Expand Down Expand Up @@ -1066,5 +1066,5 @@ This chapter introduced the notions of bootstrapping and confidence intervals as

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/09-confidence-intervals.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/09-confidence-intervals.R).

2 changes: 1 addition & 1 deletion 10-hypothesis-testing.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -734,5 +734,5 @@ knitr::include_graphics("images/flowcharts/infer/ht_diagram.png")

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/10-hypothesis-testing.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/10-hypothesis-testing.R).

4 changes: 2 additions & 2 deletions 11-inference-for-regression.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ knit_engines$set(asis = function(options) {
# This controls which LC solutions to show. Options for solutions_shown: "ALL"
# (to show all solutions), or subsets of c('11-1', '11-2'), including the
# null vector c('') to show no solutions.
solutions_shown <- c('11-1')
solutions_shown <- c('')
show_solutions <- function(section){
return(solutions_shown == "ALL" | section %in% solutions_shown)
}
Expand Down Expand Up @@ -319,4 +319,4 @@ get_regression_table(score_model_3) %>%

### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.netlify.com/scripts/11-inference-for-regression.R).
An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/11-inference-for-regression.R).
4 changes: 3 additions & 1 deletion 12-thinking-with-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ knit_engines$set(asis = function(options) {
# This controls which LC solutions to show. Options for solutions_shown: "ALL"
# (to show all solutions), or subsets of c('4-4', '4-5'), including the
# null vector c('') to show no solutions.
solutions_shown <- c('12-1')
solutions_shown <- c('')
show_solutions <- function(section){
return(solutions_shown == "ALL" | section %in% solutions_shown)
}
Expand Down Expand Up @@ -504,7 +504,9 @@ We see a big valley occurring just before January 1st, 2000, mostly likely due t
Stand by!


### Script of R code

An R script file of all R code used in this chapter is available [here](https://moderndive.com/scripts/12-thinking-with-data.R).



Expand Down
64 changes: 59 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,60 @@
# ModernDive 0.3.0.9000
# ModernDive 0.4.0

## Highlights

1. The [`infer` package](http://infer.netlify.com/) is ready for prime-time! Thus we made a first pass at incorporating it into the book in Chapters 9 and 10 on confidence intervals and hypothesis testing!
1. Chapter 12 on "Thinking with Data" now includes a case study using the [Seattle house prices](https://www.kaggle.com/harlfoxem/housesalesprediction) dataset on Kaggle.com. Chapters 3 and 4 from new ["Modeling with Data in the Tidyverse"](https://www.datacamp.com/courses/modeling-with-data-in-the-tidyverse) DataCamp course by Albert Y. Kim are based on this analysis!
1. Speaking of DataCamp, we point readers to [various DataCamp courses](https://moderndive.netlify.com/index.html#datacamp) that directly align with various chapters in the book!
1. We significantly cleaned up Chapter 8 on sampling! In particular: adding a [2013 Obama approval rating poll](https://www.npr.org/sections/itsallpolitics/2013/12/04/248793753/poll-support-for-obama-among-young-americans-eroding) example to tie in with our sampling bowl tactile and virtual simulations and making it very clear that ultimately we are performing statistical **inference via sampling**.


## All content changes

* Introduction: Added section on correspondence of chapters to various DataCamp courses. Furthermore, links to relevant DataCamp course are included at the outset of each chapter.
* Chapter 3 - Data visualization:
+ Added simplified `geom_jitter()` example
+ More explanations for how whiskers and outliers are constructed in `geom_boxplots`
+ Added summary of table of all 5 named graphs
* Chapter 4 - Tidy data:
+ Added section on importing Excel data via RStudio
+ Added example of tidy vs non-tidy: `fivethirtyeight::drinks`
* Chapter 5 - Data wrangling:
+ Added computing [available seat miles](https://en.wikipedia.org/wiki/Available_seat_miles) data wrangling case study
+ Abandoned "5 Main Verbs" 5MV notion
+ Added `_join()` and `group_by()` multiple variables
* Chapter 6 - Basic regression:
+ Clarified explanations of indicator/dummy variables when using categorical variable in regression.
+ Expanded "Correlation is not necessarily causation" subsection with example of "does sleeping with shoes on cause headaches?" including [causal diagram](https://github.com/moderndive/moderndive_book/blob/master/images/flowcharts/flowchart.009-cropped.png)
+ Introduced concept of a "wrapper function" when introducing `moderndive::get_regression_table()` function
+ Replaced all `base::summary()` with `skimr::skim()` for quick numerical summaries
* Chapter 7 - Multiple regression:
+ Changed all "everything else being equal" interpretation statements with "taking into account/controlling for all other variables in our model"
* Chapter 8 - Sampling:
+ Significantly cleaned up sampling terminology and definitions and made more clear that we are **sampling for inference**
+ Cleaned up section and subsection structure to be much cleaner:
1. Tactile sampling simulation
1. Virtual sampling simulation
1. In real-life sampling: Introduced example of 2013 Obama approval rating poll and then tie everything with [sampling bowl](https://github.com/moderndive/moderndive_book/blob/master/images/sampling_bowl.jpeg).
* **Major overhaul**: Chapter 9 - Confidence intervals
+ [`infer` package](http://infer.netlify.com/) now being ready for prime-time, we made first pass at incorporation into book.
* **Major overhaul**: Chapter 10 - Hypothesis testing
+ [`infer` package](http://infer.netlify.com/) now being ready for prime-time, we made first pass at incorporation into book.
+ Added discussion on Allan Downey's ["There is only one test"](http://allendowney.blogspot.com/2016/06/there-is-still-only-one-test.html) ideas
* **Major overhaul**: Chapter 12 - Thinking with data
+ Added case study of [Seattle house prices](https://www.kaggle.com/harlfoxem/housesalesprediction) dataset from Kaggle, which is now available in `house_prices` dataframe in `moderndive` package.
1. Chapters 3 and 4 from new ["Modeling with Data in the Tidyverse"](https://www.datacamp.com/courses/modeling-with-data-in-the-tidyverse) DataCamp course are based on this analysis
1. Includes a discussion on the importance of `log10`-transformations
1. Introduces modeling/regression for prediction: predicting house prices
+ Laid outline for "effective data storytelling" using `fivethirtyeight` data and added one small example using US births data
+ At the beginning of chapter, we now come full circle and revisit the discussion on the ModernDive [flowchart](https://github.com/moderndive/moderndive_book/blob/master/images/flowcharts/flowchart/flowchart.002.png) in the introduction.


## Other changes

* Updated `moderndive` package on CRAN to 0.2.0. See [`NEWS.md`](https://github.com/moderndive/moderndive/releases)



- Updated links to free DataCamp course in Visualization and Data Wrangling chapters

# ModernDive 0.3.0

Expand All @@ -11,7 +65,7 @@
* Added "Data Modeling" portion to book
+ Chapter 6 - Basic regression: one numerical explanatory variable, correlation, one categorical explanatory variable)
+ Chapter 7 - Multiple regression: two numerical explanatory variables, one numerical and one categorical, interaction effects, Simpson's Paradox
+ Uses new [`moderndive`](https://moderndive.github.io/moderndive/) package, which includes `get_regression_table()` and `get_regression_points()` wrapper functions to simplify outputing of clean regression tables and observed/fitted values + resisuals
+ Uses new [`moderndive`](https://moderndive.github.io/moderndive/) package, which includes `get_regression_table()` and `get_regression_points()` wrapper functions to simplify outputting of clean regression tables and observed/fitted values + residuals
* Added "statistical inference" portion to book
+ Added Chapter 8 - Sampling (still under construction) using [sampling bowl](https://github.com/moderndive/moderndive/blob/master/data-raw/sampling_bowl.jpeg)
+ Chapters 9 and 10 on confidence intervals and hypothesis testing have not yet been updated, as we were awaiting the now launched package: [`infer`: A tidyverse-friendly R package fo statistical inference](https://github.com/andrewpbray/infer)
Expand All @@ -34,12 +88,12 @@
* Incorporated feedback from consultations with Prof. Yana Weinstein, cognitive psychological scientist and co-founder of [The Learning Scientists](http://www.learningscientists.org/yana-weinstein/).
* Restructured/revamped chapters
+ **Chapter 1: Introduction**
+ Friendlier introduction targetted to students is first thing users see. Followed then by introduction for instructors, ways to connect/contribute, and technical details.
+ Friendlier introduction targeted to students is first thing users see. Followed then by introduction for instructors, ways to connect/contribute, and technical details.
+ Added links to example student projects from two courses that have previously used ModernDive:
+ Middlebury College [MATH 116 Introduction to Statistical and Data Sciences](https://rudeboybert.github.io/MATH116/PS/final_project/final_project_outline.html#past_examples) using student collected data.
+ Pacific University [SOC 301 Social Statistics](https://ismayc.github.io/soc301_s2017/group-projects/index.html) using data from the [fivethirtyeight R package](https://cran.r-project.org/web/packages/fivethirtyeight/vignettes/fivethirtyeight.html)
+ **Chapter 2: Getting Started** New chapter added meant for new R users/coders, including
+ Discusions on R vs RStudio and how to install both (with support videos)
+ Discussions on R vs RStudio and how to install both (with support videos)
+ A "How do I code in R?" section with links to [DataCamp.com](https://www.datacamp.com/) courses that covers the console, data types, vectors, factors, data frames, boolean operators, functions etc
+ Thorough discussion on R packages
+ An end-to-end starter example analysis of the data frames in the `nycflights13` package using the console, `View()`, `glimpse()` etc.
Expand Down
5 changes: 3 additions & 2 deletions docs/10-hypothesis-testing.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<meta name="author" content="Chester Ismay and Albert Y. Kim">


<meta name="date" content="2018-07-22">
<meta name="date" content="2018-07-21">

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
Expand Down Expand Up @@ -429,6 +429,7 @@
<li class="chapter" data-level="12.2.1" data-path="12-thinking-with-data.html"><a href="12-thinking-with-data.html#bechdel-test-for-hollywood-gender-representation"><i class="fa fa-check"></i><b>12.2.1</b> Bechdel test for Hollywood gender representation</a></li>
<li class="chapter" data-level="12.2.2" data-path="12-thinking-with-data.html"><a href="12-thinking-with-data.html#us-births-in-1999"><i class="fa fa-check"></i><b>12.2.2</b> US Births in 1999</a></li>
<li class="chapter" data-level="12.2.3" data-path="12-thinking-with-data.html"><a href="12-thinking-with-data.html#other-examples"><i class="fa fa-check"></i><b>12.2.3</b> Other examples</a></li>
<li class="chapter" data-level="12.2.4" data-path="12-thinking-with-data.html"><a href="12-thinking-with-data.html#script-of-r-code-9"><i class="fa fa-check"></i><b>12.2.4</b> Script of R code</a></li>
</ul></li>
<li class="chapter" data-level="" data-path="12-thinking-with-data.html"><a href="12-thinking-with-data.html#concluding-remarks"><i class="fa fa-check"></i>Concluding remarks</a></li>
</ul></li>
Expand Down Expand Up @@ -1071,7 +1072,7 @@ <h2><span class="header-section-number">10.9</span> Conclusion</h2>
<p><img src="images/flowcharts/infer/ht_diagram.png" width="\textwidth" style="display: block; margin: auto;" /></p>
<div id="script-of-r-code-7" class="section level3">
<h3><span class="header-section-number">10.9.1</span> Script of R code</h3>
<p>An R script file of all R code used in this chapter is available <a href="https://moderndive.netlify.com/scripts/10-hypothesis-testing.R">here</a>.</p>
<p>An R script file of all R code used in this chapter is available <a href="https://moderndive.com/scripts/10-hypothesis-testing.R">here</a>.</p>

</div>
</div>
Expand Down
Loading

0 comments on commit afba032

Please sign in to comment.