Primero hay que determinar cuál de las tres propuestas (ÁrbolC, Red_N, Regresión) tiene una media significativamente menor que el modelo actual (SActual), usando pruebas de hipótesis. Considerando un nivel de significancia de α=0.05.
arbol <-c(23.81, 22.13, 22.64, 21.69, 23.58, 22.14, 18.73, 21.59,
20.36, 20.53, 20.11, 20.34, 19.19, 22.92, 18.65, 20.6,
19.83, 20.09, 19.43, 22.06, 21.15, 19.26, 18.08, 20.24,
18.75, 20.69, 21.62, 23.69, 23.93, 23.19)
redn <-c(23.24, 20.08, 18.01, 23.28, 19.23, 21.22, 21.47, 20.6,
21.11, 21.27, 21.03, 17.34, 22.8, 21.85, 17.85, 23.15,
19.57, 19.56, 20.79, 18.04, 20.95, 21.83, 18.17, 22.66,
18.29, 18.89, 19.49, 19.19, 26.47, 25.25)
regresion <-c(16.13, 17.84, 18.28, 15.61, 17.62, 16.12, 17.29, 16.13,
16.64, 15.03, 18.16, 16.82, 17.44, 16.76, 17.26, 15.55,
17.49, 18.42, 17.54, 17.13, 15.5, 16.8, 18.47, 18.42,
18.43, 15.56, 16.03, 15.39, 15.12, 17.77)
actual <-c(17.09, 15.77, 18.45, 16.55, 22.23, 22.11, 18.26, 18.04,
19.66, 19.76, 18.74, 19.02, 18.54, 16.7, 17.57, 19.89,
19.06, 18.7, 19.39, 19.68, 19.2, 16.85, 19.91, 19.82, 18.08,
19.38, 20.3, 21.6, 23.39, 19.33)
data2 <- data.frame(ÁrbolC =arbol, Red_N = redn, Regresion = regresion, SActual = actual)
#ArbolC vs Actual
t.test(arbol, actual, alternative = "less", var.equal = FALSE)
##
## Welch Two Sample t-test
##
## data: arbol and actual
## t = 4.3555, df = 57.989, p-value = 1
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf 2.673004
## sample estimates:
## mean of x mean of y
## 21.03400 19.10233
#Red_N vs Actual
t.test(redn, actual, alternative = "less", var.equal = FALSE)
##
## Welch Two Sample t-test
##
## data: redn and actual
## t = 3.2145, df = 54.681, p-value = 0.9989
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf 2.514425
## sample estimates:
## mean of x mean of y
## 20.75600 19.10233
#Regresion vs Actual
t.test(regresion, actual, alternative = "less", var.equal = FALSE)
##
## Welch Two Sample t-test
##
## data: regresion and actual
## t = -5.902, df = 49.248, p-value = 1.63e-07
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf -1.58275
## sample estimates:
## mean of x mean of y
## 16.89167 19.10233
library(ggplot2)
modelo <- c(rep("ÁrbolC", 30), rep("Red_N", 30), rep("Regresión", 30), rep("SActual", 30))
tiempo <- c(arbol, redn, regresion, actual)
datos <- data.frame(Modelo = modelo, Tiempo = tiempo)
ggplot(datos, aes(x = Modelo, y = Tiempo, fill = Modelo)) +
geom_boxplot() +
labs(title = "Comparación de Tiempos de Falla por Modelo",
y = "Tiempo de falla (minutos)",
x = "Modelo de mantenimiento") +
theme_minimal() +
theme(legend.position = "none")
library(dplyr)
resumen <- datos %>%
group_by(Modelo) %>%
summarise(Media = mean(Tiempo), SD = sd(Tiempo))
# Gráfico de barras
ggplot(resumen, aes(x = Modelo, y = Media, fill = Modelo)) +
geom_bar(stat = "identity", width = 0.6) +
geom_errorbar(aes(ymin = Media - SD, ymax = Media + SD), width = 0.2) +
labs(title = "Media y Desviación Estándar del Tiempo de Falla",
y = "Media (±SD)",
x = "Modelo") +
theme_minimal() +
theme(legend.position = "none")