Week 4 Homework Q11

The accompanying table shows a portion of the average SAT math score (Math), the average SAT writing score (Writing), the number of test takers (Test Taker), and whether the school is a private or public school (Type) for 25 high schools in a major metropolitan area.

library(readxl)
## Warning: package 'readxl' was built under R version 4.0.5
myData <- read_excel("Ch3_Q35_Data_File.xlsx")
View(myData)

a-1. Construct a bubble plot that shows math score on the x-axis, writing score on the y-axis, and number of test takers as the size of the bubble. Given the bubble plot, which statement best describes the relationship between math scores and writing scores?

a2 - Math scores and writing scores have a positive linear relationship.

a-2. Given the bubble plot, which statement best describes the relationship between math scores and the size of the school (the number of test takers)?

Math scores and the size of the school have no apparent relationship.

Construct a scatterplot that shows math score on the x-axis and writing score on the y-axis. Use different colors or symbols to show whether the high school is a private or a public school. Which of the following statements best describes the relationship between math scores, writing scores, and type of school?

plot(myData$Writing ~myData$Math, main = "Scatterplot of Math and Writing Score",
     xlab="Math Scores", ylab = "Writing Score", pch=16, 
     col=ifelse(myData$Type == "Private", 20,26))
legend("right", legend = c("Private", "Public"), pch=16,
       col=c(20, 26))

### Private schools tend to have higher math and writing scores.