Modelo de Probabilidad de la Dirección de los Pozos Petroleros en Brasil

1 Cargar datos

Se importa la base de datos de pozos petrolíferos de Brasil y se verifica la estructura de las variables para asegurar su correcta lectura.

setwd("C:/Users/majke/Downloads/Proyecto Estadistica/RMARKDOWN")
 Datos <- read.csv("Pozos brasil 2.csv", header = TRUE, sep = ";", dec = ",", fileEncoding = "Latin1")
str(Datos)
## 'data.frame':    29575 obs. of  59 variables:
##  $ POCO                      : chr  "7-RO-123HP-RJS" "1-BP-7-RJS" "7-ARGO-4H-ESS" "7-ARGO-5H-ESS" ...
##  $ CADASTRO                  : num  7.43e+10 7.43e+10 3.43e+10 3.43e+10 3.43e+10 ...
##  $ OPERADOR                  : chr  "Petrobras" "BP Energy" "Shell Brasil" "Shell Brasil" ...
##  $ POCO_OPERADOR             : chr  "7RO123HPRJS" "ANU" "7ARGO4HESS" "7ARGO5HESS" ...
##  $ ESTADO                    : chr  "RJ" "RJ" "ES" "ES" ...
##  $ BACIA                     : chr  "Campos" "Campos" "Campos" "Campos" ...
##  $ BLOCO                     : chr  "" "C-M-473" "" "" ...
##  $ SIG_CAMPO                 : chr  "RO   " "" "ARGO " "ARGO " ...
##  $ CAMPO                     : chr  "RONCADOR" "" "ARGONAUTA" "ARGONAUTA" ...
##  $ TERRA_MAR                 : chr  "M" "M" "M" "M" ...
##  $ POCO_POS_ANP              : chr  "S" "S" "S" "S" ...
##  $ TIPO                      : chr  "Explotatório" "Exploratório" "Explotatório" "Explotatório" ...
##  $ CATEGORIA                 : chr  "Desenvolvimento" "Pioneiro" "Desenvolvimento" "Desenvolvimento" ...
##  $ RECLASSIFICACAO           : chr  "PRODUTOR COMERCIAL DE PETRÓLEO" "PORTADOR DE PETRÓLEO" "ABANDONADO POR OUTRAS RAZÕES" "INDEFINIDO" ...
##  $ SITUACAO                  : chr  "PRODUTOR" "ABANDONADO POR LOGÍSTICA EXPLORATÓRIA" "ABANDONADO DEFINITIVAMENTE" "PRODUTOR" ...
##  $ INICIO                    : chr  "03/03/2012" "14/03/2012" "12/04/2012" "14/04/2012" ...
##  $ TERMINO                   : chr  "10/03/2013" "20/09/2012" "19/09/2012" "02/05/2013" ...
##  $ CONCLUSAO                 : chr  "10/03/2013" "19/10/2012" "28/09/2012" "13/05/2013" ...
##  $ TITULARIDADE              : chr  "Público" "Público" "Público" "Público" ...
##  $ LATITUDE_BASE_4C          : chr  "-21:57:45,630" "-23:06:09,622" "-21:08:06,801" "-21:08:12,535" ...
##  $ LONGITUDE_BASE_4C         : chr  "-39:44:01,130" "-40:00:41,295" "-39:46:53,226" "-39:46:49,296" ...
##  $ LATITUDE_BASE_DD          : num  -22 -23.1 -21.1 -21.1 -21.1 ...
##  $ LONGITUDE_BASE_DD         : num  -39.7 -40 -39.8 -39.8 -39.8 ...
##  $ DATUM_HORIZONTAL          : chr  "SIRGAS2000" "SIRGAS2000" "SIRGAS2000" "SIRGAS2000" ...
##  $ TIPO_DE_COORDENADA_DE_BASE: chr  "Definitiva" "Definitiva" "Definitiva" "Definitiva" ...
##  $ DIRECAO                   : chr  "Horizontal" "Vertical" "Horizontal" "Horizontal" ...
##  $ PROFUNDIDADE_VERTICAL_M   : num  -3145 6900 2937 2934 2953 ...
##  $ PROFUNDIDADE_SONDADOR_M   : num  4050 6925 3809 4575 4570 ...
##  $ PROFUNDIDADE_MEDIDA_M     : num  4050 6925 3809 4575 4570 ...
##  $ REFERENCIA_DE_PROFUNDIDADE: chr  "MR" "MR" "MR" "MR" ...
##  $ MESA_ROTATIVA             : num  24 25 24.2 24.2 24.2 ...
##  $ COTA_ALTIMETRICA_M        : num  0 0 0 0 0 ...
##  $ LAMINA_D_AGUA_M           : num  1827 2730 1706 1705 1654 ...
##  $ DATUM_VERTICAL            : chr  "NM" "NM" "NM" "NM" ...
##  $ UNIDADE_ESTRATIGRAFICA    : chr  "" "" "" "" ...
##  $ GEOLOGIA_GRUPO_FINAL      : chr  "Campos" "Lagoa Feia" "Campos" "Campos" ...
##  $ GEOLOGIA_FORMACAO_FINAL   : chr  "Carapebus" "Macabu" "Ubatuba" "Ubatuba" ...
##  $ GEOLOGIA_MEMBRO_FINAL     : chr  "" "" "" "" ...
##  $ CDPE                      : chr  "Existe" "Existe" "Existe" "" ...
##  $ AGP                       : chr  "" "" "" "" ...
##  $ PC                        : chr  "" "Existe" "" "" ...
##  $ PAG                       : chr  "" "" "" "" ...
##  $ PERFIS_CONVENCIONAIS      : chr  "" "Existe" "" "" ...
##  $ DURANTE_PERFURACAO        : chr  "Existe" "Existe" "Existe" "Existe" ...
##  $ PERFIS_DIGITAIS           : chr  "" "" "" "" ...
##  $ PERFIS_PROCESSADOS        : chr  "" "" "" "" ...
##  $ PERFIS_ESPECIAIS          : chr  "" "" "" "" ...
##  $ AMOSTRA_LATERAL           : chr  "" "Existe" "" "" ...
##  $ SISMICA                   : chr  "" "Existe" "" "" ...
##  $ TABELA_TEMPO_PROFUNDIDADE : chr  "" "" "" "" ...
##  $ DADOS_DIRECIONAIS         : chr  "Existe" "Existe" "Existe" "Existe" ...
##  $ TESTE_A_CABO              : chr  "Existe" "Existe" "" "" ...
##  $ TESTE_DE_FORMACAO         : chr  "" "" "" "" ...
##  $ CANHONEIO                 : chr  "" "" "" "" ...
##  $ TESTEMUNHO                : chr  "" "" "" "" ...
##  $ GEOQUIMICA                : chr  "" "" "" "" ...
##  $ SIG_SONDA                 : chr  "SS-49" "DS4" "NB2" "NB2" ...
##  $ NOM_SONDA                 : chr  "SEDCO 707" "Deep Ocean Clarion" "Bully 2" "Bully 2" ...
##  $ DHA_ATUALIZACAO           : chr  "28/1/18 5:00" "28/1/18 5:00" "28/1/18 5:00" "28/1/18 5:00" ...

2 Tabla de distribución de frecuencia

Se calcula la frecuencia absoluta de los pozos según su dirección de perforación.

Direccion <- Datos$DIRECAO
TDFDireccion <- as.data.frame(table(Direccion))
TDFDireccion
##    Direccion  Freq
## 1 Direcional  5560
## 2 Horizontal  1232
## 3   Vertical 22783
español <- c("Direccional", "Horizontal", "Vertical")
levels(TDFDireccion$Direccion) <- español
head(TDFDireccion$Direccion)
## [1] Direccional Horizontal  Vertical   
## Levels: Direccional Horizontal Vertical

3 Cálculo de frecuencias por titularidad

Se obtienen las frecuencias absolutas (ni) y relativas (hi) de los pozos petrolíferos según su dirección.

TDFDireccion$Freq <- as.numeric(as.character(TDFDireccion$Freq))
library(dplyr)
## 
## Adjuntando el paquete: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
TDFDireccion1 <- Datos$TDFDireccion
TDFDireccion1  <- TDFDireccion %>%
  group_by(Direccion) %>%
  
  summarise( 
    ni = sum(Freq),
    hi = round(sum(Freq) / sum(TDFDireccion$Freq)*100, 5))

TDFDireccion1 <- data.frame(TDFDireccion1)

Agregar Totales

TDFDireccion1 <- TDFDireccion1 [, c("Direccion", "ni", "hi")]
total_ni <- sum(TDFDireccion1$ni) 
total_hi <- sum(TDFDireccion1$hi)
TDFDireccion1.1 <- rbind(TDFDireccion1, data.frame( Direccion = "Total",
                                                          ni = total_ni,
                                                          hi = total_hi))
print(TDFDireccion1.1 )
##     Direccion    ni        hi
## 1 Direccional  5560  18.79966
## 2  Horizontal  1232   4.16568
## 3    Vertical 22783  77.03466
## 4       Total 29575 100.00000
library(gt)
gt(TDFDireccion1.1 ) %>%
  tab_header( 
    title = md("**DISTRIBUCIÓN DE FRECUENCIAS DE POZOS PETROLEROS DE BRASIL**"), 
    subtitle = "Dirección de los pozos petroleros") %>% 
     fmt_number(
    columns = hi,
    decimals = 2) %>%
 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.border.top.color = "#2E4053",
    table.border.bottom.color = "#2E4053",
    column_labels.border.bottom.color = "#2E4053",
    data_row.padding = px(6))
DISTRIBUCIÓN DE FRECUENCIAS DE POZOS PETROLEROS DE BRASIL
Dirección de los pozos petroleros
Direccion ni hi
Direccional 5560 18.80
Horizontal 1232 4.17
Vertical 22783 77.03
Total 29575 100.00

4 Gráficas

4.1 Histograma de frecuencia absoluta local

Muestra la cantidad de pozos según su dirección de perforación, excluyendo el total general.

TDFDireccion2 <- TDFDireccion1.1[TDFDireccion1.1$Direccion!= "Total", ]

barplot(TDFDireccion2$ni,
        main = "Grafica N.1: Distribucion en cantidad según la dirección de los pozos",
        xlab = "Dirección", ylab = "Cantidad",
        col = "#263238", names.arg = TDFDireccion2$Direccion,
        las = 1, cex.names = 1, cex.axis = 0.8, cex.main = 1)

4.2 Histograma de frecuencia relativa local

Presenta el porcentaje de pozos por dirección, permitiendo una interpretación probabilística.

TDFDireccion2 <- TDFDireccion1.1[TDFDireccion1.1$Direccion!= "Total", ]

barplot(TDFDireccion2$hi,
        main = "Grafica N.3: Distribucion en cantidad según la dirección de los pozos",
        xlab = "Dirección", ylab = "Porcentaje",
        col = "#263238", names.arg = TDFDireccion2$Direccion,
        las = 1, cex.names = 1, cex.axis = 1, cex.main = 1)

5 Modelo de probabilidad

Se construye un modelo empírico de probabilidad a partir de las frecuencias relativas de la dirección de los pozos.

P_Dirección <- TDFDireccion2$ni / sum(TDFDireccion2$ni)

par(mar = c(9, 4, 4, 2))
barplot(P_Dirección,
        main = "Gráfica N°3: Distribución de Probabilidad según la dirección de los pozo",
        xlab = "Dirección", ylab = "Probabilidad",
        col = "#2E4053", names.arg = TDFDireccion2$Direccion,
        las = 1, cex.names = 1, cex.axis = 0.9, cex.main = 1)

5.1 Probabilidad

¿Cuál es la probabilidad de que un pozo petrolero tenga dirección horizontal?

x <- round(
  (TDFDireccion2$ni[TDFDireccion2$Direccion == "Horizontal"] /
   sum(TDFDireccion2$ni)) * 100, 1)

print(paste("La probabilidad es de:", x, "%"))
## [1] "La probabilidad es de: 4.2 %"

La probabilidad obtenida indica que aproximadamente el 4.2% de los pozos petrolíferos en Brasil tienen dirección horizontal.

¿Cuántos pozos petroleros pueden tener dirección horizontal??.

p <- x / 100

n <- 1000

cantidad_esperada <- n * p
direccion_objetivo <- "Horizontal"

cat("Para n =", n, "pozos, cantidad esperada de la dirección de los pozos", direccion_objetivo, "=", round(cantidad_esperada, 2), "\n")
## Para n = 1000 pozos, cantidad esperada de la dirección de los pozos Horizontal = 42

Se espera que aproximadamente 42 pozos petroleros tengan dirección horizontal, por cada 1000 pozos considerados