# 1 Kangaroos skull measurements: mandible length

What effect does sex and species have on the mandible length of a kangaroo skull?

The data to be analyzed here are selected skull measurements on 148 kangaroos of known sex and species. There are 11 columns of data, corresponding to the following features. The measurements are in meters/10000 (mm/10).

column | Variable name | Description 1 | sex | sex (1=M, 2=F) 2 | species | species (0=M. giganteus, 1=M.f. melanops, 2=M.f. fuliginosus) 3 | pow | post orbit width 4 | rw | rostal width 5 | sopd | supra-occipital - paroccipital depth 6 | cw | crest width 7 | ifl | incisive foramina length 8 *| ml | mandible length 9 | mw | mandible width 10 | md | mandible depth 11 | arh | ascending ramus height

Some of the observations in the data set are missing (not available). These are represented by a period ., which in the read.table() function is specified by the na.strings = "." option.

fn.data <- "http://statacumen.com/teach/ADA2/worksheet/ADA2_WS_09_kang.txt"

# subset only our columns of interest
kang <- subset(kang, select = c(sex, species, ml))

# remove observations with missing values
n.start <- nrow(kang)
kang <- na.omit(kang)
n.keep <- nrow(kang)
n.drop <- n.start - n.keep
cat("Removed", n.start, "-", n.keep, "=", n.drop, "observations with missing values.")
Removed 148 - 136 = 12 observations with missing values.
# make dose a factor variable and label the levels
kang$sex <- factor(kang$sex    , labels = c("M","F"))
kang$species <- factor(kang$species, labels = c("Mg", "Mfm", "Mff"))

# The first few observations
head(kang)
  sex species   ml
1   M      Mg 1086
2   M      Mg 1158
3   M      Mg 1131
4   M      Mg 1090
5   M      Mg 1175
6   M      Mg  901

## 1.1(1 p) Interpret plots of the data, distributional centers and shapes

The side-by-side boxplots of the data compare the mandible lengths across the 6 combinations of sex and species. Comment on the distributional shapes and compare the typical mandible lengths across groups.

## 1.2(1 p) Do the plots above suggest there is an interaction?

Do the lines for each group seem to be very different from parallel?

## 1.4(1 p) Check model assumptions for full model

Recall that we assume that the full model is correct before we perform model reduction by backward selection.

## 1.5(3 p) ANOVA table, test for interaction and main effects

Test for the presence of interaction between sex and species. Also test for the presence of main effects, effects due to the sex and species.

## 1.6(1 p) Reduce to final model, test assumptions

If the model can be simplified (because interaction is not significant), then refit the model with only the main effects. Test whether the main effects are significant, reduce further if sensible. Test model assumptions of your final model.

## 1.7(2 p) Summarize the differences

Summarize differences, if any, in sexes and species using relevant multiple comparisons. Give clear interpretations of any significant effects.

This code is here to get you started. Determine which comparisons you plan to make and modify the appropriate code.

library(lsmeans)
# fill in your "lm.object", and only use the lines below that apply to your model
lsmeans(lm.object, list(pairwise ~ sex           ), adjust = "tukey")
lsmeans(lm.object, list(pairwise ~ species       ), adjust = "tukey")
lsmeans(lm.object, list(pairwise ~ sex | species ), adjust = "tukey")
lsmeans(lm.object, list(pairwise ~ species | sex ), adjust = "tukey")