Chapter 19

Textbook 19.3.1

Problem 1

Textbook 19.4.4

Problem 1, 6

Textbook 19.5.5

Problem 4

Chapter 20

Textbook 20.3.5

Problem 2

Textbook 20.5.4

Problem 1 (scan your drawing and link it with your .Rmd file)

Textbook 20.7.4

Problem 2, 3

Chapter 21

Textbook 21.2.1

Problem 2

Textbook 21.3.5

Problem 3

Textbook 21.4.1

Problem 1

Textbook 21.5.3

Problem 1

Textbook 21.9.3

Problem 3

Chapter 23

Textbook 23.4.5

Problem 1

Chapter 24

Textbook 24.2.3

Problem 2

Textbook 24.3.5

Problem 2

Extra question(s)

  1. Frances, Professor Won’s 5-year old daughter, is bored in her dad’s office, so she decided to fill a page of her dad’s research notebook with random lines. The paper is square-ruled, with rules exactly 1 cm apart. Frances’ lines have centers uniformly distributed over the page, and uniformly distributed angles. Each of her lines is exactly 0.5 cm long.
    1. Explain why the vertical distance from the center of one of Frances’ lines to the nearest horizontal rule on the paper should be uniformly distributed between 0 and 0.5 cm.
    2. How would you generate the random centers of 1000 of Frances’ lines in R?
    3. Generate the angles between a vertical rule and Frances’ lines.
    4. Let \(y\) be the vertical distance from the center of one of Frances’ lines to the nearest horizontal rule, and \(\theta\) be its angle from the vertical rule. When does the line cross one of the horizontal rules?
    5. Write an R expression to calculate the fraction of Frances’ 1000 lines crossing horizontal rules? What is the fraction?
    6. This is a version of the famous problem called Buffon’s needle. What should be the fraction in part (e)?
  2. (Data manipulation)
    1. For the R built-in iris dataset, the following R code is given:

      data(iris)
      swidth.versicolor <- NULL
      for (i in seq_len(nrow(iris)) ) {
          if (iris$Species[i]=="versicolor") {
                  swidth.versicolor <- c(swidth.versicolor, iris$Sepal.Width[i])
          }
      }

      Vectorize the above code.

    2. Type and run the following R code.

      data(iris)
      head(iris$Sepal.Length[iris$Species])

      Explain why you get those results.