Assignment 3: R base graphics, statistical functions

Due by 5:00 PM on Tuesday, October 6, 2020

To do yourself

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

  1. Install package “babynames”
  • How many values are in the babynames object?
  • What their data types?
  • Get an overview of babynames
  • Plot the proportion of your name usage vs. year. Choose closest or random name, if your exact spelling is not available
  1. Load in the ToothGrowth dataset, which comes with R.
  • Produce a boxplot of the tooth length variable, with x- and y-axis labels as well as a title.
  • Change the graphics parameters to a window of one row and two columns of plots. Then, populate the first one with a scatterplot of dose on the x-axis and length on the y-axis, only using observations with a VC supplement type. Populate the second one with a scatterplot of dose on the x-axis and length on the y-axis, only using observations with an OJ supplement type. Provide informative axis labels. Use filled-in circles as the plotting character in the first plot, and filled-in triangles as the plotting character in the second plot.
  • Fit a linear regression model of tooth length on the variables ‘supp’ and ‘dose’. Change the graphics parameters back to just one plot, not several. Plot only the QQ-plot of residuals from this regression model, filled in with blue circles.
  1. Set a seed to ensure reproducibility. Then, generate n=100 random variables from an Exponential distribution with lambda=5 parameter. Plot the empirical CDF (cumulative distribution function) of this data with informative axes labels. Make a really long title - so long that you must use a special character to get the title to go on two lines.