#SOAL 1 3.8

x <- c(127,125,131,124,129,121,142,151,160,125,
       124,123,120,119,128,133,137,124,142,123,
       121,136,140,137,125,124,128,129,130,122,
       118,131,125,133,141,125,140,131,129,126)
x
##  [1] 127 125 131 124 129 121 142 151 160 125 124 123 120 119 128 133 137 124 142
## [20] 123 121 136 140 137 125 124 128 129 130 122 118 131 125 133 141 125 140 131
## [39] 129 126
mean(x)
## [1] 129.975
sd(x)
## [1] 8.914084
hist(x, main="Electronic Component Failure Time", 
     xlab="Time (hour)", 
     ylab="Frequency",
     col = "skyblue",
     border = "white",
     breaks = "Sturges")

stem(x)
## 
##   The decimal point is 1 digit(s) to the right of the |
## 
##   11 | 89
##   12 | 0112334444
##   12 | 555556788999
##   13 | 011133
##   13 | 677
##   14 | 00122
##   14 | 
##   15 | 1
##   15 | 
##   16 | 0
median(x)
## [1] 128
quantile(x, c(0.25, 0.5, 0.75))
##    25%    50%    75% 
## 124.00 128.00 133.75

#SOAL 2 3.10

visc <- c(13.3,14.5,15.3,15.3,14.3,14.8,15.2,14.5,14.6,14.1,14.3,16.1,13.1,15.5,12.6,14.6,14.3,15.4,15.2,16.8,14.9,13.7,15.2,14.5,15.3,15.6,15.8,13.3,14.1,15.4,15.2,15.2,15.9,16.5,14.8,15.1,17.0,14.9,14.8,14.0,15.8,13.7,15.1,13.4,14.1,14.8,14.3,14.3,16.4,16.9,14.2,16.9,14.9,15.2,14.4,15.2,14.6,16.4,14.2,15.7,16.0,14.9,13.6,15.3,14.3,15.6,16.1,13.9,15.2,14.4,14.0,14.4,13.7,13.8,15.6,14.5,12.8,16.1,16.6,15.6)
visc
##  [1] 13.3 14.5 15.3 15.3 14.3 14.8 15.2 14.5 14.6 14.1 14.3 16.1 13.1 15.5 12.6
## [16] 14.6 14.3 15.4 15.2 16.8 14.9 13.7 15.2 14.5 15.3 15.6 15.8 13.3 14.1 15.4
## [31] 15.2 15.2 15.9 16.5 14.8 15.1 17.0 14.9 14.8 14.0 15.8 13.7 15.1 13.4 14.1
## [46] 14.8 14.3 14.3 16.4 16.9 14.2 16.9 14.9 15.2 14.4 15.2 14.6 16.4 14.2 15.7
## [61] 16.0 14.9 13.6 15.3 14.3 15.6 16.1 13.9 15.2 14.4 14.0 14.4 13.7 13.8 15.6
## [76] 14.5 12.8 16.1 16.6 15.6
length(visc)
## [1] 80
stem(visc)
## 
##   The decimal point is at the |
## 
##   12 | 68
##   13 | 1334
##   13 | 677789
##   14 | 0011122333333444
##   14 | 555566688889999
##   15 | 1122222222333344
##   15 | 566667889
##   16 | 011144
##   16 | 56899
##   17 | 0
table(cut(visc, breaks = seq(12.5, 17.5, by = 0.5)))
## 
## (12.5,13] (13,13.5] (13.5,14] (14,14.5] (14.5,15] (15,15.5] (15.5,16] (16,16.5] 
##         2         4         8        18        11        17         9         6 
## (16.5,17] (17,17.5] 
##         5         0
hist(visc,
     breaks = seq(12.5, 17.5, by = 0.5),
     col = "skyblue",
     border = "white",
     main = "Viscosity Data Histogram",
     xlab = "Viscosity",
     ylab = "Frequncy")

stem(visc)
## 
##   The decimal point is at the |
## 
##   12 | 68
##   13 | 1334
##   13 | 677789
##   14 | 0011122333333444
##   14 | 555566688889999
##   15 | 1122222222333344
##   15 | 566667889
##   16 | 011144
##   16 | 56899
##   17 | 0
sort(visc)
##  [1] 12.6 12.8 13.1 13.3 13.3 13.4 13.6 13.7 13.7 13.7 13.8 13.9 14.0 14.0 14.1
## [16] 14.1 14.1 14.2 14.2 14.3 14.3 14.3 14.3 14.3 14.3 14.4 14.4 14.4 14.5 14.5
## [31] 14.5 14.5 14.6 14.6 14.6 14.8 14.8 14.8 14.8 14.9 14.9 14.9 14.9 15.1 15.1
## [46] 15.2 15.2 15.2 15.2 15.2 15.2 15.2 15.2 15.3 15.3 15.3 15.3 15.4 15.4 15.5
## [61] 15.6 15.6 15.6 15.6 15.7 15.8 15.8 15.9 16.0 16.1 16.1 16.1 16.4 16.4 16.5
## [76] 16.6 16.8 16.9 16.9 17.0
median(visc)
## [1] 14.9
quantile(visc, c(0.25, 0.75))
##    25%    75% 
## 14.300 15.525
quantile(visc, c(0.10, 0.90))
##   10%   90% 
## 13.70 16.13