Browsing resource, all submissions are temporary.
A heavier mammal tends to live a longer life. In this exercise, you will find an approximate fitting formula relating a mammal's weight and its life span. A csv file containing the data of 15 mammals can be downloaded here and then loaded to R using the command
mammals <- read.csv("animal_lifespan.csv", comment.char="#")
The option comment.char="#" is to tell R that '#' is a comment character. R will ignore everything following '#' in the rest of a line. The file has 4 columns. The first column is the name of the creature. The second column is the average weight in pounds. The third column is the mammal's heart rate in units of the number of beats per minute. The last column is the mammal's average life span in years. The data frame is small and you should be able to see the entire data on your screen by typing mammals.
comment.char="#"
mammals
a. We want to use the lm() function to fit a linear model. Make plots of functions of lifespan versus functions of weight. Determine from the plots which of the following pairs of variables is closest to following a linear relationship. In the following, sqrt is the square root and log is the natural logarithm (base e). log(lifespan) ~ log(weight) lifespan ~ sqrt(weight) log(lifespan) ~ sqrt(weight) sqrt(lifespan) ~ sqrt(weight) lifespan ~ weight
Parts (b) - (f) will show up after you finish part (a).