--- title: "ISI2 Exploration 1.2" output: word_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) load(url("http://www.isi-stats.com/isi2/ISI.RData")) options(repos=c(CRAN="https://ftp.osuosl.org/pub/cran/")) install.packages("lattice") ``` ## Load in the data file, e.g., ```{r} DungBeetles <- read.table("http://www.isi-stats.com/isi2/data/DungBeetles.txt", sep="\t", header=T, stringsAsFactors = T) head(DungBeetles) ``` ##Distribution of time ```{r} hist(DungBeetles$time) isisummary(DungBeetles$time) hist(resid(lm(DungBeetles$time~1))) summary(lm(DungBeetles$time~1))$sigma ``` **6) Confirm that (n − 1) × (SD of times)^2 = SSTotal ** ```{r} #Sum of Squares residuals = Sum of Squares Total for the single mean model aov(DungBeetles$time~1) ``` ##Subset by treatment ```{r} library(lattice) histogram(~DungBeetles$time | DungBeetles$treatment) ``` ##Examine residuals ```{r} with(DungBeetles, hist(resid(lm(DungBeetles$time~treatment)))) with(DungBeetles, summary(lm(DungBeetles$time~treatment))$sigma) ``` **9) Verify that (n − 2) × (SE residuals)^2 ≈ SSError** ```{r} #SSError = Sum of Squares residuals aov(DungBeetles$time~DungBeetles$treatment) ```