Problem 1

Use the data set of measurements of antelope astragali from Barr (2014).

  1. Read in the data, saving it to a variable called astrag.
  2. Make a scatterplot with the natural logarithm of measurement B on the x-axis and the natural logarithm of measurement DistRad on the y-axis.
  3. Calculate the ordinary least-squares (OLS) regression for log(DistRad) as a function of log(B), and print a summary() of this data.
  4. Calculate the reduced major axis regression (RMA) for the same variables. Note the lmodel2 package uses “RMA”" to refer to “Ranged Major Axis”, which is different. You want what lmodel2 calls Major Axis (MA), which is equivalent to what we call reduced major axis (RMA) in our literature.
  5. Is the OLS slope greater or less than the RMA slope?
  6. Add both the OLS and the RMA regression lines to the plot created in part B. Make sure the two lines have different colors and/or line types, and that they are labeled so I know which is which.
  7. use the plot() function to plot regression diagnostic plots for the OLS regression model. Do the assumptions of linear regression appear to be met? Explain your answer in complete sentences.
  8. Extract the residuals from the OLS regression, and make a histogram of them, with the appropriate labels and title for the plot.
  9. Calculate the species means for both variables B and DistRad, and add the species means as a new layer on the scatterplot created in part B.