Estimating with uncertainty (Part 2)

M. Drew LaMar
February 8, 2016

“Statistics show that of those who contract the habit of eating, very few survive.”

- George Bernard Shaw

Course Announcements - Lab #4 (early)

alt text

  • DataCamp: Intermediate R
    • Chapter 1: Conditionals and Control Flow
    • Chapter 2: Loops
    • Chapter 3: Functions
    • Chapter 4: The apply family

Due February 17/18

Course Announcements

  • Reading Assignment for Wednesday - W&S, Chapter 5
  • For quartiles, type = 5 is actually the correct type to reproduce W&S answers (facepalm)
  • The whiskers in boxplot are not just \( 1.5\times IQR \) in either direction
  • Data Visualization Collection

Good Programming Practices

  • When creating a script (or R-Markdown), add a new command, knit the document to check, add another new command, knit, etc.
  • Use indentation and lines - they are your friends. For example,

NO

if (number < 10) {
if (number < 5) {result <- "extra small"} 
else {result <- "small"}
} else if (number < 100) {
result <- "medium"
} else {result <- "large"}
print(result)

Good Programming Practices

  • When creating a script (or R-Markdown), add a new command, knit the document to check, add another new command, knit, etc.
  • Use indentation - it is your friend. For example,

YES

if (number < 10) {
  if (number < 5) {
    result <- "extra small"
  } else {
    result <- "small"
  }
} else if (number < 100) {
  result <- "medium"
} else {
  result <- "large"
}
print(result)

Good Programming Practices

  • When creating a script (or R-Markdown), add a new command, knit the document to check, add another new command, knit, etc.
  • Use indentation - it is your friend.
  • Use smart variable names!!!!
# NO
fred <- read.csv("http://whitlockschluter.zoology.ubc.ca/wp-content/data/chapter03/chap03q21YeastMutantGrowth.csv")

# YES
yeastData <- read.csv("http://whitlockschluter.zoology.ubc.ca/wp-content/data/chapter03/chap03q21YeastMutantGrowth.csv")

Online Tutorials - Precision