#loading neccesary packages
library(MASS)
## Warning: package 'MASS' was built under R version 4.4.3
View(Boston)
data("Boston")
library(ggplot2)
# crime rate pattern
#What is the distribution of per capita crime rate (crim) across suburbs in
# Histogram for per capita crime rate
hist(Boston$crim,
main = "Distribution of Per Capita Crime Rate (crim)",
xlab = "Crime Rate",
col = "green",
breaks = 30)
# Check summary for potential outliers
summary(Boston$crim)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00632 0.08204 0.25651 3.61352 3.67708 88.97620
boxplot(Boston$crim, main = "Boxplot of Crime Rate")
# Histogram for median home value
hist(Boston$medv,
main = "Distribution of Median Home Values (medv)",
xlab = "Median Value (in $1000s)",
col = "lightgreen",
breaks = 30)
summary(Boston$medv)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 5.00 17.02 21.20 22.53 25.00 50.00
hist(Boston$tax,
main = "distribution of property taxes(tax)",
xlab = "tax rate",
col = "red",
)
summary(Boston$tax)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 187.0 279.0 330.0 408.2 666.0 711.0
boxplot(Boston$tax, main = "Boxplot of Property Tax Rates")
#5
hist(Boston$crim,breaks = 10,
main = "Crime Rate with 10 Bins", col = "lightcoral")
hist(Boston$crim, breaks = 50,
main = "crime rate with 50 bins",col = "red")
hist(Boston$medv,breaks = 10,
main = "median house valuse ")
?Skewed