Profundidad del pozo
Variable Cuantitativa Continua
Cargamos las librería
library(PASWR)
## Loading required package: lattice
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(readr)
library(e1071)
Carga los datos (Conjunto de datos)
setwd("/cloud/project")
read_csv("P_oil-gas-other-regulated-wells-beginning-1860.csv")
## Rows: 42045 Columns: 52
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (19): Well Name, Company Name, Well Type, Map Symbol, Well Status, Conf...
## dbl (22): API Well Number, County Code, API Hole Number, Sidetrack, Complet...
## lgl (1): Financial Security
## dttm (10): Status Date, Permit Application Date, Permit Issued Date, Date Sp...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## # A tibble: 42,045 × 52
## `API Well Number` `County Code` `API Hole Number` Sidetrack Completion
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 3.10e13 1 1072 0 0
## 2 3.10e13 1 1073 0 0
## 3 3.10e13 1 21007 0 0
## 4 3.10e13 1 21008 0 0
## 5 3.10e13 1 21009 0 0
## 6 3.10e13 1 21010 0 0
## 7 3.10e13 1 21011 0 0
## 8 3.10e13 1 21014 0 0
## 9 3.10e13 1 21015 0 0
## 10 3.10e13 1 21016 0 0
## # ℹ 42,035 more rows
## # ℹ 47 more variables: `Well Name` <chr>, `Company Name` <chr>,
## # `Operator Number` <dbl>, `Well Type` <chr>, `Map Symbol` <chr>,
## # `Well Status` <chr>, `Status Date` <dttm>,
## # `Permit Application Date` <dttm>, `Permit Issued Date` <dttm>,
## # `Date Spudded` <dttm>, `Date of Total Depth` <dttm>,
## # `Date Well Completed` <dttm>, `Date Well Plugged` <dttm>, …
datos2<- read.csv("point_oil-gas-other-regulated-wells-beginning-1860.csv", header = T, sep = ",", dec = ".",na.strings = "-")
EXTRAER LA VARIABLE CONTINUA
# 1) PROFUNDIDAD DEL POZO
Profundidad_Perforacion<-datos2$Drilled.Depth.ft
Profundidad_Perforacion<-na.omit(Profundidad_Perforacion)
PROCEDIMIENTO MANUAL
# MÍNIMO Y MÁXIMO
min(Profundidad_Perforacion)
## [1] 0
max(Profundidad_Perforacion)
## [1] 15795
# RANGO (diferencia maximo y minimo)
R<-max(Profundidad_Perforacion)-min(Profundidad_Perforacion)
R
## [1] 15795
# CALCULAR EL NUMERO DE INTERVALOS
k<-sqrt(length(Profundidad_Perforacion))
k
## [1] 205.0341
#REGAL DE STURGES
k<-1+(3.3*log10(length(Profundidad_Perforacion)))
k<-floor(k)
k
## [1] 16
#AMPLITUD
A<-R/k
A
## [1] 987.1875
# LIMITES
LimiteInf<-seq(from=min(Profundidad_Perforacion),to=max(Profundidad_Perforacion)-A,by=A)
LimiteInf
## [1] 0.0000 987.1875 1974.3750 2961.5625 3948.7500 4935.9375
## [7] 5923.1250 6910.3125 7897.5000 8884.6875 9871.8750 10859.0625
## [13] 11846.2500 12833.4375 13820.6250 14807.8125
LimiteSup<-seq(from=min(Profundidad_Perforacion)+A,to=max(Profundidad_Perforacion),by=A)
LimiteSup
## [1] 987.1875 1974.3750 2961.5625 3948.7500 4935.9375 5923.1250
## [7] 6910.3125 7897.5000 8884.6875 9871.8750 10859.0625 11846.2500
## [13] 12833.4375 13820.6250 14807.8125 15795.0000
#MC
MC<-(LimiteInf+LimiteSup)/2
MC
## [1] 493.5938 1480.7812 2467.9688 3455.1562 4442.3438 5429.5312
## [7] 6416.7188 7403.9062 8391.0938 9378.2812 10365.4688 11352.6562
## [13] 12339.8438 13327.0312 14314.2188 15301.4062
n<-c()
for (i in 1:k) {
if(i==16)
n[i]<-length(subset(Profundidad_Perforacion,Profundidad_Perforacion>=LimiteInf[i] & Profundidad_Perforacion<= LimiteSup[i]))
else
n[i]<-length(subset(Profundidad_Perforacion,Profundidad_Perforacion>=LimiteInf[i] & Profundidad_Perforacion< LimiteSup[i]))
}
TABLA DE FRECUENCIA
hi<-(n/length(Profundidad_Perforacion))*100
sum(hi)
## [1] 100
Ni_asc<-cumsum(n)
Ni_asc
## [1] 13983 30752 35535 38810 41406 41727 41838 41916 41948 41983 42015 42033
## [13] 42036 42037 42038 42039
Hi_asc<- cumsum(hi)
Hi_asc
## [1] 33.26197 73.15112 84.52865 92.31904 98.49426 99.25783 99.52187
## [8] 99.70741 99.78353 99.86679 99.94291 99.98573 99.99286 99.99524
## [15] 99.99762 100.00000
Ni_dsc<- rev(cumsum(rev(n)))
Ni_dsc
## [1] 42039 28056 11287 6504 3229 633 312 201 123 91 56 24
## [13] 6 3 2 1
Hi_dsc<- rev(cumsum(rev(hi)))
Hi_dsc
## [1] 1.000000e+02 6.673803e+01 2.684888e+01 1.547135e+01 7.680963e+00
## [6] 1.505745e+00 7.421680e-01 4.781275e-01 2.925855e-01 2.164657e-01
## [11] 1.332096e-01 5.708985e-02 1.427246e-02 7.136231e-03 4.757487e-03
## [16] 2.378744e-03
TablaProfunidad <- data.frame(LimiteInf,LimiteSup,MC,n,round(hi,2),Ni_asc,round(Hi_asc,2),
Ni_dsc,round(Hi_dsc,2) )
colnames(TablaProfunidad)<- c("LimiteInf","LimiteSup","MC","ni","hi (%)","Ni_asc","Hi_asc(%)","Ni_dsc","Hi_dsc(%)")
library(knitr)
kable(TablaProfunidad, format = "markdown", caption = "Tabla 6.1:Tabla de frecuencias de la profundidad(ft) del pozo")
| LimiteInf | LimiteSup | MC | ni | hi (%) | Ni_asc | Hi_asc(%) | Ni_dsc | Hi_dsc(%) |
|---|---|---|---|---|---|---|---|---|
| 0.0000 | 987.1875 | 493.5938 | 13983 | 33.26 | 13983 | 33.26 | 42039 | 100.00 |
| 987.1875 | 1974.3750 | 1480.7812 | 16769 | 39.89 | 30752 | 73.15 | 28056 | 66.74 |
| 1974.3750 | 2961.5625 | 2467.9688 | 4783 | 11.38 | 35535 | 84.53 | 11287 | 26.85 |
| 2961.5625 | 3948.7500 | 3455.1562 | 3275 | 7.79 | 38810 | 92.32 | 6504 | 15.47 |
| 3948.7500 | 4935.9375 | 4442.3438 | 2596 | 6.18 | 41406 | 98.49 | 3229 | 7.68 |
| 4935.9375 | 5923.1250 | 5429.5312 | 321 | 0.76 | 41727 | 99.26 | 633 | 1.51 |
| 5923.1250 | 6910.3125 | 6416.7188 | 111 | 0.26 | 41838 | 99.52 | 312 | 0.74 |
| 6910.3125 | 7897.5000 | 7403.9062 | 78 | 0.19 | 41916 | 99.71 | 201 | 0.48 |
| 7897.5000 | 8884.6875 | 8391.0938 | 32 | 0.08 | 41948 | 99.78 | 123 | 0.29 |
| 8884.6875 | 9871.8750 | 9378.2812 | 35 | 0.08 | 41983 | 99.87 | 91 | 0.22 |
| 9871.8750 | 10859.0625 | 10365.4688 | 32 | 0.08 | 42015 | 99.94 | 56 | 0.13 |
| 10859.0625 | 11846.2500 | 11352.6562 | 18 | 0.04 | 42033 | 99.99 | 24 | 0.06 |
| 11846.2500 | 12833.4375 | 12339.8438 | 3 | 0.01 | 42036 | 99.99 | 6 | 0.01 |
| 12833.4375 | 13820.6250 | 13327.0312 | 1 | 0.00 | 42037 | 100.00 | 3 | 0.01 |
| 13820.6250 | 14807.8125 | 14314.2188 | 1 | 0.00 | 42038 | 100.00 | 2 | 0.00 |
| 14807.8125 | 15795.0000 | 15301.4062 | 1 | 0.00 | 42039 | 100.00 | 1 | 0.00 |
GRÁFICAS
#Gráfica No:6.1
#DIAGRAMA DE BARRAS LOCAL POR STURGES
histoSturges<-hist(Profundidad_Perforacion, main="Gráfica No. 6.1:Distribución de la cantidad de la profundidad \nde cada uno de los pozos de hidrocarburos en el estado de Nueva York",xlab = "Profundidad (ft)", ylab = "Cantidad",
col="blue",breaks = seq(min(Profundidad_Perforacion),max(Profundidad_Perforacion),A))
histoSturges$counts
## [1] 13983 16769 4783 3275 2596 321 111 78 32 35 32 18
## [13] 3 1 1 1
#Gráfica No:
#DIAGRAMA DE BARRAS GLOBAL POR STURGES
histogramaCO2<-hist(Profundidad_Perforacion, main="Gráfica No. 6.2:Distribución de la cantidad de la profundidad \nde cada uno de los pozos de hidrocarburos en el estado de Nueva York",xlab = "Profundidad (ft)", ylab = "Cantidad",
col="blue",breaks = seq(min(Profundidad_Perforacion),max(Profundidad_Perforacion),A),ylim = c(0,length(Profundidad_Perforacion)))
Para una mejor análisis de la variable, utilizaremos los intervalos que nos proporciona R.
# DETERMINACIÓN DE INTERVALOS CON R
histograma_Prof<-hist(Profundidad_Perforacion,main= "Grafica No. 6.3:Distribución de la cantidad de la profundidad \nde cada uno de los pozos de hidrocarburos en el estado de Nueva York",xlab= "Profundidad (ft)", ylab= "Cantidad", col="salmon", las=2)
TABLA DE FRECUENCIAS
# CREAR LOS LIMITES
LimiteSup<-histograma_Prof$breaks
LimiteSup
## [1] 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000
## [13] 12000 13000 14000 15000 16000
LimiteInf<-LimiteSup[1:16]
LimiteInf
## [1] 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000
## [13] 12000 13000 14000 15000
LimiteSup<-LimiteSup[2:17]
LimiteSup
## [1] 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000
## [13] 13000 14000 15000 16000
# MARCA DE CLASE
MC<-histograma_Prof$mids
MC
## [1] 500 1500 2500 3500 4500 5500 6500 7500 8500 9500 10500 11500
## [13] 12500 13500 14500 15500
ni<-histograma_Prof$counts
ni
## [1] 14380 16730 4541 3370 2462 257 98 84 30 38 28 16
## [13] 2 1 1 1
sum(ni)
## [1] 42039
hi<-ni/sum(ni)*100
hi
## [1] 34.206332215 39.796379552 10.801874450 8.016365756 5.856466614
## [6] 0.611337092 0.233116868 0.199814458 0.071362306 0.090392255
## [11] 0.066604819 0.038059897 0.004757487 0.002378744 0.002378744
## [16] 0.002378744
sum(hi)
## [1] 100
Ni_asc<-cumsum(ni)
Ni_asc
## [1] 14380 31110 35651 39021 41483 41740 41838 41922 41952 41990 42018 42034
## [13] 42036 42037 42038 42039
Hi_asc<- cumsum(hi)
Hi_asc
## [1] 34.20633 74.00271 84.80459 92.82095 98.67742 99.28876 99.52187
## [8] 99.72169 99.79305 99.88344 99.95005 99.98811 99.99286 99.99524
## [15] 99.99762 100.00000
Ni_dsc<- rev(cumsum(rev(ni)))
Ni_dsc
## [1] 42039 27659 10929 6388 3018 556 299 201 117 87 49 21
## [13] 5 3 2 1
Hi_dsc<- rev(cumsum(rev(hi)))
Hi_dsc
## [1] 1.000000e+02 6.579367e+01 2.599729e+01 1.519541e+01 7.179048e+00
## [6] 1.322581e+00 7.112443e-01 4.781275e-01 2.783130e-01 2.069507e-01
## [11] 1.165584e-01 4.995361e-02 1.189372e-02 7.136231e-03 4.757487e-03
## [16] 2.378744e-03
TablaProfundidad <- data.frame(LimiteInf,LimiteSup,MC,ni,round(hi,2),Ni_asc,round(Hi_asc,2),
Ni_dsc,round(Hi_dsc,2))
colnames(TablaProfundidad)<- c("LimiteInf","LimiteSup","MC","ni","hi (%)","Ni_asc","Hi_asc(%)","Ni_dsc","Hi_dsc(%)")
library(knitr)
kable(TablaProfundidad, format = "markdown", caption = "Tabla 6.2:Tabla de frecuencias agrupadas de la profundidad(ft) de los pozos")
| LimiteInf | LimiteSup | MC | ni | hi (%) | Ni_asc | Hi_asc(%) | Ni_dsc | Hi_dsc(%) |
|---|---|---|---|---|---|---|---|---|
| 0 | 1000 | 500 | 14380 | 34.21 | 14380 | 34.21 | 42039 | 100.00 |
| 1000 | 2000 | 1500 | 16730 | 39.80 | 31110 | 74.00 | 27659 | 65.79 |
| 2000 | 3000 | 2500 | 4541 | 10.80 | 35651 | 84.80 | 10929 | 26.00 |
| 3000 | 4000 | 3500 | 3370 | 8.02 | 39021 | 92.82 | 6388 | 15.20 |
| 4000 | 5000 | 4500 | 2462 | 5.86 | 41483 | 98.68 | 3018 | 7.18 |
| 5000 | 6000 | 5500 | 257 | 0.61 | 41740 | 99.29 | 556 | 1.32 |
| 6000 | 7000 | 6500 | 98 | 0.23 | 41838 | 99.52 | 299 | 0.71 |
| 7000 | 8000 | 7500 | 84 | 0.20 | 41922 | 99.72 | 201 | 0.48 |
| 8000 | 9000 | 8500 | 30 | 0.07 | 41952 | 99.79 | 117 | 0.28 |
| 9000 | 10000 | 9500 | 38 | 0.09 | 41990 | 99.88 | 87 | 0.21 |
| 10000 | 11000 | 10500 | 28 | 0.07 | 42018 | 99.95 | 49 | 0.12 |
| 11000 | 12000 | 11500 | 16 | 0.04 | 42034 | 99.99 | 21 | 0.05 |
| 12000 | 13000 | 12500 | 2 | 0.00 | 42036 | 99.99 | 5 | 0.01 |
| 13000 | 14000 | 13500 | 1 | 0.00 | 42037 | 100.00 | 3 | 0.01 |
| 14000 | 15000 | 14500 | 1 | 0.00 | 42038 | 100.00 | 2 | 0.00 |
| 15000 | 16000 | 15500 | 1 | 0.00 | 42039 | 100.00 | 1 | 0.00 |
GRÁFICAS
#Gráfico No.
# DIAGRAMA DE BARRAS LOCAL
histograma_Prof<-hist(Profundidad_Perforacion,main= "Grafica No. 6.4:Distribución de la cantidad de la profundidad \nde cada uno de los pozos de hidrocarburos en el estado de Nueva York",xlab= "Profundidad (ft)", ylab= "Cantidad", col="salmon", las=2)
#Gráfico No.
# DIAGRAMA DE BARRAS GLOBAL
histograma_Prof<-hist(Profundidad_Perforacion,main= "Grafica No. 6.5:Distribución de la cantidad de la profundidad \nde cada uno de los pozos de hidrocarburos en el estado de Nueva York",xlab= "Profundidad (ft)", ylab= "Cantidad", col="salmon", las=2,ylim = c(0,length(Profundidad_Perforacion)))
#Gráfico No.
# DIAGRMA DE BARRAS PORCENTAJE
barplot(hi,space = 0,main="Gráfica No. 6.6:Distribución del porcentaje de la profundidad \nde cada uno de los pozos de hidrocarburos en el estado de Nueva York",col="salmon",xlab = "Profundidad (ft)",ylab = "Porcentaje(%)", ylim = c(0,100), names.arg =TablaProfundidad$MC, las=2)
#Gráfico No.
# DIAGRMA DE CAJA Y BIGOTE
Caja<-boxplot(Profundidad_Perforacion,horizontal = T, col = "Salmon",main="Gráfica No. 6.7:Distribución de la cantidad de la profundidad \nde cada uno de los pozos de hidrocarburos en el estado de Nueva York",xlab="Profundidad (ft)")
# OJIVAS
#Gráfico No. OJIVAS COMBINADAS DE LA FRECUENCIA
plot(LimiteInf,Ni_dsc,main = "Grafica No. 6.8: Ojivas combinadas de la profundidad de cada
uno de los pozos de hidrocarburos en el
estado de Nueva York",xlab = "Profundidad (ft)", ylab="Cantidad", col="black",type = "b")
lines(LimiteSup,Ni_asc,col="blue",type = "b")
legend("right",legend = c("Ojiva descendente", "Ojiva ascendente"),col = c("black", "blue"), pch = 1, lty = 1,cex = 0.7)
#OJIVAS
#Gráfico No. OJIVAS COMBINADAS DE LA FRECUENCIA PORCENTUAL
plot(LimiteInf,Hi_dsc,main = "Grafica No. 6.9: Ojivas combinadas de la profundidad de cada
uno de los pozos de hidrocarburos en el
estado de Nueva York",xlab = "Profundidad (ft)", ylab="Cantidad (%)", col="black",type = "b")
lines(LimiteSup,Hi_asc,col="blue",type = "b")
legend("right",legend = c("Ojiva descendente", "Ojiva ascendente"),col = c("black", "blue"), pch = 1, lty = 1,cex = 0.7)
INDICADORES
ri<-min(Profundidad_Perforacion)
rs<-max(Profundidad_Perforacion)
mediana<-median(Profundidad_Perforacion)
mediana
## [1] 1330
media_aritmetica<-mean(Profundidad_Perforacion)
media_aritmetica
## [1] 1543.42
Mo<-c("[1k,2k]")
desviación_estandar<-sd(Profundidad_Perforacion)
desviación_estandar
## [1] 1404.844
coeficiente_variabilidad <- (desviación_estandar/media_aritmetica) * 100
coeficiente_variabilidad
## [1] 91.0215
As<-skewness(Profundidad_Perforacion)
As
## [1] 1.426119
curtosis<-kurtosis(Profundidad_Perforacion)
curtosis
## [1] 4.176485
#Valores atípicos
outliers<-boxplot.stats(Profundidad_Perforacion)$out
# Contar los valores atípicos
num_outliers <- length(outliers)
num_outliers
## [1] 1524
minimooutliers<-min(outliers)
minimooutliers
## [1] 4397
maximooutliers<-max(outliers)
maximooutliers
## [1] 15795
#Tabla de valores atípicos
Variable<-c("Profundidad del pozo (ft)")
Tabla_indicadores<-data.frame(Variable,ri,rs,round(media_aritmetica,2),mediana,Mo,round(desviación_estandar,2),
round(coeficiente_variabilidad,2), round(As,2),round(curtosis,2))
colnames(Tabla_indicadores)<-c("Variable","Mínimo","Máximo","x","Me","Mo","S","Cv (%)","As","K")
library(knitr)
kable(Tabla_indicadores, format = "markdown", caption = "Tabla No. 6.3: Indicadores estadísticos de la variable profundidad del pozo.")
| Variable | Mínimo | Máximo | x | Me | Mo | S | Cv (%) | As | K |
|---|---|---|---|---|---|---|---|---|---|
| Profundidad del pozo (ft) | 0 | 15795 | 1543.42 | 1330 | [1k,2k] | 1404.84 | 91.02 | 1.43 | 4.18 |
# TABLA DE LOS OUTLIERS
Tabla_outliers<-data.frame(num_outliers,minimooutliers,maximooutliers)
colnames(Tabla_outliers)<-c("Outliers","Mínimo","Máximo")
library(knitr)
kable(Tabla_outliers, format = "markdown", caption = "Tabla No. 6.4: Outliers de la variable profundidad del pozo (ft).")
| Outliers | Mínimo | Máximo |
|---|---|---|
| 1524 | 4397 | 15795 |
CONCLUSIONES: La profundidad del pozo fluctúa entre 0 ft y 15795 ft (4814.12 m) y sus valores están en torno a los 1543.42 ft (470.43 m), con una desviación estándar de 1404.84 siendo un conjunto de valores muy heterogéneos cuyos valores se concentran en la parte media baja de la variable y con un sesgo pronunciado hacia la derecha a excepción de los 1524 valores atípicos que son a partir de los 4397 ft, por lo tanto el comportamiento de la variable es beneficiosa ya que la mayoría de pozos se encuentra a menos de 5000 ft (1524 m) de profundidad lo que es muy rentable su explotación.