Assignment 4: RMarkdown

Due by 5:00 PM on Thursday, October 8, 2020

To submit on blackboard, due 10-08-2020, 5:00pm

First, create an R Markdown document in which you will complete this assignment. Demonstrate your knowledge of R Markdown in the following ways:

  • Produce a section header that says “R Markdown” and is bigger than normal text.

    • Within this section, produce a subsection header that is smaller than the section header and says “R Markdown features”.
    • Write a sentence that includes bold text, italicized text, and normal text. (This will not be in a code chunk.)
    • Write a sentence that includes one inline R code in the sentence.
    • Link an image from your computer - that is school-appropriate - to be output when the document is knitted together.
    • Produce a 3x3 table with column headers just using text - no code chunk. (See Lecture 4 for a hint).
  • Produce a section header that says “Statistical functions” and is bigger than normal text.

    • Read in the dataset ‘warpbreaks’. It comes as a default with R.
      • Fit a regression model of the number of breaks on the type of wool, the level of tension, and the interaction between wool and tension.
      • Look at the summary. Interpret the results.
      • Plot only the QQ-plot of this model. Then, provide code that would save it as a pdf to your computer.
    • Now, read in the ‘UCBAdmissions’ dataset, which comes as default with R.
      • Only keep the admissions data from Department A.
      • Run a chi-squared test of independence between gender and admittance. Comment on the results.
    • Going to simulate some data now. Set a seed for reproducibility.
      • Generate \(1000\) observations from a Normal distribution with parameters \(\mu=5, \sigma=2\).
      • Plot the empirical cdf of these data. Add a horizontal line in red at the \(0.8\) mark on the y-axis.
      • Use R’s statistical distribution functions to determine the \(80^{th}\) percentile of the above normal distribution, and store it in a variable called q80.
        • Add a point to the plot that has x-coordinate equal to the \(80^{th}\) percentile of your sample data and y-coordinate equal to \(0.8\). Fill it in with some color.
        • Add another point that has x-coordinate equal to q80 and y-coordinate equal to \(0.8\). Fill it in with another color.
        • Think about what all this means.