setwd("C:/Users/luisq/OneDrive/Desktop/ESTADISTICA")
datos <- read.csv("kansas.csv", sep = ";", stringsAsFactors = FALSE,
fileEncoding = "UTF-8")
# Variable derivada: DEPTH_LEVEL basada en cuartiles de DEPTH_OF_WELL
dep <- suppressWarnings(as.numeric(datos$DEPTH_OF_WELL))
dep <- dep[!is.na(dep) & dep > 0]
n_total <- length(dep)
# Cuartiles obtenidos del análisis del dataset
dq1 <- 2696
dq2 <- 3450
dq3 <- 4594
depth_level <- cut(dep,
breaks = c(0, dq1, dq2, dq3, Inf),
labels = c("Poco Profundo", "Moderado", "Profundo", "Muy Profundo"),
include.lowest = TRUE)| Campo | Descripción |
|---|---|
| Nombre original | DEPTH_LEVEL (variable derivada) |
| Nombre asignado | Nivel de Profundidad |
| Tipo | Cualitativa |
| Subtipo | Ordinal |
| Dominio | Categoría de profundidad del pozo, derivada de DEPTH_OF_WELL |
| Rango | {Poco Profundo, Moderado, Profundo, Muy Profundo} |
| Unidad de medida | Sin unidad (categoría ordinal) |
| Escala de medida | Ordinal |
La variable Nivel de Profundidad es derivada de la
profundidad del pozo (DEPTH_OF_WELL). Se clasifica en
cuatro niveles con base en los cuartiles del
dataset:
| Nivel | Rango de profundidad (ft) |
|---|---|
| Poco Profundo | ≤ 2 696 ft |
| Moderado | 2 697 – 3 450 ft |
| Profundo | 3 451 – 4 594 ft |
| Muy Profundo | > 4 594 ft |
Se trabajó con 52041 registros válidos con profundidad mayor a cero.
Cuadro No. 10
Distribución de frecuencias de la variable Nivel de Profundidad
(Arrendamientos de Petróleo y Gas en Kansas — BLM MLRS)
ni <- table(depth_level)
fi <- ni / n_total
hi_pct <- round(fi * 100, 2)
tdf <- data.frame(
Nivel = names(ni),
`ni (FA)` = as.integer(ni),
`hi (fr)` = round(as.numeric(fi), 4),
`hi% (%)` = as.numeric(hi_pct),
check.names = FALSE
)
tdf_total <- rbind(tdf,
data.frame(
Nivel = "**Total**",
`ni (FA)` = n_total,
`hi (fr)` = 1.0000,
`hi% (%)` = 100.00,
check.names = FALSE
)
)
kable(tdf_total,
caption = "Tabla 10: Distribución de frecuencias de la variable Nivel de Profundidad.",
align = c("l", "r", "r", "r"),
col.names = c("Nivel de Profundidad", "Frecuencia (ni)", "Fracción (hi)", "Porcentaje (hi%)")) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "bordered"),
full_width = FALSE, position = "center") %>%
row_spec(nrow(tdf_total), bold = TRUE, background = "#D3D3D3") %>%
column_spec(1, bold = TRUE)| Nivel de Profundidad | Frecuencia (ni) | Fracción (hi) | Porcentaje (hi%) |
|---|---|---|---|
| Poco Profundo | 13014 | 0.2501 | 25.01 |
| Moderado | 13027 | 0.2503 | 25.03 |
| Profundo | 12996 | 0.2497 | 24.97 |
| Muy Profundo | 13004 | 0.2499 | 24.99 |
| Total | 52041 | 1.0000 | 100.00 |
df_plot <- data.frame(
Nivel = factor(names(ni),
levels = c("Poco Profundo","Moderado","Profundo","Muy Profundo")),
Frecuencia = as.integer(ni)
)
ggplot(df_plot, aes(x = Nivel, y = Frecuencia)) +
geom_bar(stat = "identity", fill = "gray50", color = "black", width = 0.6) +
geom_text(aes(label = Frecuencia), vjust = -0.4, size = 4) +
labs(
title = "Figura 1: Diagrama de barras — Variable Nivel de Profundidad",
subtitle = "Clasificación basada en cuartiles de DEPTH_OF_WELL (BLM MLRS)",
x = "Nivel de Profundidad",
y = "Frecuencia absoluta (ni)"
) +
theme_classic(base_size = 12) +
theme(
plot.title = element_text(face = "bold", hjust = 0.5),
plot.subtitle = element_text(hjust = 0.5)
)df_pie <- df_plot
df_pie$Porcentaje <- round(df_pie$Frecuencia / n_total * 100, 1)
df_pie$Etiqueta <- paste0(df_pie$Nivel, "\n", df_pie$Porcentaje, "%")
grises <- c("gray80","gray60","gray40","gray20")
ggplot(df_pie, aes(x = "", y = Frecuencia, fill = Nivel)) +
geom_col(width = 1, color = "black") +
coord_polar(theta = "y") +
scale_fill_manual(values = grises) +
geom_text(aes(label = Etiqueta),
position = position_stack(vjust = 0.5), size = 3.5) +
labs(
title = "Figura 2: Sector circular — Variable Nivel de Profundidad",
fill = "Nivel"
) +
theme_void() +
theme(
plot.title = element_text(face = "bold", hjust = 0.5),
legend.position = "right"
)La distribución es cuasi-uniforme al haber empleado cuartiles como cortes. El nivel Poco Profundo agrupa los pozos con profundidades hasta 2 696 ft, mientras que Muy Profundo incluye los que superan los 4 594 ft. La profundidad media del conjunto es de aproximadamente 3 548 ft, lo que indica que la mayoría de los pozos en Kansas se encuentra a profundidades moderadas, coherente con las formaciones del Paleozoico superior presentes en el estado.