X:duración de las máquinas (años).Ejercicio 1.19 de Walpole/Myers/Myers/Ye. Probability and statistics for engineers.

library(moments)
datos <- c(2, 3, 0.3, 3.3, 1.3, 0.4, 0.2, 6, 5.5, 6.5, 0.2, 2.3, 1.5, 4, 5.9, 
    1.8, 4.7, 0.7, 4.5, 0.3, 1.5, 0.5, 2.5, 5, 1, 6, 5.6, 6, 1.2, 0.2)
length(datos)
## [1] 30
min(datos)
## [1] 0.2
max(datos)
## [1] 6.5
range(datos)
## [1] 0.2 6.5
mean(datos)
## [1] 2.797
mean(datos, trim = 0.1)
## [1] 2.7
median(datos)
## [1] 2.15
summary(datos)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.200   0.775   2.150   2.800   4.920   6.500
IQR(datos)
## [1] 4.15
sd(datos)
## [1] 2.227
var(datos)
## [1] 4.961
quantile(datos, probs = seq(0, 1, 0.1))
##   0%  10%  20%  30%  40%  50%  60%  70%  80%  90% 100% 
## 0.20 0.29 0.48 1.14 1.50 2.15 3.12 4.56 5.52 6.00 6.50
skewness(datos)
## [1] 0.3412
kurtosis(datos)
## [1] 1.569
ta <- table(cut(datos, c(0.1, 1, 2, 3, 4, 5, 6, 6.5)))
ta
## 
## (0.1,1]   (1,2]   (2,3]   (3,4]   (4,5]   (5,6] (6,6.5] 
##       9       6       3       2       3       6       1
boxplot(datos, col = "yellow", main = "Diagrama de caja", horizontal = TRUE, 
    sub = "Duración años", outl = TRUE)

plot of chunk unnamed-chunk-2

stem(datos)
## 
##   The decimal point is at the |
## 
##   0 | 22233457
##   1 | 023558
##   2 | 035
##   3 | 03
##   4 | 057
##   5 | 0569
##   6 | 0005
hist(datos, col = "purple", breaks = c(0.1, 1, 2, 3, 4, 5, 6, 6.5), main = "Distribución de la duración de las máquinas", 
    xlab = "Duración", ylab = "Frecuencia")

plot of chunk unnamed-chunk-2

date()
## [1] "Thu Aug 15 21:24:31 2013"