# Help with fitting linear models and F-tests in R?

#### oldwarplanes

##### New Member
Hello! I need some assistance with these problems dealing with the following data set:

Code:
"Brains" <-
structure(list(Species = structure(c(7, 11, 12, 19, 24, 25, 26,
34, 37, 8, 3, 20, 30, 6, 36, 23, 15, 9, 18, 28, 32, 35, 39, 14,
31, 38, 27, 5, 4, 21, 2, 13, 10, 17, 22, 33, 29, 1, 16), .Label = c("African.elephant",
"baboon", "barracuda", "bat", "blue.whale", "brown.trout", "canary",
"catfish", "cheetah", "chimpanzee", "crow", "flamingo", "grey.monkey",
"greyhound", "grizzly.bear", "horse", "human", "lion", "loon",
"mackerel", "mole", "mouse", "northern.trout", "ostrich", "pheasant",
"pigeon", "porpoise", "raccoon", "rhinoceros", "salmon", "seal",
"skunk", "squirrel", "stork", "tiger", "tuna", "vulture", "walrus",
"wolf"), class = "factor"), Brain = c(0.848, 9.3, 8.05, 6.12,
42.11, 3.289, 2.694, 16.24, 19.6, 1.84, 3.83, 0.64, 1.257, 0.57,
3.09, 1.233, 233.9, 2.449, 106.7, 40, 10.3, 302, 152, 105.9,
442, 1126, 1735, 6800, 0.936, 1.16, 140, 66.6, 440, 1377, 0.551,
3.97, 655, 5712, 618), Body = c(0.0171, 0.337, 1.598, 1.53,
123, 0.625, 0.282, 3.35, 5.27, 2.894, 5.978, 0.765, 3.93, 0.292,
5.21, 2.5, 142.88, 22.2, 28.79, 5.175, 1.7, 209, 29.94, 24.49,
107.3, 667, 142.43, 58059, 0.028, 0.0396, 7.9, 4.55, 56.69, 74,
0.0177, 0.183, 763, 6654, 461.76), Class = structure(c(1, 1,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), .Label = c("bird",
"fish", "mammal"), class = "factor")), .Names = c("Species",
"Brain.WT", "Body.WT", "Class"), row.names = c("1", "2", "3",
"4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15",
"16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26",
"27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37",
"38", "39"), class = "data.frame")
a. I need to fit the following models in the log scale and use the ANOVA/F-test to assess which model is best:

M1: log(Brain.WT)~ log(Body.WT)
M2: log(Brain.WT)~ log(Body.WT)+ Class
M3: log(Brain.WT)~ log(Body.WT)*Class​

So I'm a bit confused as to which ones I'm comparing to what. I think you compare M3 to M2 to start because M3 is the full model while M2 is the restricted model; same goes for M3 and M1 (but I'm not sure so please, correct me if I'm wrong). I don't think there's much sense in comparing M2 to M1 because they're both restricted models (I think...).

b. As you can see, there are three classes of animals: bird, fish, and mammal. I know the baseline term is bird, but I have to figure out (1) which group has the highest average log(Brain.WT) after controlling for log(Body.WT) and (2) which species seem unusually big brained or particularly small brained relative to their groups. I'm sure the second part of the question won't be as hard once I figure out how to do the first, but I honestly have no clue as to what I should do!