This exercise involves the Boston housing data set. (a) To begin, load in the Bo
ID: 3071793 • Letter: T
Question
This exercise involves the Boston housing data set. (a) To begin, load in the Boston data set. The Boston data set is part of the MASS library in R. > library(MASS) Now the data set is contained in the object Boston. > Boston Read about the data set: > ?Boston How many rows are in this data set? How many columns? What do the rows and columns represent? (b) Make some pairwise scatterplots of the predictors (columns) in this data set. Describe your findings. (c) Are any of the predictors associated with per capita crime rate? If so, explain the relationship. (d) Do any of the suburbs of Boston appear to have particularly high crime rates? Tax rates? Pupil-teacher ratios? Comment on the range of each predictor. (e) How many of the suburbs in this data set bound the Charles river?
Explanation / Answer
Solutoa:
> dim(Boston)
[1] 506 14
506 rows
14 columns
Clumns names are:
names(Boston)
"crim" "zn" "indus" "chas" "nox" "rm" "age" "dis" "rad"
] "tax" "ptratio" "black" "lstat" and "medv"
b) Make some pairwise scatterplots of the predictors (columns) in this data set.
pairs(Boston[, -1], gap = 0, pch = ".")
Solutionc:
library(GGally)
ggcorr(Boston, palette = "RdBu", label = TRUE)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.