Exercise 7: Compute the Range (Pg. 152)
Compute descriptive statistics for liberal arts colleges and research universities in the Excel file Colleges and Universities. Compare the two types of colleges. What can you conclude?
df <- read.csv("./data/colleges-and-universities.csv")
df
summary(df[df$Type == "Lib Arts", ])
## School Type Median.SAT Acceptance.Rate
## Amherst : 1 Lib Arts :25 Min. :1170 Min. :0.2200
## Barnard : 1 University: 0 1st Qu.:1230 1st Qu.:0.3300
## Bates : 1 Median :1255 Median :0.3800
## Bowdoin : 1 Mean :1257 Mean :0.4056
## Bryn Mawr: 1 3rd Qu.:1290 3rd Qu.:0.4900
## Carleton : 1 Max. :1336 Max. :0.6700
## (Other) :19
## Expenditures.Student Top.10..HS Graduation..
## Min. :15904 Min. :47.00 Min. :72.00
## 1st Qu.:18847 1st Qu.:61.00 1st Qu.:80.00
## Median :20377 Median :68.00 Median :85.00
## Mean :21612 Mean :67.24 Mean :84.12
## 3rd Qu.:24718 3rd Qu.:76.00 3rd Qu.:88.00
## Max. :27879 Max. :86.00 Max. :93.00
##
summary(df[df$Type == "University", ])
## School Type Median.SAT Acceptance.Rate
## Berkeley : 1 Lib Arts : 0 Min. :1109 Min. :0.1700
## Brown : 1 University:24 1st Qu.:1223 1st Qu.:0.2400
## Cal Tech : 1 Median :1280 Median :0.3150
## Carnegie Mellon: 1 Mean :1270 Mean :0.3554
## Columbia : 1 3rd Qu.:1330 3rd Qu.:0.4550
## Cornell : 1 Max. :1400 Max. :0.6400
## (Other) :18
## Expenditures.Student Top.10..HS Graduation..
## Min. : 19365 Min. :52.00 Min. :61.00
## 1st Qu.: 26098 1st Qu.:76.25 1st Qu.:75.75
## Median : 37867 Median :83.50 Median :86.00
## Mean : 38861 Mean :81.46 Mean :82.33
## 3rd Qu.: 46139 3rd Qu.:90.25 3rd Qu.:89.25
## Max. :102262 Max. :98.00 Max. :93.00
##
par(mfrow = c(2,3))
boxplot(Median.SAT ~ Type, data = df, main = "Median.SAT")
boxplot(Acceptance.Rate ~ Type, data = df, main = "Acceptance.Rate")
boxplot(Expenditures.Student ~ Type, data = df, main = "Expenditures.Student")
boxplot(Top.10..HS ~ Type, data = df, main = "Top.10..HS")
boxplot(Graduation.. ~ Type, data = df, main = "Graduation..")
Kết luận:
Có sự khác biệt giữa 2 nhóm Lib Arts và University. - Về điểm SAT: University cao hơn (1270 > 1257) - Về tỉ lệ đậu: Lib Art cao hơn (40% > 35%) - Về chi phí học: University cao hơn 1.8 lần ($38,861 > $21,612) - Về tỉ lệ sv nằm trong top 10% ở trường trung học: University cao hơn 1.2 lần (81 > 67) - Về tỉ lệ tốt nghiệp: Lib Art cao hơn (84% > 82%)
Tóm lại, University thu hút được nhiều sv giỏi hơn, có tỉ lệ đậu khắt khe hơn và tỉ lệ tốt nghiệp thấp hơn. Lib Arts là sự lựa chọn dễ dàng hơn cho sinh viên.