diff --git a/.gitignore b/.gitignore index 9268cdfb..585257a2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .RData .Ruserdata *placeholder.html +.httr-oauth diff --git a/03-tidy_data.Rmd b/03-tidy_data.Rmd index 0a7ad424..46e0d5b8 100755 --- a/03-tidy_data.Rmd +++ b/03-tidy_data.Rmd @@ -53,7 +53,7 @@ knitr::include_graphics("images/tidy-1.png") Reading over this definition, you can begin to think about datasets that won't follow this nice format. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc3-1, type='learncheck'} **_Learning check_** @@ -64,7 +64,7 @@ Reading over this definition, you can begin to think about datasets that won't f + What features of this dataset might make it difficult to visualize? + How could the dataset be tweaked to make it **tidy**? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ## The `nycflights13` datasets @@ -92,7 +92,7 @@ This dataset and most others presented in this book will be in the `data.frame` View(flights) ``` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc3-2, type='learncheck'} **_Learning check_** @@ -106,7 +106,7 @@ View(flights) - C. Data on an airport - D. Data on multiple flights -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** By running `View(flights)`, we see the different **variables** listed in the columns and we see that there are different types of variables. Some of the variables like `distance`, `day`, and `arr_delay` are what we will call **quantitative** variables. These variables vary in a numerical way. Other variables here are **categorical**. @@ -122,7 +122,7 @@ Note that if you look in the leftmost column of the `View(flights)` output, you str(flights) ``` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc3-3, type='learncheck'} **_Learning check_** @@ -136,7 +136,7 @@ str(flights) **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** How many different rows are in this dataset? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** Another way to view the properties of a dataset is to use the `str` function ("str" is short for "structure"). This will give you the first few entries of each variable in a row after the variable. In addition, the type of the variable is given immediately after the `:` following each variable's name. Here, `int` and `num` refer to quantitative variables. In contrast, `chr` refers to categorical variables. One more type of variable is given here with the `time_hour` variable: **POSIXct**. As you may suspect, this variable corresponds to a specific date and time of day. @@ -200,8 +200,8 @@ If we `View` this dataset, we see a new variable has been created called (We wil More discussion about joining data frames together will be given in Chapter \@ref(manip). We will see there that the names of the columns to be linked need not match as they did here with `"carrier"`. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** +*** ```{block tidy_review, type='review'} **_Review questions_** @@ -211,10 +211,6 @@ More discussion about joining data frames together will be given in Chapter \@re **`r paste0("(RQ", chap, ".", (rq <- rq + 1), ")")`** What makes "tidy" datasets useful for organizing data? - - **`r paste0("(RQ", chap, ".", (rq <- rq + 1), ")")`** How many variables are presented in the table below? What does each row correspond to? (**Hint:** You may not be able to answer both of these questions immediately but take your best guess.) @@ -245,8 +241,8 @@ kable(data_frame("role" = role, `Sociology?` = sociology, **`r paste0("(RQ", chap, ".", (rq <- rq + 1), ")")`** What are some advantages of data in normal forms? What are some disadvantages? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** +*** ## What's to come? diff --git a/04-visualizing_data.Rmd b/04-visualizing_data.Rmd index aaeafe1b..88de8714 100755 --- a/04-visualizing_data.Rmd +++ b/04-visualizing_data.Rmd @@ -183,7 +183,7 @@ ggplot(data = weather, mapping = aes(x = temp)) + As we might expect, the temperature tends to increase as summer approaches and then decrease as winter approaches. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-2, type='learncheck'} **_Learning check_** @@ -202,7 +202,7 @@ Draw or give an example. **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** Does the `temp` variable in the `weather` data set have a lot of variability? Why do you say that? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** Histograms can provide a way to compare distributions across groups as we see above when we looked at temperature over months. Frequently, a plot called a **boxplot** (also called a **side-by-side boxplot**) is done instead. The **boxplot** uses the information provided in the **five-number summary** referred to in the previous section when we used the `summary` function. It gives a way to compare this summary information across the different levels of a group. Let's create a boxplot to compare the monthly temperatures as we did above with the faceted histograms. @@ -223,7 +223,7 @@ ggplot(data = weather, mapping = aes(x = factor(month), y = temp)) + We have introduced a new function called `factor()` here. One of the things this function does is to convert a numeric value like `month` (1, 2, ..., 12) into a categorical variable. The "box" part of this plot represents the 25^th^ percentile, the median (50^th^ percentile), and the 75^th^ percentile. The dots correspond to **outliers**. (The specific formulation for these outliers is discussed in Appendix \@ref(appendix2).) The lines show how the data varies that is not in the center 50% defined by the first and third quantiles. Longer lines correspond to more variability and shorter lines correspond to less variability. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-2b, type='learncheck'} **_Learning check_** @@ -237,7 +237,7 @@ We have introduced a new function called `factor()` here. One of the things thi **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** Boxplots provide a simple way to identify outliers. Why may outliers be easier to identify when looking at a boxplot instead of a faceted histogram? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Summary @@ -269,7 +269,7 @@ flights_table <- count(x = flights, vars = carrier) flights_table ``` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-3, type='learncheck'} **_Learning check_** @@ -283,7 +283,7 @@ flights_table **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What was the seventh highest airline in terms of departed flights from NYC in 2013? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Must avoid pie charts! @@ -317,7 +317,7 @@ While it is quite easy to look back at the barplot to get the answer to these qu knitr::include_graphics("images/Pie-I-have-Eaten.jpg") ``` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-3b, type='learncheck'} **_Learning check_** @@ -327,7 +327,7 @@ knitr::include_graphics("images/Pie-I-have-Eaten.jpg") **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What is your opinion as to why pie charts continue to be used? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Using barplots to compare two variables @@ -349,7 +349,7 @@ ggplot(data = flights_namedports, mapping = aes(x = carrier, fill = name)) + This plot is what is known as a **stacked barplot**. While simple to make, it often leads to many problems. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-3c, type='learncheck'} **_Learning check_** @@ -359,7 +359,7 @@ This plot is what is known as a **stacked barplot**. While simple to make, it o **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What can you say, if anything, about the relationship between airline and airport in NYC in 2013 in regards to the number of departing flights? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** Another variation on the **stacked barplot** is the **side-by-side barplot**. @@ -368,7 +368,7 @@ ggplot(data = flights_namedports, mapping = aes(x = carrier, fill = name)) + geom_bar(position = "dodge") ``` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-3d, type='learncheck'} **_Learning check_** @@ -378,11 +378,11 @@ ggplot(data = flights_namedports, mapping = aes(x = carrier, fill = name)) + **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What are the disadvantages of using a side-by-side barplot, in general? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** Lastly, an often preferred type of barplot is the **faceted barplot**. We already saw this concept of faceting and small multiples in Subsection \@ref(faceting). This gives us a nicer way to compare the distributions across both `carrier` and airport/`name`. -```{r, fig.cap="Faceted barplot comparing the number of flights by carrier and airport", fig.height=5.2} +```{r, fig.cap="Faceted barplot comparing the number of flights by carrier and airport", fig.height=7.5} ggplot(data = flights_namedports, mapping = aes(x = carrier, fill = name)) + geom_bar() + facet_grid(name ~ .) @@ -390,7 +390,7 @@ ggplot(data = flights_namedports, mapping = aes(x = carrier, fill = name)) + Note how the `facet_grid` function arguments are written here. We are wanting the names of the airports vertically and the `carrier` listed horizontally. As you may have guessed, this argument and other _formulas_ of this sort in R are in `y ~ x` order. We will see more examples of this in Chapter \@ref(regress). -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-3e, type='learncheck'} **_Learning check_** @@ -400,7 +400,7 @@ Note how the `facet_grid` function arguments are written here. We are wanting t **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What information about the different carriers at different airports is more easily seen in the faceted barplot? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Summary @@ -417,7 +417,7 @@ alaska_cap <- "Arrival Delays vs Departure Delays for Alaska Airlines flights fr ``` -```{r noalpha, warning=FALSE, fig.cap=alaska_cap} +```{r noalpha, warning=FALSE, fig.cap=alaska_cap, fig.height=4} alaska_flights <- filter(flights, carrier == "AS") ggplot(alaska_flights, aes(x = dep_delay, y = arr_delay)) + geom_point() @@ -425,7 +425,7 @@ ggplot(alaska_flights, aes(x = dep_delay, y = arr_delay)) + We see that a positive relationship exists between `dep_delay` and `arr_delay`: as departure delays increase, arrival delays tend to also increase. We also note that the majority of points fall near the point (0, 0) here. There is a large mass of points clustered there. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-4, type='learncheck'} **_Learning check_** @@ -441,7 +441,7 @@ We see that a positive relationship exists between `dep_delay` and `arr_delay`: **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What are some other features of the plot that stand out to you? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Jittering @@ -449,30 +449,30 @@ The large mass of points near (0, 0) can cause some confusion. This is the resu One way of relieving this issue of **over-plotting** is to **jitter** the points a bit. In other words, we are going to add just a bit of random noise to the points to better see them and remove some of the over-plotting. You can think of "jittering" as shaking the points a bit on the plot. Instead of using `geom_point`, we use `geom_jitter` to perform this shaking and specify around how much jitter to add with the `width` and `height` arguments. This corresponds to how hard you'd like to shake the plot in units corresponding to those for both the horizontal and vertical variables (minutes here). -```{r warning=FALSE, fig.cap="Jittered delay scatterplot"} +```{r warning=FALSE, fig.cap="Jittered delay scatterplot", fig.height=4} ggplot(alaska_flights, aes(x = dep_delay, y = arr_delay)) + geom_jitter(width = 30, height = 30) ``` -This has helps us a little bit in getting a sense for the over-plotting, but with a relatively large dataset like this one (`r nrow(alaska_flights)` flights), it is often useful to change the transparency of the points as seen in the next section. +This helps us a little bit in getting a sense for the over-plotting, but with a relatively large dataset like this one (`r nrow(alaska_flights)` flights), it is often useful to change the transparency of the points as seen in the next section. ### Setting transparency One of the arguments that can be changed with `geom_point` is `alpha`. By default, this value is set to `1`. We can change this value to a smaller fraction to change the transparency of the points in the plot: -```{r alpha, warning=FALSE, fig.cap=paste(alaska_cap, "- alpha=0.2")} +```{r alpha, warning=FALSE, fig.cap=paste(alaska_cap, "- alpha=0.2", fig.height=1)} ggplot(alaska_flights, aes(x = dep_delay, y = arr_delay)) + geom_point(alpha = 0.2) ``` We can also specify the `alpha` argument in `geom_jitter`: -```{r jitteralpha, warning=FALSE, fig.cap=paste(alaska_cap, "- jitter and alpha added")} +```{r jitteralpha, warning=FALSE, fig.cap=paste(alaska_cap, "- jitter and alpha added", fig.height=1)} ggplot(alaska_flights, aes(x = dep_delay, y = arr_delay)) + geom_jitter(width = 30, height = 30, alpha = 0.3) ``` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc4-4b, type='learncheck'} **_Learning check_** @@ -486,7 +486,7 @@ ggplot(alaska_flights, aes(x = dep_delay, y = arr_delay)) + + How has that region changed compared to when you observed the same plot without the `alpha = 0.2` set in \@ref(fig:noalpha)? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ## What's to come? diff --git a/05-manipulating_data.Rmd b/05-manipulating_data.Rmd index 785de7bf..262aef84 100755 --- a/05-manipulating_data.Rmd +++ b/05-manipulating_data.Rmd @@ -116,7 +116,7 @@ You'll receive an error if you try to do it the other way: Error: Unknown variables: departure_time, arrival_time. ``` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc5-1, type='learncheck'} **_Learning check_** @@ -128,7 +128,7 @@ Error: Unknown variables: departure_time, arrival_time. **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** Why might we want to use the `select` function on a data frame? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Filter observations using `filter` {#filter} @@ -219,7 +219,7 @@ count(not_summer2, month) **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What's another way using `!` we could filter only the rows that are not summer months (June, July, or August) in the `flights` data frame? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Summarize variables using `summarize` @@ -296,7 +296,7 @@ We see that Newark (`"EWR"`) had the most flights departing in 2013 followed by **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** How could we identify how many flights left each of the three airports in each of the months of 2013? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Create new variables/change old variables using `mutate` @@ -347,7 +347,7 @@ flights_plus2 <- mutate(flights, ``` -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc5-4, type='learncheck'} **_Learning check_** @@ -359,7 +359,7 @@ flights_plus2 <- mutate(flights, **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What can we say about the distribution of `gain`? Describe it in a few sentences using the plot and the `gain_summary` data frame values. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Reorder the data frame using `arrange` {#arrange} @@ -405,7 +405,7 @@ arrange(top_n(freq_dest, n = 10, wt = num_flights), desc(num_flights)) **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** Create a new data frame that shows the top 5 airports with the largest arrival delays from NYC in 2013. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ## The pipe `%>%` @@ -458,7 +458,7 @@ ten_freq_dests <- flights %>% **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** Write out exactly how the `ten_freq_dests` data set was created using the "and then" verbiage. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** The piping syntax will be our major focus throughout the rest of this book and you'll find that you'll quickly be addicted to the chaining with some practice. If you'd like to see more examples on using `dplyr`, the FMV (in addition to some other `dplyr` verbs), and `%>%` with the `nycflights13` data set, you can check out Chapter 5 of Hadley and Garrett's book [@rds2016]. ## Joining/merging data frames @@ -509,7 +509,7 @@ knitr::include_graphics("images/join-inner.png") There are more complex joins available, but the `inner_join` will solve nearly all (if not all) of the problems you'll face in our experience. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc5-7, type='learncheck'} **_Learning check_** @@ -519,7 +519,7 @@ There are more complex joins available, but the `inner_join` will solve nearly a **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What surprises you about the top 10 destinations from NYC in 2013? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ## What's to come? diff --git a/06-inference_basics.Rmd b/06-inference_basics.Rmd index 24fcbf3f..1d05a381 100755 --- a/06-inference_basics.Rmd +++ b/06-inference_basics.Rmd @@ -35,7 +35,7 @@ You've carefully followed along with the recipe but you are concerned that you d How can we answer these questions? Does it matter where we take a bite of soup from? Is there anything we should do to the soup before we taste? Is one taste enough? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc6-0a, type='learncheck'} **_Learning check_** @@ -45,13 +45,13 @@ How can we answer these questions? Does it matter where we take a bite of soup **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** Describe a different scenario (not food or drink related) that is analogous to sampling concepts covered here. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ### Common terms The process of sampling brings with it many common terms that we define now. As you read over these definitions, think about how they each apply to the tasting soup example above. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** **Definition: population** @@ -85,7 +85,7 @@ A *parameter* is a calculation based on one or more variables measured in the po A *statistic* is a calculated based on one or more variables measured in the sample. Parameters are usually denoted by lower case Arabic letters with other symbols added sometimes. These include $\bar{x}$, $\hat{p}$, $s$, $p$, and $b$. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** Let's explore these terms for our tasting soup example: @@ -110,7 +110,7 @@ Let's explore these terms for our tasting soup example: - How salty the spoonful of soup is that we collected as our sample - How crunchy the carrots are in our spoonful of soup -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc6-0b, type='learncheck'} **_Learning check_** ``` @@ -125,7 +125,7 @@ Let's explore these terms for our tasting soup example: **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** What biases might we see if we only select flights to Boston when we are interested in looking at mean flight delays from NYC? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ## Simulation @@ -199,7 +199,7 @@ It's amazing that there is no actual evidence that such an event actually took p We need to think about this problem from the standpoint of hypothesis testing. First, we'll need to identify some important parts of a hypothesis test before we proceed with the analysis. -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc6-1, type='learncheck'} **_Learning check_** ``` @@ -212,7 +212,7 @@ We need to think about this problem from the standpoint of hypothesis testing. **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** How could we test to see whether the person is just guessing or if they have some special talent of identifying milk before tea or vice-versa? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ```{block lc8-1, type='learncheck'} **_Learning check_** @@ -75,7 +75,7 @@ It's worthy of mention here that confidence intervals are always centered at the **`r paste0("(LC", chap, ".", (lc <- lc + 1), ")")`** There is a relationship between the significance level and the confidence level. What do you think it is? -`r if(knitr:::is_html_output()) '
'` `r if(knitr:::is_latex_output()) '\\begin{center}\\rule{\\linewidth}{\\linethickness}\\end{center}'` +*** ## What's to come? diff --git a/_bookdown_files/ismay_files/figure-html/jitteralpha-1.png b/_bookdown_files/ismay_files/figure-html/jitteralpha-1.png index 026e7d03..4507285f 100644 Binary files a/_bookdown_files/ismay_files/figure-html/jitteralpha-1.png and b/_bookdown_files/ismay_files/figure-html/jitteralpha-1.png differ diff --git a/_bookdown_files/ismay_files/figure-html/noalpha-1.png b/_bookdown_files/ismay_files/figure-html/noalpha-1.png index cf3ff24c..24d4a175 100644 Binary files a/_bookdown_files/ismay_files/figure-html/noalpha-1.png and b/_bookdown_files/ismay_files/figure-html/noalpha-1.png differ diff --git a/_bookdown_files/ismay_files/figure-html/unnamed-chunk-29-1.png b/_bookdown_files/ismay_files/figure-html/unnamed-chunk-29-1.png index f44bfaf6..c566c2be 100644 Binary files a/_bookdown_files/ismay_files/figure-html/unnamed-chunk-29-1.png and b/_bookdown_files/ismay_files/figure-html/unnamed-chunk-29-1.png differ diff --git a/_bookdown_files/ismay_files/figure-html/unnamed-chunk-31-1.png b/_bookdown_files/ismay_files/figure-html/unnamed-chunk-31-1.png index 4ff9549d..c7697191 100644 Binary files a/_bookdown_files/ismay_files/figure-html/unnamed-chunk-31-1.png and b/_bookdown_files/ismay_files/figure-html/unnamed-chunk-31-1.png differ diff --git a/_bookdown_files/ismay_files/figure-latex/alpha-1.pdf b/_bookdown_files/ismay_files/figure-latex/alpha-1.pdf index efc674dc..7adb05f2 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/alpha-1.pdf and b/_bookdown_files/ismay_files/figure-latex/alpha-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/badbox-1.pdf b/_bookdown_files/ismay_files/figure-latex/badbox-1.pdf index 61dc4878..2957af24 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/badbox-1.pdf and b/_bookdown_files/ismay_files/figure-latex/badbox-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/carrierpie-1.pdf b/_bookdown_files/ismay_files/figure-latex/carrierpie-1.pdf index 7e34b89a..3cde10c5 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/carrierpie-1.pdf and b/_bookdown_files/ismay_files/figure-latex/carrierpie-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/facethistogram-1.pdf b/_bookdown_files/ismay_files/figure-latex/facethistogram-1.pdf index ed8dfbc7..c86fb0b1 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/facethistogram-1.pdf and b/_bookdown_files/ismay_files/figure-latex/facethistogram-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/flightsbar-1.pdf b/_bookdown_files/ismay_files/figure-latex/flightsbar-1.pdf index b9ebd963..df093003 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/flightsbar-1.pdf and b/_bookdown_files/ismay_files/figure-latex/flightsbar-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/jitteralpha-1.pdf b/_bookdown_files/ismay_files/figure-latex/jitteralpha-1.pdf index b30a2370..d3557429 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/jitteralpha-1.pdf and b/_bookdown_files/ismay_files/figure-latex/jitteralpha-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/lineflights-1.pdf b/_bookdown_files/ismay_files/figure-latex/lineflights-1.pdf index 7a1d03b9..a2a698d0 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/lineflights-1.pdf and b/_bookdown_files/ismay_files/figure-latex/lineflights-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/monthtempbox-1.pdf b/_bookdown_files/ismay_files/figure-latex/monthtempbox-1.pdf index 9864a8a0..ec23439e 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/monthtempbox-1.pdf and b/_bookdown_files/ismay_files/figure-latex/monthtempbox-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/noalpha-1.pdf b/_bookdown_files/ismay_files/figure-latex/noalpha-1.pdf index 6dd0b67d..44639733 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/noalpha-1.pdf and b/_bookdown_files/ismay_files/figure-latex/noalpha-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-100-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-100-1.pdf index 19c9d61e..19be42c7 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-100-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-100-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-101-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-101-1.pdf index 7d2e390e..e3a82653 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-101-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-101-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-107-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-107-1.pdf index 77268b64..9269287c 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-107-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-107-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-108-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-108-1.pdf index 9f92fdba..d4f34a10 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-108-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-108-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-109-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-109-1.pdf index 0f24a270..95f109dd 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-109-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-109-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-110-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-110-1.pdf index 90b93521..0d7e16c8 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-110-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-110-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-117-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-117-1.pdf index a1da51b3..19574adc 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-117-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-117-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-119-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-119-1.pdf index 94d21e6b..645c8019 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-119-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-119-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-14-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-14-1.pdf index 975f9f74..548f7c3d 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-14-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-14-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-15-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-15-1.pdf index 93cf52f7..d2316111 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-15-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-15-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-16-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-16-1.pdf index b2b99659..7a0f8069 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-16-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-16-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-17-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-17-1.pdf index c1da61f7..2428c056 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-17-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-17-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-18-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-18-1.pdf index 1266fb9a..cdc4a732 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-18-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-18-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-27-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-27-1.pdf index ec506d4a..a844b532 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-27-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-27-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-28-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-28-1.pdf index 2829983e..c6938347 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-28-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-28-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-29-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-29-1.pdf index 5ab20295..301571c3 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-29-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-29-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-31-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-31-1.pdf index 58f23e64..1392aeb6 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-31-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-31-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-32-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-32-1.pdf index fcf24791..4515ba62 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-32-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-32-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-58-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-58-1.pdf index ae6b79f6..0b75632b 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-58-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-58-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-75-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-75-1.pdf index d3369afc..8264f4da 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-75-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-75-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-76-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-76-1.pdf index d360c034..2a056b13 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-76-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-76-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-79-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-79-1.pdf index 137a39e4..45ca94f0 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-79-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-79-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-82-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-82-1.pdf index f37ee88a..5c1bb9c5 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-82-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-82-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-84-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-84-1.pdf index 3f63e1d9..914c991d 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-84-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-84-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-97-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-97-1.pdf index d80c4d8b..535c2622 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-97-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-97-1.pdf differ diff --git a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-98-1.pdf b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-98-1.pdf index eee9fdca..5aa95636 100644 Binary files a/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-98-1.pdf and b/_bookdown_files/ismay_files/figure-latex/unnamed-chunk-98-1.pdf differ diff --git a/bib/packages.bib b/bib/packages.bib index 7dc01755..f4f1fddf 100755 --- a/bib/packages.bib +++ b/bib/packages.bib @@ -55,6 +55,20 @@ @Manual{R-knitr note = {R package version 1.14}, url = {https://CRAN.R-project.org/package=knitr}, } +@Manual{R-lattice, + title = {lattice: Trellis Graphics for R}, + author = {Deepayan Sarkar}, + year = {2015}, + note = {R package version 0.20-33}, + url = {https://CRAN.R-project.org/package=lattice}, +} +@Manual{R-Matrix, + title = {Matrix: Sparse and Dense Matrix Classes and Methods}, + author = {Douglas Bates and Martin Maechler}, + year = {2016}, + note = {R package version 1.2-7}, + url = {https://CRAN.R-project.org/package=Matrix}, +} @Manual{R-mosaic, title = {mosaic: Project MOSAIC Statistics and Mathematics Teaching Utilities}, author = {Randall Pruim and Daniel T. Kaplan and Nicholas J. Horton}, @@ -62,6 +76,13 @@ @Manual{R-mosaic note = {R package version 0.14.4}, url = {https://CRAN.R-project.org/package=mosaic}, } +@Manual{R-mosaicData, + title = {mosaicData: Project MOSAIC Data Sets}, + author = {Randall Pruim and Daniel Kaplan and Nicholas Horton}, + year = {2016}, + note = {R package version 0.14.0}, + url = {https://CRAN.R-project.org/package=mosaicData}, +} @Manual{R-nycflights13, title = {nycflights13: Flights that Departed NYC in 2013}, author = {Hadley Wickham}, diff --git a/docs/10-conclusion.html b/docs/10-conclusion.html index 83229819..778bdfe3 100644 --- a/docs/10-conclusion.html +++ b/docs/10-conclusion.html @@ -25,7 +25,7 @@ - +