3.1.19 mean, mode, and median

A concrete mix is designed to withstand 3000 pounds per square inch​ (psi) of pressure. The following data represent the strength of nine randomly selected casts​ (in psi). Compute the​ mean, median and mode strength of the concrete​ (in psi).

Recommended find manually in Excel
  • even number of data set - type 5
  • odd number of data set - type 1

First, we need to import the data from Excel. (For simplicity, this imports manually by hand, we can get the same result by importing dataset from Excel)

x <- c(3970, 4080, 3100, 3200, 2930, 3830, 4080, 4040, 3530)
x
## [1] 3970 4080 3100 3200 2930 3830 4080 4040 3530

We can sort the data

sort(x)
## [1] 2930 3100 3200 3530 3830 3970 4040 4080 4080

Compute the mean strength of the concrete.

mean(x)
## [1] 3640

Compute the median strength of the concrete.

median(x)
## [1] 3830
length(x)
## [1] 9

Since we have odd amount of data

summary(x, quantile.type = 1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    2930    3200    3830    3640    4040    4080

Compute the mode strength of the concrete.

table(x)
## x
## 2930 3100 3200 3530 3830 3970 4040 4080 
##    1    1    1    1    1    1    1    2

Hope that helps!