Measures of Central Tendancy

In our class we have learned two measures of central tendancy: mean and median. Today we will also learn interquartile range (IQR). Lets load the data. This is the data of 20 students. Their score and hours of study per week have been recorded.

Defining the Score Vector

Score= c(90,87,100,45,100,98,95,92,88,67,85, 99,100, 55, 39, 78, 100, 99, 99, 100)
Score
##  [1]  90  87 100  45 100  98  95  92  88  67  85  99 100  55  39  78 100  99  99
## [20] 100

Defining the Hours of Study Per Week

Study= c(2,4,6,30,2,20,10,4,10,12,44, 6,8, 4, 32, 30, 6, 8, 9, 10)
Study
##  [1]  2  4  6 30  2 20 10  4 10 12 44  6  8  4 32 30  6  8  9 10

Lets Calculate Mean and Median

mean(Study)
## [1] 12.85
mean(Score)
## [1] 85.8
median(Study)
## [1] 8.5
median(Score)
## [1] 93.5

Mean vs Median

For study, mean>>meadian What does it mean?? For score, median>> mean what does it mean??

Lets check the histograms

Percentile

Score and Hours of Study

Study= c(2,4,6,30,2,20,10,4,10,12,44, 6,8, 4, 32, 30, 6, 8, 9, 10)
quantile(Study, c(0.5, 0.75, 0.92))
##   50%   75%   92% 
##  8.50 14.00 30.96
Score= c(90,87,100,45,100,98,95,92,88,67,85, 99,100, 55, 39, 78, 100, 99, 99, 100)
quantile(Score, c(0.5, 0.6, 0.90))
##   50%   60%   90% 
##  93.5  98.4 100.0

Lets Calculate the IQR for Score and Hours

Score= c(90,87,100,45,100,98,95,92,88,67,85, 99,100, 55, 39, 78, 100, 99, 99, 100)
Study= c(2,4,6,30,2,20,10,4,10,12,44, 6,8, 4, 32, 30, 6, 8, 9, 10)
quartiles_score <- quantile(Score, probs=c(.25, .75), na.rm = FALSE)
quartiles_score
##   25%   75% 
## 83.25 99.25
quartiles_Study <- quantile(Study, probs=c(.25, .75), na.rm = FALSE)
quartiles_Study
##  25%  75% 
##  5.5 14.0
IQR(Score)
## [1] 16
IQR(Study)
## [1] 8.5
boxplot(Score)

boxplot(Study)