Section 1.5, problem 8, page 21

ad <- read.table("https://media.pearsoncmg.com/cmg/pmmg_mml_shared/mathstatsresources/Akritas/TreeDiamAAge3Stk.txt", header = TRUE) #load the data
diam <- ad$diam
age <- ad$age
tree <- ad$tree
tree <- factor(tree, levels = c("SMaple", "BSWOak", "WOak"))
colors <- c("red", "green", "blue")[as.numeric(tree)]
plot(diam, age, main = "Age vs Diameter", pch = 21, bg = colors, col = "black")
legend( "topleft", pch = c(21, 21, 21), pt.bg = c("red", "green","blue" ), col = "black", legend = c("SMaple","BSWOak", "WOak"))

all three types of trees have a linear relationship between diameter and age. However, each tree has a different y-intercept and a different slope, or rate of growth, with BSWOak passing the diameter of SMaple at one point.

Section 1.7, problem 3, p. 35

t <- read.table("https://media.pearsoncmg.com/cmg/pmmg_mml_shared/mathstatsresources/Akritas/RobotReactTime.txt",   header = T)
t2 <-t$Time[t$Robot==2]
boxplot(t2,main = "Robot 2 Time",ylab = "Time")
summary_stats <- fivenum(t2)
names(summary_stats) <- c("Min", "Q1", "Median", "Q3", "Max")
print(summary_stats)
##    Min     Q1 Median     Q3    Max 
##  28.97  29.28  29.94  30.83  32.23
legend("topleft",legend = paste(names(summary_stats),round(summary_stats, 2)),title = "Five-number summary",bty = "n")

No outliers

Airquality data set

data(airquality)

for all parts

row_count <- nrow(airquality)
print(row_count)
## [1] 153

153

mean_temp <- mean(airquality$Temp)
print(mean_temp)
## [1] 77.88235
sd_temp <- sd(airquality$Temp)
print(sd_temp)
## [1] 9.46527

77.88, 9.47

count_wind_gt_12 <- sum(airquality$Wind > 12)
print(count_wind_gt_12)
## [1] 34

34

pairs(airquality[ , 1:5],main = "5 Variables of Airquality",pch = 21)

Yes, there is a positive correlation between ozone and temp.

Ozone may be higher with increased solar radiation.

August(8) has the highest Ozone levels.

Create a chunk: ctrl+alt+I