Problem 1
Use the data set of measurements of antelope astragali from Barr (2014).
- Read in the data, saving it to a variable called
astrag. - Make a scatterplot with the natural logarithm of measurement
Bon the x-axis and the natural logarithm of measurementDistRadon the y-axis. - Calculate the ordinary least-squares (OLS) regression for
log(DistRad)as a function oflog(B), and print asummary()of this data. - Calculate the reduced major axis regression (RMA) for the same variables. Note the
lmodel2package uses “RMA”” to refer to “Ranged Major Axis”, which is different. You want whatlmodel2calls Major Axis (MA), which is equivalent to what we call reduced major axis (RMA) in our literature. - Is the OLS slope greater or less than the RMA slope?
- 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.
- 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. - Extract the residuals from the OLS regression, and make a histogram of them, with the appropriate labels and title for the plot.
- Calculate the species means for both variables
log(B)andlog(DistRad), and add the species means as a new layer on the scatterplot created in part B.