0715 HW002

Goal:畫出107、108年的數學和社會科考生的級分分布情況,並觀察其差異。

Why:身為108學測的考生,我跟很多人(?)都覺得今年的今年的數學很簡單(新聞說是近五年最簡單),而我蠻有把握的社會科感覺卻偏難,所以想藉由今年跟去年學測考生的級分分布情況來觀察這兩科的難度在這兩年間是否有差異。

Source:

Step1:安裝Package:readxl,dplyr,ggplot2

library(readxl)
library(dplyr)
library(ggplot2)

Step2:匯入Excel檔,並把Column屬性設為numeric(數字才不會以日期形式呈現)

exam107 <- read_excel("C:/Users/User/Desktop/exam107.xls" , col_types = "numeric")
suppressWarnings(read_excel("C:/Users/User/Desktop/exam107.xls" , col_types = "numeric"))
## # A tibble: 16 x 21
##     級數 國文人數 國文百分比 `國文累計\n人數` `國文累計\n百分比`~ 英文人數
##    <dbl>    <dbl>      <dbl>            <dbl>            <dbl>    <dbl>
##  1    15     3764       2.79           134677           100        7407
##  2    14     9637       7.16           130913            97.2     13220
##  3    13    16699      12.4            121276            90.0     12992
##  4    12    21590      16.0            104577            77.6     13365
##  5    11    22303      16.6             82987            61.6     11971
##  6    10    19679      14.6             60684            45.1      9741
##  7     9    15209      11.3             41005            30.4      9566
##  8     8    10377       7.71            25796            19.2      8886
##  9     7     6699       4.97            15419            11.4      7715
## 10     6     4076       3.03             8720             6.47     8332
## 11     5     2396       1.78             4644             3.45     9146
## 12     4     1263       0.94             2248             1.67     9556
## 13     3      798       0.59              985             0.73    10426
## 14     2      171       0.13              187             0.14     1890
## 15     1       12       0.01               16             0.01       60
## 16     0        4       0                   4             0           4
## # ... with 15 more variables: 英文百分比 <dbl>, 英文累計人數 <dbl>,
## #   `英文累計百分比\n` <dbl>, 數學人數 <dbl>, 數學百分比 <dbl>,
## #   數學累計人數 <dbl>, 數學累計人數百分比 <dbl>, 社會人數 <dbl>,
## #   社會百分比 <dbl>, 社會累計人數 <dbl>, 社會累計百分比 <dbl>,
## #   自然人數 <dbl>, 自然百分比 <dbl>, 自然累計人數 <dbl>,
## #   自然累計百分比 <dbl>
exam108 <- read_excel("C:/Users/User/Desktop/exam108.xls" , col_types = "numeric")
suppressWarnings(read_excel("C:/Users/User/Desktop/exam108.xls" , col_types = "numeric"))
## # A tibble: 16 x 21
##     級數 國文人數 國文百分比 `國文累計\n人數` `國文累計\n百分比`~ 英文人數
##    <dbl>    <dbl>      <dbl>            <dbl>            <dbl>    <dbl>
##  1    15     4438       3.26           136189           100        7689
##  2    14    11530       8.47           131751            96.7     13395
##  3    13    18939      13.9            120221            88.3     13511
##  4    12    22431      16.5            101282            74.4     12908
##  5    11    21832      16.0             78851            57.9     10781
##  6    10    18576      13.6             57019            41.9      9806
##  7     9    13429       9.86            38443            28.2      8658
##  8     8     8982       6.6             25014            18.4      8246
##  9     7     6069       4.46            16032            11.8      7993
## 10     6     4058       2.98             9963             7.32     8727
## 11     5     2741       2.01             5905             4.34     9546
## 12     4     1658       1.22             3164             2.32    12025
## 13     3     1036       0.76             1506             1.11    10525
## 14     2      437       0.32              470             0.35     2082
## 15     1       26       0.02               33             0.02       47
## 16     0        7       0.01                7             0.01        9
## # ... with 15 more variables: 英文百分比 <dbl>, 英文累計人數 <dbl>,
## #   `英文累計百分比\n` <dbl>, 數學人數 <dbl>, 數學百分比 <dbl>,
## #   數學累計人數 <dbl>, 數學累計人數百分比 <dbl>, 社會人數 <dbl>,
## #   社會百分比 <dbl>, 社會累計人數 <dbl>, 社會累計百分比 <dbl>,
## #   自然人數 <dbl>, 自然百分比 <dbl>, 自然累計人數 <dbl>,
## #   自然累計百分比 <dbl>
head(exam107)
## # A tibble: 6 x 21
##    級數 國文人數 國文百分比 `國文累計\n人數` `國文累計\n百分比`~ 英文人數
##   <dbl>    <dbl>      <dbl>            <dbl>            <dbl>    <dbl>
## 1    15     3764       2.79           134677            100       7407
## 2    14     9637       7.16           130913             97.2    13220
## 3    13    16699      12.4            121276             90.0    12992
## 4    12    21590      16.0            104577             77.6    13365
## 5    11    22303      16.6             82987             61.6    11971
## 6    10    19679      14.6             60684             45.1     9741
## # ... with 15 more variables: 英文百分比 <dbl>, 英文累計人數 <dbl>,
## #   `英文累計百分比\n` <dbl>, 數學人數 <dbl>, 數學百分比 <dbl>,
## #   數學累計人數 <dbl>, 數學累計人數百分比 <dbl>, 社會人數 <dbl>,
## #   社會百分比 <dbl>, 社會累計人數 <dbl>, 社會累計百分比 <dbl>,
## #   自然人數 <dbl>, 自然百分比 <dbl>, 自然累計人數 <dbl>,
## #   自然累計百分比 <dbl>
head(exam108)
## # A tibble: 6 x 21
##    級數 國文人數 國文百分比 `國文累計\n人數` `國文累計\n百分比`~ 英文人數
##   <dbl>    <dbl>      <dbl>            <dbl>            <dbl>    <dbl>
## 1    15     4438       3.26           136189            100       7689
## 2    14    11530       8.47           131751             96.7    13395
## 3    13    18939      13.9            120221             88.3    13511
## 4    12    22431      16.5            101282             74.4    12908
## 5    11    21832      16.0             78851             57.9    10781
## 6    10    18576      13.6             57019             41.9     9806
## # ... with 15 more variables: 英文百分比 <dbl>, 英文累計人數 <dbl>,
## #   `英文累計百分比\n` <dbl>, 數學人數 <dbl>, 數學百分比 <dbl>,
## #   數學累計人數 <dbl>, 數學累計人數百分比 <dbl>, 社會人數 <dbl>,
## #   社會百分比 <dbl>, 社會累計人數 <dbl>, 社會累計百分比 <dbl>,
## #   自然人數 <dbl>, 自然百分比 <dbl>, 自然累計人數 <dbl>,
## #   自然累計百分比 <dbl>

Step3:利用ggplot2裡的geom_col畫出數學科的人數及百分比

(紅色邊框是107年;綠色邊框是108年)

plot10711 <- ggplot(exam107, aes(x=級數,y=數學人數,fill=級數))+geom_col(colour="red")
plot10811 <- ggplot(exam108, aes(x=級數,y=數學人數,fill=級數))+geom_col(colour="green")
plot10711

plot10811

plot10712 <- ggplot(exam107, aes(x=級數,y=數學百分比,fill=級數))+geom_col(colour="red")
plot10812 <- ggplot(exam108, aes(x=級數,y=數學百分比,fill=級數))+geom_col(colour="green")
plot10712

plot10812

Step3:利用ggplot2裡的geom_bar,coord_polar畫出數學人數百分比的圓餅圖

(註:百分比適合用於作圓餅圖,也不會因考生人數影響結果)

plot10713 <- ggplot(exam107, aes(x=factor(1),y=數學百分比,fill=級數))+geom_bar(width=100, stat="identity",colour="red")+coord_polar("y",start=0)
plot10813 <- ggplot(exam108, aes(x=factor(1),y=數學百分比,fill=級數))+geom_bar(width=100, stat="identity",colour="green")+coord_polar("y",start=0)
plot10713

plot10813

Step4:將社會科人數分布的長條圖、百分比分布的長條和圓餅作出(同前二步),即可進行比較。

(黃色邊框是107年;紫色邊框是108年)

plot10721 <- ggplot(exam107, aes(x=級數,y=社會人數,fill=級數))+geom_col(colour="gold")
plot10821 <- ggplot(exam108, aes(x=級數,y=社會人數,fill=級數))+geom_col(colour="maroon1" )
plot10721

plot10821

plot10722 <- ggplot(exam107, aes(x=級數,y=社會百分比,fill=級數))+geom_col(colour="gold")
plot10822 <- ggplot(exam108, aes(x=級數,y=社會百分比,fill=級數))+geom_col(colour="maroon1" )
plot10722

plot10822

plot10723 <- ggplot(exam107, aes(x=factor(1),y=社會百分比,fill=級數))+geom_bar(width=100, stat="identity",colour="gold")+coord_polar("y",start=0)
plot10823 <- ggplot(exam108, aes(x=factor(1),y=社會百分比,fill=級數))+geom_bar(width=100, stat="identity",colour="maroon1")+coord_polar("y",start=0)
plot10723

plot10823

Step5:得出結論

根據長條圖的變化可發現107年的數學科大多數人落在5-11級分,而108年則是分佈相對平均,4-14級分的人數皆相差不多,而從圓餅圖更可以發現,15級分的人比例大約增長2-3倍,不考慮考生實力的話,可以推論出108年的數學學測相較於前一年是較難的。而在社會科的人數比例長條圖中可發現,去年的14與15級分之總和超過了百分之20,今年的總和卻不到百分之10,因此可推論出其難度是有變難的,但圖中10-12級的級分人數是增高的,因此可看出雖然難度增加,但也造成了考生成績分佈相對集中。