## 'data.frame': 10190 obs. of 17 variables:
## $ Distrito_edit : chr "1" "1" "1" "1" ...
## $ Year_edit_Fecha_del_derrame : int 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 ...
## $ Mes_edit_Fecha_del_derrame : int 6 3 4 4 6 6 3 9 10 6 ...
## $ Categoria_Instalaciones : chr "Instalacion fija" "Pozos" "Pozos" "Pozos" ...
## $ Operacion_general : chr "Produccion" "Otro" "Produccion" "Produccion" ...
## $ Categoria_Fuente : chr NA "Tanques/Almacenamiento" "Lineas/Tuberias" "Infraestructura Fija" ...
## $ Grupo_causas_probable : chr NA "Afectaciones externas" "Factores humanos" "Problemas tecnicos" ...
## $ Liberacion_petroleo_crudo_edicion : num 0 0 0 0 0 ...
## $ Edicion_recuperacion_petroleo_crudo : num NA 0 0 0 0 0 0 0 0 NA ...
## $ Volumen_liberado_Cond_Final : num 0 0 0 10 0 0 0 1 0 0 ...
## $ Liberacion_agua_de_produccion_edicion: num 6720 3780 5040 420 10920 ...
## $ Liberacion_volumen_gas : num 0 0 0 0 0 0 0 0 0 0 ...
## $ Volumen_condensado_recuperado : num NA 0 0 1 0 0 0 0 0 NA ...
## $ Edicion_Recuperacion_agua_producida : num NA 420 4620 0 10920 ...
## $ Derrame_sobre_agua_limpio : chr "NO" "NO" "NO" "NO" ...
## $ Estado_general : chr "Observaciones tecnicas" NA NA NA ...
## $ Codigo_area : int 1 1 1 1 1 1 1 1 1 3 ...
ni <- numeric(k_agua)
for (i in 1:k_agua) {
if (i == k_agua) {
ni[i] <- length(subset(Liberacion_agua_producida,
Liberacion_agua_producida >= liminf[i] & Liberacion_agua_producida <= limsup[i]))
} else {
ni[i] <- length(subset(Liberacion_agua_producida,
Liberacion_agua_producida >= liminf[i] & Liberacion_agua_producida < limsup[i]))
}
}
tabla_agua <- data.frame(
liminf = round(liminf, 2),
limsup = round(limsup, 2),
MC = round(MC, 2),
ni = ni,
hi_porc = round(hi, 2),
Ni_asc = Niasc,
Ni_dsc = Nidsc,
Hiasc_porc = round(Hiasc, 2),
Hidsc_porc = round(Hidsc, 2)
)
print("TABLA: Distribución de Frecuencias de Liberación de Agua Producida")
## [1] "TABLA: Distribución de Frecuencias de Liberación de Agua Producida"
## liminf limsup MC ni hi_porc Ni_asc Ni_dsc Hiasc_porc
## 1 0.42 270000.4 135000.4 10120 99.37 10120 10184 99.37
## 2 270000.39 540000.4 405000.4 46 0.45 10166 64 99.82
## 3 540000.36 810000.3 675000.3 9 0.09 10175 18 99.91
## 4 810000.33 1080000.3 945000.3 3 0.03 10178 9 99.94
## 5 1080000.30 1350000.3 1215000.3 1 0.01 10179 6 99.95
## 6 1350000.27 1620000.2 1485000.2 1 0.01 10180 5 99.96
## 7 1620000.24 1890000.2 1755000.2 1 0.01 10181 4 99.97
## 8 1890000.21 2160000.2 2025000.2 0 0.00 10181 3 99.97
## 9 2160000.18 2430000.1 2295000.2 0 0.00 10181 3 99.97
## 10 2430000.15 2700000.1 2565000.1 0 0.00 10181 3 99.97
## 11 2700000.12 2970000.1 2835000.1 0 0.00 10181 3 99.97
## 12 2970000.09 3240000.1 3105000.1 0 0.00 10181 3 99.97
## 13 3240000.06 3510000.0 3375000.0 2 0.02 10183 3 99.99
## 14 3510000.03 3780000.0 3645000.0 1 0.01 10184 1 100.00
## Hidsc_porc
## 1 100.00
## 2 0.63
## 3 0.18
## 4 0.09
## 5 0.06
## 6 0.05
## 7 0.04
## 8 0.03
## 9 0.03
## 10 0.03
## 11 0.03
## 12 0.03
## 13 0.03
## 14 0.01
hist(Liberacion_agua_producida,
main = "Gráfica No.1: Distribución de Liberación de Agua Producida",
breaks = seq(min(Liberacion_agua_producida),
max(Liberacion_agua_producida) + A_agua, by = A_agua),
xlab = "Liberación de agua producida",
ylab = "Frecuencia",
col = "lightblue",
xaxt = "n")
axis(1, at = pretty(liminf), labels = format(pretty(liminf), scientific = FALSE))
x_asc <- c(min(liminf), limsup)
y_asc <- c(0, Niasc)
x_desc <- c(liminf, max(limsup))
y_desc <- c(Nidsc, 0)
plot(x_asc, y_asc, type = "o", col = "dodgerblue",
main = "Gráfica No.2: Ojivas Ascendente y Descendente
de Liberación de Agua Producida",
xlab = "Liberación de agua",
ylab = "Frecuencia acumulada",
xlim = range(c(x_asc, x_desc)), ylim = c(0, max(c(y_asc, y_desc))),
xaxt = "n", yaxt = "n")
axis(1, at = pretty(x_asc), labels = format(pretty(x_asc), scientific = FALSE))
axis(2, at = pretty(y_asc), labels = format(pretty(y_asc), scientific = FALSE))
lines(x_desc, y_desc, type = "o", col = "steelblue4")
legend("topright", legend = c("Ascendente", "Descendente"),
col = c("dodgerblue", "steelblue4"), lty = 1, pch = 1, cex = 0.7,
inset = c(-0.0009, 0.2))
boxplot(Liberacion_agua_producida, horizontal = TRUE, col = "skyblue",
main = "Gráfica No.3: Boxplot: Liberación de Agua Producida",
xlab = "Liberación de agua producida",
xaxt = "n")
axis(1, at = pretty(Liberacion_agua_producida),
labels = format(pretty(Liberacion_agua_producida), scientific = FALSE))
get_mode <- function(v) {
v <- as.numeric(v)
uniqv <- unique(v)
uniqv[which.max(tabulate(match(v, uniqv)))]}
media <- mean(Liberacion_agua_producida)
mediana <- median(Liberacion_agua_producida)
moda <- get_mode(Liberacion_agua_producida)
desv <- sd(Liberacion_agua_producida)
varianza <- var(Liberacion_agua_producida)
cv <- (desv / media) * 100
library(e1071)
asim <- skewness(Liberacion_agua_producida)
curt <- kurtosis(Liberacion_agua_producida)
indicadores_agua <- data.frame(
Indicador = c("Moda", "Mediana", "Media", "Desviación Estándar",
"Varianza", "Coef. de Variación (%)", "Asimetría", "Curtosis"),
Valor = c(round(moda, 2), round(mediana, 2), round(media, 2), round(desv, 2),
round(varianza, 2), round(cv, 2), round(asim, 2), round(curt, 2))
)
indicadores_agua$Valor <- format(indicadores_agua$Valor, scientific = FALSE)
print(indicadores_agua, row.names = FALSE)
## Indicador Valor
## Moda 420.00
## Mediana 3360.00
## Media 15606.12
## Desviación Estándar 77321.51
## Varianza 5978615515.22
## Coef. de Variación (%) 495.46
## Asimetría 30.42
## Curtosis 1262.55