1 IDENTIFICACIÓN Y JUSTIFICACIÓN DE LA VARIABLE

\(Variable\) \(de\) \(Estudio\): Fecha de Inicio de la Perforación (Date Spudded)

  1. Muy antiguas (1864 – 1896): periodo con muy pocos registros.

  2. Antiguas (1896 – 1929): representación baja en el histórico.

  3. Medias (1929 – 1961): representación intermedia.

  4. Recientes (1961 – 1994): concentra la mayoría de los pozos.

  5. Muy recientes (1994 – 2026): segunda mayor representación, con perforaciones vigentes o recientes.

2 CARGA DE DATOS

##### UNIVERSIDAD CENTRAL DEL ECUADOR #####
#### AUTORES: DALLYANA LOZANO ####
### CARRERA: INGENIERÍA EN PETRÓLEOS #####
#### VARIABLE: FECHA DE INICIO DE PERFORACIÓN ####
suppressPackageStartupMessages({
  library(tidyverse)
  library(readxl)
  library(gt)
  library(dplyr)
  library(readr)
  library(lubridate) 
})

Datos <- read_delim("Dataset.csv", delim = ";", escape_double = FALSE, trim_ws = TRUE, show_col_types = FALSE)

3 EXTRAER VARIABLE

Extraemos la variable Date Spudded, omitimos las celdas en blanco y verificamos el tamaño muestral.

### EXTRAER VARIABLE
suppressPackageStartupMessages({
  library(lubridate)
  library(dplyr)
})

fechas_raw_spud <- Datos$`Date Spudded`
fechas_validas_spud <- fechas_raw_spud[!is.na(fechas_raw_spud) & fechas_raw_spud != ""]
Fechas_limpias_spud <- mdy(fechas_validas_spud)
Fechas_limpias_spud <- Fechas_limpias_spud[!is.na(Fechas_limpias_spud)]

Fecha_Spud <- cut(as.numeric(Fechas_limpias_spud),
                breaks = 5,
                labels = c("Muy antiguas",
                           "Antiguas",
                           "Medias",
                           "Recientes",
                           "Muy recientes"),
                ordered_result = TRUE)

conteo_spud <- table(Fecha_Spud)
ni_spud <- as.numeric(conteo_spud)
hi_spud <- (ni_spud / sum(ni_spud)) * 100

4 TABLAS DE DISTRIBUCIÓN DE FRECUENCIA

4.1 DISTRIBUCIÓN DE FRECUENCIAS DE LA FECHA DE SOLICITUD DE PERMISO

Se extrajo la variable de fecha de inicio de perforación (Date Spudded) para determinar su frecuencia absoluta (\(n_i\)) y el porcentaje relativo (\(hi\)) respecto al total, agrupando los registros en cinco rangos de igual amplitud: Muy antiguas, Antiguas, Medias, Recientes y Muy recientes.

df_spud_final <- data.frame(
  Tipo = names(conteo_spud),
  ni = as.character(ni_spud),
  hi = as.character(round(hi_spud, 2))
)

fila_total_spud <- data.frame(
  Tipo = "TOTAL",
  ni = as.character(sum(ni_spud)),
  hi = as.character(round(sum(hi_spud), 2))
)

df_show_spud_1 <- bind_rows(df_spud_final, fila_total_spud)

df_show_spud_1 %>%
  gt() %>%
  tab_header(
    title = md("**TABLA Nº 1: DISTRIBUCIÓN DE FRECUENCIAS DE FECHA DE INICIO DE PERFORACIÓN**")
  ) %>%
  cols_label(
    Tipo = "Fecha de Inicio de Perforación", 
    ni = "ni", 
    hi = "hi (%)"
  ) %>%
  cols_align(align = "center", columns = everything()) %>%
  tab_style(
    style = list(cell_fill(color = "#F2F3F4"), cell_text(weight = "bold", color = "#2E4053")),
    locations = cells_column_labels()
  ) %>%
  tab_style(
    style = list(cell_fill(color = "#D0ECE7"), cell_text(weight = "bold")),
    locations = cells_body(rows = Tipo == "TOTAL")
  ) %>%
  tab_options(
    table.width = pct(90),                    
    data_row.padding = px(12),                
    column_labels.padding = px(15),          
    table.border.top.style = "solid",
    table.border.top.color = "#2E4053",
    table.border.bottom.style = "solid",
    table.border.bottom.color = "#2E4053"
  )
TABLA Nº 1: DISTRIBUCIÓN DE FRECUENCIAS DE FECHA DE INICIO DE PERFORACIÓN
Fecha de Inicio de Perforación ni hi (%)
Muy antiguas 170 0.84
Antiguas 1151 5.71
Medias 2261 11.22
Recientes 11152 55.33
Muy recientes 5423 26.9
TOTAL 20157 100

4.2 ASIGNACIÓN JERÁRQUICA

Se incorporó una asignación jerárquica ordinal y se consolidó la información en un data frame estructurado para su presentación formal.

# FRECUENCIAS CALCULADAS DIRECTO DESDE Fecha_Spud
conteo_spud_j <- table(Fecha_Spud)
ni_spud_j <- as.numeric(conteo_spud_j)
hi_spud_j <- (ni_spud_j / sum(ni_spud_j)) * 100

df_spud_jerarquia <- data.frame(
  Asignacion = as.character(1:length(conteo_spud_j)),
  Tipo = names(conteo_spud_j),
  ni = as.character(ni_spud_j),
  hi = as.character(round(hi_spud_j, 2))
)

# FILA DE TOTALES
fila_total_spud_j <- data.frame(
  Asignacion = "TOTAL",
  Tipo = "",
  ni = as.character(sum(ni_spud_j)),
  hi = as.character(round(sum(hi_spud_j), 2))
)

df_show_spud_2 <- bind_rows(df_spud_jerarquia, fila_total_spud_j)

df_show_spud_2 %>%
  gt() %>%
  tab_header(
    title = md("**TABLA Nº 2: ASIGNACI\u00d3N JERÁRQUICA DE FECHA DE INICIO DE PERFORACI\u00d3N**")
  ) %>%
  cols_label(
    Asignacion = "Asignación", 
    Tipo = "Rango de Fechas", 
    ni = "ni", 
    hi = "hi (%)"
  ) %>%
  cols_align(align = "center", columns = everything()) %>%
  tab_style(
    style = list(cell_fill(color = "#F2F3F4"), cell_text(weight = "bold", color = "#2E4053")),
    locations = cells_column_labels()
  ) %>%
  tab_style(
    style = list(cell_fill(color = "#D0ECE7"), cell_text(weight = "bold")),
    locations = cells_body(rows = Asignacion == "TOTAL")
  ) %>%
  tab_options(
    table.width = pct(90),                    
    data_row.padding = px(12),                
    column_labels.padding = px(15),          
    table.border.top.style = "solid",
    table.border.top.color = "#2E4053",
    table.border.bottom.style = "solid",
    table.border.bottom.color = "#2E4053"
  )
TABLA Nº 2: ASIGNACIÓN JERÁRQUICA DE FECHA DE INICIO DE PERFORACIÓN
Asignación Rango de Fechas ni hi (%)
1 Muy antiguas 170 0.84
2 Antiguas 1151 5.71
3 Medias 2261 11.22
4 Recientes 11152 55.33
5 Muy recientes 5423 26.9
TOTAL 20157 100

5 REPRESENTACIÓN GRÁFICA

5.1 DIAGRAMA DE BARRAS - FRECUENCIA ABSOLUTA

par(mar = c(5, 4, 4, 2))
barplot(as.numeric(df_spud_final$ni),
        main = "GRÁFICO Nº 1: DISTRIBUCI\u00d3N DE FECHA DE INICIO DE PERFORACI\u00d3N",
        ylab = "Cantidad de Pozos",
        col = "#B0C4DE",      
        names.arg = df_spud_final$Tipo, 
        las = 1,            
        cex.names = 0.85,      
        cex.axis = 0.8,      
        cex.main = 1.1,        
        ylim = c(0, max(as.numeric(df_spud_final$ni), na.rm = TRUE) + max(as.numeric(df_spud_final$ni), na.rm = TRUE) * 0.1)) 
mtext("Rango de Fecha de Inicio de Perforación", side = 1, line = 3)

5.2 DIAGRAMA DE BARRAS - FRECUENCIA RELATIVA

par(mar = c(5, 4, 4, 2))

barplot(as.numeric(df_spud_jerarquia$hi),
        main = "GRÁFICO Nº 2: PORCENTAJE DE FECHA DE INICIO DE PERFORACI\u00d3N",
        ylab = "Porcentaje (%)",
        col = "#B0C4DE",      
        names.arg = df_spud_jerarquia$Asignacion, 
        las = 1,            
        cex.names = 1.0,      
        cex.axis = 0.8,      
        cex.main = 1.1,        
        ylim = c(0, max(as.numeric(df_spud_jerarquia$hi), na.rm = TRUE) + 10)) 

mtext("Asignación", side = 1, line = 3)

6 CONJETURA DEL MODELO

Se validó la fecha de inicio de perforación (Date Spudded) de los pozos mediante una Distribución Binomial \(B(4, p)\), ajustada a la variable ordinal de cinco categorías. La similitud entre las distribuciones observada y teórica permite evaluar si el comportamiento probabilístico es coherente, validando el análisis temporal del inicio de perforación.

n_total_Spud <- sum(as.numeric(df_spud_jerarquia$ni))
size_binom_spud <- 4   
X_indices_spud <- 0:4  
media_obs_spud <- sum(X_indices_spud * as.numeric(df_spud_jerarquia$ni)) / n_total_Spud
prob_p_spud <- media_obs_spud / size_binom_spud
P_Binomial_Spud <- dbinom(X_indices_spud, size = size_binom_spud, prob = prob_p_spud) * 100

par(mar = c(9, 4, 4, 2))
max_y_spud <- max(max(as.numeric(df_spud_jerarquia$hi)), max(P_Binomial_Spud))
barplot(rbind(as.numeric(df_spud_jerarquia$hi), P_Binomial_Spud), 
        beside = TRUE,
        main = "GRÁFICO Nº 3: Comparado de lo Observado frente a lo Esperado de Fecha de Inicio de Perforación",
        ylab = "Porcentaje (%)",
        names.arg = df_spud_jerarquia$Asignacion, 
        col = c("#B0C4DE", "#AED6F1"), 
        ylim = c(0, max_y_spud + 25), 
        las = 1, 
        cex.names = 0.9,
        cex.main = 0.85)
legend("topright", 
       legend = c("Realidad", "Modelo"), 
       fill = c("#B0C4DE", "#AED6F1"), 
       bty = "n", cex = 0.8)
mtext("Rango de Fecha de Inicio de Perforación", side = 1, line = 6)

7 TEST DE PEARSON

Fo_Sp <- as.numeric(df_spud_jerarquia$hi)
Fe_Sp <- P_Binomial_Spud 
test_correlacion_spud <- cor.test(Fo_Sp, Fe_Sp)
r_valor_spud <- round(test_correlacion_spud$estimate, 4)
par(mar = c(5, 5, 4, 2)) 
plot(Fo_Sp, Fe_Sp, 
     main = "GRÁFICO Nº 4: CORRELACIÓN DEL MODELO BINOMIAL - FECHA DE INICIO DE PERFORACIÓN",
     cex.main = 0.85,
     xlab = "Frecuencia Observada (%)", 
     ylab = "Frecuencia Esperada (%)", 
     pch = 19,            
     col = "#2E4053",    
     cex = 1.5)         
abline(lm(Fe_Sp ~ Fo_Sp), col = "red", lwd = 2)
text(x = min(Fo_Sp), y = max(Fe_Sp), 
     labels = paste("r =", r_valor_spud), 
     pos = 4, font = 2, col = "#2E4053")

Correlacion_Sp <- cor(Fo_Sp, Fe_Sp) * 100
Correlacion_Sp
## [1] 92.94851

8 TEST DE CHI-CUADRADO

x2_Sp <- sum(((Fo_Sp - Fe_Sp)^2) / Fe_Sp)
gl_Sp <- length(Fo_Sp) - 1
vc_Sp <- qchisq(0.99, gl_Sp)
cat("Estad\u00edstico Chi-cuadrado (Calculado):", round(x2_Sp, 4), "\n")
## Estadístico Chi-cuadrado (Calculado): 10.2651
cat("Valor Cr\u00edtico (Tabla):", round(vc_Sp, 4), "\n")
## Valor Crítico (Tabla): 13.2767
cat("¿Se acepta el modelo? (Calculado < Cr\u00edtico):", x2_Sp < vc_Sp, "\n")
## ¿Se acepta el modelo? (Calculado < Crítico): TRUE

9 TABLA RESUMEN DE BONDAD DEL AJUSTE

tabla_resumen_Sp <- data.frame(
  Variable = "Fecha de Inicio de Perforación",
  Pearson = round(Correlacion_Sp, 2),
  Chi2    = round(x2_Sp, 4),
  Umbral  = round(vc_Sp, 2),
  Resultado = ifelse(x2_Sp < vc_Sp, "Modelo Aceptado", "Modelo Rechazado")
)
tabla_resumen_Sp %>% 
  gt() %>% 
  tab_header(
    title = md("**TABLA Nº 3: RESUMEN DEL TEST DE BONDAD AL MODELO DE PROBABILIDAD**")
  ) %>%
  cols_label(
    Variable = "Variable",        
    Pearson  = "Test Pearson (%)",
    Chi2     = "Chi Cuadrado", 
    Umbral   = "Umbral de Aceptación",
    Resultado = "Resultado Final"
  ) %>%
  tab_source_note(
    source_note = "Autor: Dallyana Lozano"
  ) %>%
  cols_align(align = "center", columns = everything()) %>%
  tab_style(
    style = list(cell_fill(color = "#2E4053"), cell_text(color = "white", weight = "bold")),
    locations = cells_title()
  ) %>%
  tab_style(
    style = list(cell_fill(color = "#F2F3F4"), cell_text(weight = "bold", color = "#2E4053")),
    locations = cells_column_labels()
  ) %>%
  tab_options(
    table.width = pct(95),
    table.border.top.color = "#2E4053",
    table.border.bottom.color = "#2E4053",
    column_labels.border.bottom.color = "#2E4053",
    data_row.padding = px(10) 
  )
TABLA Nº 3: RESUMEN DEL TEST DE BONDAD AL MODELO DE PROBABILIDAD
Variable Test Pearson (%) Chi Cuadrado Umbral de Aceptación Resultado Final
Fecha de Inicio de Perforación 92.95 10.2651 13.28 Modelo Aceptado
Autor: Dallyana Lozano

10 CÁLCULO DE PROBABILIDADES

  1. ¿Cuál es la probabilidad de que la fecha de inicio de perforación de un pozo seleccionado al azar corresponda al rango “Muy recientes”? r
prob_alta_spud <- df_spud_final$hi[nrow(df_spud_final)]
prob_alta_spud
## [1] "26.9"

La probabilidad de que un pozo tenga su fecha de inicio de perforación en el rango Muy recientes (1994-2026) es de aproximadamente 26.87%.

  1. ¿Cuál es la probabilidad de que corresponda al rango “Muy antiguas”?
prob_baja_spud <- df_spud_final$hi[1]
prob_baja_spud
## [1] "0.84"

La probabilidad de encontrar pozos en el rango Muy antiguas (1864-1896) es de 0.84%.

11 CONCLUSIÓN

El modelo binomial muestra un ajuste aceptable. El inicio de perforación se concentra en Recientes 1961-1994 (55.3%), seguido de Muy recientes 1994-2026 (26.9%), Medias 1929-1961 (11.3%), Antiguas 1896-1929 (5.7%) y Muy antiguas 1864-1896 (apenas 0.8%).