1.Carga de datos


setwd("/cloud/project/")
datos<-read.csv("DerramesEEUU.csv", header = TRUE, sep=";" , dec=",")
str(datos)
## 'data.frame':    2760 obs. of  59 variables:
##  $ NumeroInforme                          : int  20100064 20100054 20100092 20100098 20100101 20100102 20100113 20100120 20100039 20100150 ...
##  $ NumeroComplementario                   : int  15072 15114 15120 15127 15130 15132 15146 15162 15197 15205 ...
##  $ DiaAccidente                           : int  8 25 10 28 27 29 11 23 15 11 ...
##  $ MesAccidente                           : int  4 3 5 4 5 5 6 5 3 1 ...
##  $ AnioAccidente                          : int  2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 ...
##  $ HoraAccidente                          : int  6 13 6 24 3 14 7 6 15 2 ...
##  $ AmPmAccidente                          : chr  "a. m." "p. m." "a. m." "p. m." ...
##  $ IDOperador                             : int  31684 18779 30829 12105 20160 30003 1248 300 18718 32296 ...
##  $ NombreOperador                         : chr  "CONOCOPHILLIPS" "SUNOCO, INC (R&M)" "TEPPCO CRUDE PIPELINE, LLC" "MAGELLAN AMMONIA PIPELINE, L.P." ...
##  $ NombreOleoductoInstalacion             : chr  "GD-03, GOLD LINE" "PHILADELPHIA REFINERY - WEST YARD" "HOBBS TO MIDLAND" "WHITING TO EARLY SEGMENT" ...
##  $ UbicacionOleoducto                     : chr  "ONSHORE" "ONSHORE" "ONSHORE" "ONSHORE" ...
##  $ TipoOleoducto                          : chr  "ABOVEGROUND" "ABOVEGROUND" "UNDERGROUND" "UNDERGROUND" ...
##  $ TipoLiquido                            : chr  "REFINED AND/OR PETROLEUM PRODUCT (NON-HVL), LIQUID" "REFINED AND/OR PETROLEUM PRODUCT (NON-HVL), LIQUID" "CRUDE OIL" "HVL OR OTHER FLAMMABLE OR TOXIC FLUID, GAS" ...
##  $ SubtipoLiquido                         : chr  "GASOLINE (NON-ETHANOL)" "OTHER" "-" "ANHYDROUS AMMONIA" ...
##  $ NombreLiquido                          : chr  "-" "VACUUM GAS OIL (VGO)" "-" "-" ...
##  $ CiudadAccidente                        : chr  "GREEN RIDGE" "PHILADELPHIA" "HOBBS" "SCHALLER" ...
##  $ CondadoAccidente                       : chr  "PETTIS" "PHILADELPHIA" "LEA" "IDA" ...
##  $ EstadoAccidente                        : chr  "MO" "PA" "NM" "IA" ...
##  $ LatitudAccidente                       : num  38.6 39.9 32.6 42.5 30.2 ...
##  $ LongitudAccidente                      : num  -93.4 -75.2 -103.1 -95.3 -91.2 ...
##  $ CategoriaCausa                         : chr  "NATURAL FORCE DAMAGE" "MATERIAL/WELD/EQUIP FAILURE" "CORROSION" "MATERIAL/WELD/EQUIP FAILURE" ...
##  $ SubcategoriaCausa                      : chr  "TEMPERATURE" "NON-THREADED CONNECTION FAILURE" "EXTERNAL" "CONSTRUCTION, INSTALLATION OR FABRICATION-RELATED" ...
##  $ LiberacionInvoluntariaBarriles         : num  0.24 1700 2 0.36 1.31 ...
##  $ LiberacionIntencionalBarriles          : chr  "0" "0" "-" "0.05" ...
##  $ RecuperacionLiquidoBarriles            : num  0.07 1699 0.48 0 0 ...
##  $ PerdidaNetaBarriles                    : num  0.17 1 1.52 0.36 1.31 ...
##  $ IgnicionLiquido                        : chr  "NO" "NO" "NO" "NO" ...
##  $ ExplosionLiquido                       : chr  "NO" "NO" "NO" "NO" ...
##  $ CierreOleoducto                        : chr  "YES" "YES" "NO" "NO" ...
##  $ DiaCierre                              : chr  "8" "25" "-" "-" ...
##  $ MesCierre                              : chr  "4" "3" "-" "-" ...
##  $ AnioCierre                             : chr  "2010" "2010" "-" "-" ...
##  $ HoraCierre                             : chr  "6" "18" "-" "-" ...
##  $ AmPmCierre                             : chr  "a. m." "p. m." "-" "-" ...
##  $ DiaReinicio                            : chr  "9" "28" "-" "-" ...
##  $ MesReinicio                            : chr  "4" "3" "-" "-" ...
##  $ AnioReinicio                           : chr  "2010" "2010" "-" "-" ...
##  $ HoraReinicio                           : chr  "10" "16" "-" "-" ...
##  $ AmPmReinicio                           : chr  "a. m." "p. m." "-" "-" ...
##  $ EvacuacionesPublicas                   : chr  "-" "0" "-" "-" ...
##  $ LesionesEmpleadosOperador              : chr  "-" "-" "-" "-" ...
##  $ LesionesContratistasOperador           : chr  "-" "-" "-" "-" ...
##  $ LesionesRescatistasEmergencia          : chr  "-" "-" "-" "-" ...
##  $ OtrasLesiones                          : chr  "-" "-" "-" "-" ...
##  $ LesionesPublico                        : chr  "-" "-" "-" "-" ...
##  $ TodasLesiones                          : chr  "-" "-" "-" "-" ...
##  $ FallecimientosEmpleadosOperador        : chr  "-" "-" "-" "-" ...
##  $ FallecimientosContratistasOperador     : chr  "-" "-" "-" "-" ...
##  $ FallecimientosRescatistasEmergencia    : chr  "-" "-" "-" "-" ...
##  $ OtrosFallecimientos                    : chr  "-" "-" "-" "-" ...
##  $ FallecimientosPublico                  : chr  "-" "-" "-" "-" ...
##  $ TodosFallecimientos                    : chr  "-" "-" "-" "-" ...
##  $ CostosDaniosPropiedad                  : chr  "0" "0" "30000" "12000" ...
##  $ CostosMercanciaPerdidas                : chr  "27" "0" "100" "30" ...
##  $ CostosDaniosPropiedadesPublicasPrivadas: chr  "0" "0" "1000" "5000" ...
##  $ CostosRespuestaEmergencia              : chr  "0" "0" "-" "0" ...
##  $ CostosRemediacionAmbiental             : chr  "0" "100000" "20000" "15000" ...
##  $ OtrosCostos                            : chr  "0" "0" "-" "0" ...
##  $ TodosCostos                            : int  27 100000 51100 32030 5220 150 7500 9965 11497 165593 ...

1.1 Extracción de datos

Latitud <- datos$LatitudAccidente
Latitud <- na.omit(Latitud)  

2.Distribución de Frecuencias


2.1 Método teórico/manual: Regla de Sturges

2.1.1 Rango, número de clases y amplitud

R_Latitud <- max(Latitud) - min(Latitud)
k_Latitud <- floor(1 + (3.3 * log10(length(Latitud))))
A_Latitud <- R_Latitud / k_Latitud

2.1.2 Límites, intervalos y marca de clase

Una vez determinada la amplitud y el número de clases mediante la regla de Sturges, se procedió a establecer los límites inferior y superior de cada intervalo.

liminf <- seq(from = min(Latitud), by = A_Latitud, length.out = k_Latitud)
limsup <- liminf + A_Latitud
limsup[k_Latitud] <- max(Latitud) 
MC <- (liminf + limsup) / 2

2.1.3 Frecuencias Simples

2.1.3.1 Frecuencia absoluta

Con los intervalos previamente definidos, se procedió al cálculo de las frecuencias simples de la variable. Para obtener la frecuencia absoluta (ni), se utilizó un bucle for, que recorre secuencialmente cada uno de los intervalos. En cada iteración, el código evalúa cuántos datos de la variable se encuentran dentro de los límites inferior y superior correspondientes a un rango específico.

ni <- numeric(k_Latitud)
for (i in 1:k_Latitud) {
  if (i == k_Latitud) {
    ni[i] <- sum(Latitud >= liminf[i] & Latitud <= limsup[i])
  } else {
    ni[i] <- sum(Latitud >= liminf[i] & Latitud < limsup[i])
  }
}

2.1.3.1 Frecuencia relativa

hi <- round((ni / length(Latitud)) * 100, 3)

2.1.4 Frecuencias Acumuladas

Niasc <- cumsum(ni)
Nidsc <- rev(cumsum(rev(ni)))
Hiasc <- cumsum(hi)
Hidsc <- rev(cumsum(rev(hi)))

2.1.5 Tabla de distribución de frecuencias

tabla_Latitud <- data.frame(
  liminf = round(liminf, 3),
  limsup = round(limsup, 3),
  MC = round(MC, 3),
  ni = ni,
  hi_porc = round(hi, 3),      
  Ni_asc = Niasc,
  Ni_dsc = Nidsc,
  Hiasc_porc = round(Hiasc, 3),
  Hidsc_porc = round(Hidsc, 3)
)

total_ni <- sum(tabla_Latitud$ni)
total_hi <- 100

TDFLatitudCompleto <- rbind(tabla_Latitud, data.frame(
  liminf = "TOTAL",
  limsup = " ",
  MC = " ",
  ni = total_ni,
  hi_porc = total_hi,
  Ni_asc = " ",
  Ni_dsc = " ",
  Hiasc_porc = " ",
  Hidsc_porc = " "
))

library(gt)
tabla_latitud_gt <- TDFLatitudCompleto %>%
  gt() %>%
  cols_label(
    liminf = md("**liminf**"),
    limsup = md("**limsup**"),
    MC = md("**MC**"),
    ni = md("**ni**"),
    hi_porc = md("**hi (%)**"),
    Ni_asc = md("**Ni ↑**"),
    Ni_dsc = md("**Ni ↓**"),
    Hiasc_porc = md("**Hi ↑ (%)**"),
    Hidsc_porc = md("**Hi ↓ (%)**")
  ) %>%
  tab_header(
    title = md("**Tabla N° 1**"),
    subtitle = md("**Distribución de la latitud de accidentes en oleoductos ocurridos en EE.UU (2010-2017)**")
  ) %>%
  tab_source_note(
    source_note = md("Autor: Grupo 1")
  ) %>%
  tab_options(
    table.background.color = "white",
    row.striping.background_color = "white",
    table.border.top.color = "black",
    table.border.bottom.color = "black",
    table.border.top.style = "solid",
    table.border.bottom.style = "solid",
    column_labels.border.top.color = "black",
    column_labels.border.bottom.color = "black",
    column_labels.border.bottom.width = px(2),
    heading.border.bottom.color = "black",
    heading.border.bottom.width = px(2),
    table_body.hlines.color = "gray",
    table_body.border.bottom.color = "black"
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_body(
      rows = liminf == "TOTAL"
    )
  )

tabla_latitud_gt
Tabla N° 1
Distribución de la latitud de accidentes en oleoductos ocurridos en EE.UU (2010-2017)
liminf limsup MC ni hi (%) Ni ↑ Ni ↓ Hi ↑ (%) Hi ↓ (%)
21.304 25.384 23.344 3 0.109 3 2760 0.109 100.001
25.384 29.464 27.424 183 6.630 186 2757 6.739 99.892
29.464 33.544 31.504 980 35.507 1166 2574 42.246 93.262
33.544 37.623 35.583 557 20.181 1723 1594 62.427 57.755
37.623 41.703 39.663 675 24.457 2398 1037 86.884 37.574
41.703 45.783 43.743 218 7.899 2616 362 94.783 13.117
45.783 49.863 47.823 133 4.819 2749 144 99.602 5.218
49.863 53.942 51.902 0 0.000 2749 11 99.602 0.399
53.942 58.022 55.982 0 0.000 2749 11 99.602 0.399
58.022 62.102 60.062 0 0.000 2749 11 99.602 0.399
62.102 66.182 64.142 3 0.109 2752 11 99.711 0.399
66.182 70.261 68.221 8 0.290 2760 8 100.001 0.29
TOTAL 2760 100.000
Autor: Grupo 1

Como se puede observar, la tabla resulta difícil de interpretar debido a la gran magnitud de los valores. Por ello, para un análisis más claro de la variable, se emplearán los intervalos sugeridos por R, lo que facilita la visualización y comprensión de la distribución de los datos.

2.2 Método práctico: Software R

2.2.1 Generacion de histograma

histoLatitud <- hist(Latitud, 
            main ="Gráfica N°1: Distribución de la cantidad de accidentes en 
            oleoductos segun su latitud, ocurridos en EE.UU.", 
            xlab = "Latitud (°)", 
            ylab = "Cantidad",
            col = "mistyrose", 
            border = "black")

2.2.2 Límites, intervalos y marca de clase

Después de crear el histograma en R, se pueden obtener los límites de los intervalos usando breaks. Estos límites indican dónde empieza y termina cada clase, permitiendo organizar los datos en grupos claros y contiguos sin que se solapen.

Limites<-histoLatitud$breaks
Limites
##  [1] 20 25 30 35 40 45 50 55 60 65 70 75
LimInf <- Limites[1:(length(Limites)-1)] 
LimSup <- Limites[2:length(Limites)]  
MC <- (LimInf + LimSup)/2

2.2.3 Frecuencias Simples

ni<-histoLatitud$counts
hi<-(ni/sum(ni)*100)

2.2.4 Frecuencias Acumuladas

Niasc <- cumsum(ni)                     
Nidsc <- rev(cumsum(rev(ni)))           
Hiasc <- round(cumsum(hi), 3)          
Hidsc <- round(rev(cumsum(rev(hi))), 3)

2.2.5 Tabla de distribución de frecuencias

TDFLatitudR <- data.frame(LimInf, LimSup, MC, ni, 
                          hi = round(hi,3) ,
                          Niasc, Nidsc, Hiasc, Hidsc)

total_ni <- sum(ni)
total_hi <- 100  

TDFLatitudRFinal<-rbind(TDFLatitudR,
                        data.frame(LimInf="Total",
                        LimSup=" ", 
                        MC=" ",
                        ni=total_ni, 
                        hi=total_hi, 
                        Niasc=" ", 
                        Nidsc=" ", 
                        Hiasc=" ", 
                        Hidsc=" "))

library(gt)
tabla_LatitudR_gt <- TDFLatitudRFinal %>%
  gt() %>%
  cols_label(
    LimInf = md("**LimInf**"),
    LimSup = md("**LimSup**"),
    MC = md("**MC**"),
    ni = md("**ni**"),
    hi = md("**hi (%)**"),
    Niasc = md("**Ni ↑**"),
    Nidsc = md("**Ni ↓**"),
    Hiasc = md("**Hi ↑ (%)**"),
    Hidsc = md("**Hi ↓ (%)**")
  ) %>%
  tab_header(
    title = md("**Tabla N° 2**"),
    subtitle = md("**Distribución de la latitud de accidentes en oleoductos ocurridos en EE.UU (2010-2017)**")
  ) %>%
  tab_source_note(
    source_note = md("Autor: Grupo 1")
  ) %>%
  tab_options(
    table.background.color = "white",
    row.striping.background_color = "white",
    table.border.top.color = "black",
    table.border.bottom.color = "black",
    table.border.top.style = "solid",
    table.border.bottom.style = "solid",
    column_labels.border.top.color = "black",
    column_labels.border.bottom.color = "black",
    column_labels.border.bottom.width = px(2),
    heading.border.bottom.color = "black",
    heading.border.bottom.width = px(2),
    table_body.hlines.color = "gray",
    table_body.border.bottom.color = "black"
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_body(
      rows = LimInf == "Total"
    )
  )

tabla_LatitudR_gt
Tabla N° 2
Distribución de la latitud de accidentes en oleoductos ocurridos en EE.UU (2010-2017)
LimInf LimSup MC ni hi (%) Ni ↑ Ni ↓ Hi ↑ (%) Hi ↓ (%)
20 25 22.5 3 0.109 3 2760 0.109 100
25 30 27.5 462 16.739 465 2757 16.848 99.891
30 35 32.5 908 32.899 1373 2295 49.746 83.152
35 40 37.5 670 24.275 2043 1387 74.022 50.254
40 45 42.5 552 20.000 2595 717 94.022 25.978
45 50 47.5 154 5.580 2749 165 99.601 5.978
50 55 52.5 0 0.000 2749 11 99.601 0.399
55 60 57.5 0 0.000 2749 11 99.601 0.399
60 65 62.5 2 0.072 2751 11 99.674 0.399
65 70 67.5 4 0.145 2755 9 99.819 0.326
70 75 72.5 5 0.181 2760 5 100 0.181
Total 2760 100.000
Autor: Grupo 1

3.Gráficas de Distribución de Frecuencias


A continuación, las gráficas de histogramas se presentan con escalas local y global: la escala local ajusta el eje Y al valor máximo de la categoría más alta, mientras que la escala global fija el eje Y a un límite total, mostrando cada categoría en relación al conjunto completo.

3.1 Histogramas

3.1.1 Histogramas frecuencias absolutas

- Histograma Frecuencia Absoluta (Escala Local)

barplot(TDFLatitudR$ni,
     main="Gráfica N°2: Distribución de la cantidad de accidentes en 
     oleoductos según su latitud, registrados en EE.UU.", 
     ylab="Cantidad", 
     xlab="Latitud (°)", 
     las = 1, 
     space = 0,
     axis.lty = 1.5,
     cex.names = 0.9,
     names.arg = TDFLatitudR$MC,
     ylim = c(0, 1000),
     col="pink1")

- Histograma Frecuencia Absoluta (Escala Global)

barplot(TDFLatitudR$ni,
     main="Gráfica N°3: Distribución de la cantidad de accidentes en
     oleoductos según su latitud, respecto al total registrado en EE.UU.", 
     ylab="Cantidad", 
     xlab="Latitud (°)", 
     col="pink2",
     las = 1, 
     space = 0,
     axis.lty = 1.5,
     cex.names = 0.9,
     names.arg = TDFLatitudR$MC,
     ylim = c(0,length(Latitud)))

3.1.2 Histogramas frecuencias relativas

- Histograma Frecuencia Relativa (Escala Local)

barplot(hi,space = 0,
        main="Gráfica  N°4: Distribución porcentual de los accidentes 
        en oleoductos según su latitud, registrados en EE.UU.",
        col="pink3",
        xlab = "Latitud (°)", 
        ylab = "Porcentaje (%)", 
        las = 1,
        axis.lty = 1.5,
        names.arg =TDFLatitudR$MC,
        ylim = c(0, 40))

- Histograma Frecuencia Relativa (Escala Global)

barplot(hi,space = 0,
        main="Gráfica  N°5: Distribución porcentual de los de accidentes
        en oleoductos según su latitud, respecto al total registrado en EE.UU.",
        col="pink4",
        xlab = "Latitud (°)", 
        ylab = "Porcentaje (%)", 
        names.arg =TDFLatitudR$MC,
        las = 1,
        axis.lty = 1.5,
        ylim = c(0,100))

3.2 Ojivas

3.2.1 Ojivas combinadas de la frecuencia absoluta acumulada

#  Ojiva descendente 
LimInf_ext <- c(TDFLatitudR$LimInf, max(TDFLatitudR$LimSup))
Nidsc_ext  <- c(TDFLatitudR$Nidsc, 0)

plot(LimInf_ext, Nidsc_ext,
       main = "Gráfica N°6: Ojivas combinadas de la distribución de la cantidad acumulada 
       de accidentes en oleoductos según su Latitud en EE.UU.",
       xlab = "Latitud (°)",
       ylab = "Cantidad",
       las = 1,
       col = "steelblue2",
       type = "b",
       xaxt = "n",
       cex.axis = 0.8,
       ylim = c(0, max(TDFLatitudR$Niasc)))

# Etiquetas de marcas de clase en el eje X
axis(1, at = c(TDFLatitudR$LimInf, max(TDFLatitudR$LimSup)), 
     labels = c(TDFLatitudR$LimInf, max(TDFLatitudR$LimSup)),  
     cex.axis = 0.8)

# Ojiva ascendente
LimSup_ext <- c(min(TDFLatitudR$LimInf), TDFLatitudR$LimSup)   
Niasc_ext  <- c(0, TDFLatitudR$Niasc) 

lines(LimSup_ext, Niasc_ext, type = "b", col = "maroon1", pch = 1)

# Leyenda
legend("right",
         legend = c("Ojiva descendente", "Ojiva ascendente"),
         col = c("steelblue2","maroon1"),
         pch = 1,
         lty = 1,
         cex = 0.7)

3.2.2 Ojivas combinadas de la frecuencia relativa acumulada

#  Ojiva descendente (%)
LimInf_ext <- c(TDFLatitudR$LimInf, max(TDFLatitudR$LimSup))
Hidsc_ext  <- c(TDFLatitudR$Hidsc, 0)

plot(LimInf_ext, Hidsc_ext,
       main = "Gráfica N°7: Ojivas combinadas de la distribución porcentual acumulada 
       de accidentes en oleoductos según su Latitud en EE.UU.",
       xlab = "Latitud (°)",
       ylab = "Porcentaje (%)",
       las = 1,
       col = "turquoise4",
       type = "b",
       xaxt = "n",
       cex.axis = 0.8,
       ylim = c(0, max(TDFLatitudR$Hiasc)))

# Etiquetas de marcas de clase en el eje X
axis(1, at = c(TDFLatitudR$LimInf, max(TDFLatitudR$LimSup)), 
     labels = c(TDFLatitudR$LimInf, max(TDFLatitudR$LimSup)),  
     cex.axis = 0.8)

# Ojiva ascendente (%)
LimSup_ext <- c(min(TDFLatitudR$LimInf), TDFLatitudR$LimSup)   
Hiasc_ext  <- c(0, TDFLatitudR$Hiasc)      

lines(LimSup_ext, Hiasc_ext, col = "violetred1", type = "b")

# Leyenda
legend("right",legend = c("Ojiva descendente", "Ojiva ascendente"),
       col = c("turquoise4", "violetred1"), 
       pch = 1, lty = 1,cex = 0.7)

3.3 Diagrama de Caja y bigotes

boxplot(Latitud, horizontal = TRUE, col = "pink",
        main = "Gráfica N°8: Distribución de la latitud de accidentes 
        en oleoductos ocurridos en EE.UU.",
        xlab = "Latitud (°)")

4.Indicadores estadísticos


4.1 Indicadores de posición

- Tendencia Central

# Media
media <- mean(Latitud)

# Mediana
mediana <- median(Latitud)

Mo <- "[30, 35)"

- No Centrales

# Cuartiles
ri <- min(Latitud)
rs <- max(Latitud)
summary(Latitud)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   21.30   31.13   35.05   35.85   40.31   70.26

4.2 Indicadores de dispersión

desviacion_estandar <- sd(Latitud)
coeficiente_variabilidad <- (desviacion_estandar / media) * 100

4.3 Indicadores de forma

library(e1071) 
As <- skewness(Latitud)
curtosis <- kurtosis(Latitud)

4.4 Tabla de indicadores

library(gt)

Variable <- c("Latitud")
Tabla_indicadores_Latitud <- data.frame(
  Variable,
  ri = round(ri, 3),
  rs = round(rs, 3),
  media = round(media, 3),
  mediana = round(mediana, 3),
  Mo,
  S = round(desviacion_estandar, 3),
  `Cv (%)` = round(coeficiente_variabilidad, 3),
  As = round(As, 3),
  K = round(curtosis, 3)
)

colnames(Tabla_indicadores_Latitud) <- c("Variable","Mínimo","Máximo","x","Me","Mo","S","Cv (%)","As","K")

tabla_indicadores_gt <- Tabla_indicadores_Latitud %>%
  gt() %>%
  tab_header(
    title = md("**Tabla N°3**"),
    subtitle = md("**Indicadores estadísticos de la variable latitud de accidentes en oleoductos ocurridos en EE.UU (2010-2017)**")
  ) %>%
  tab_source_note(
    source_note = md("Autor: Grupo 1")
  ) %>%
  cols_align(
    align = "center",   
    columns = everything()  
  ) %>%
  tab_options(
    table.background.color = "white",
    row.striping.background_color = "white",
    table.border.top.color = "black",
    table.border.bottom.color = "black",
    table.border.top.style = "solid",
    table.border.bottom.style = "solid",
    column_labels.font.weight = "bold",
    column_labels.border.top.color = "black",
    column_labels.border.bottom.color = "black",
    column_labels.border.bottom.width = px(2),
    heading.border.bottom.color = "black",
    heading.border.bottom.width = px(2),
    table_body.hlines.color = "gray",
    table_body.border.bottom.color = "black"
  )
tabla_indicadores_gt
Tabla N°3
Indicadores estadísticos de la variable latitud de accidentes en oleoductos ocurridos en EE.UU (2010-2017)
Variable Mínimo Máximo x Me Mo S Cv (%) As K
Latitud 21.304 70.261 35.85 35.048 [30, 35) 5.627 15.696 1.072 3.026
Autor: Grupo 1

5.Valores atípicos


5.1 Identificación de valores atípicos

outliers <- boxplot.stats(Latitud)$out 

num_outliers <- length(outliers) 

minimooutliers <- min(outliers) 
maximooutliers <- max(outliers) 

5.2 Tabla de Valores atípicos

Tabla_outliers_Latitud <- data.frame(
  Outliers = num_outliers,
  Mínimo = round(minimooutliers,3),
  Máximo = round(maximooutliers,3)
)

library(gt)
Tabla_outliers_Latitud %>%
  gt() %>%
  tab_header(
    title = md("**Tabla N°4**"),
    subtitle = md("**Valores atípicos de la variable latitud de accidentes en oleoductos ocurridos en EE.UU (2010-2017)**")
  ) %>%
  tab_source_note(
    source_note = md("Autor: Grupo 1")
  ) %>%
  cols_align(
    align = "center",   
    columns = everything()  
  ) %>%
  tab_options(
    table.border.top.color = "black",
    table.border.bottom.color = "black",
    table.border.top.style = "solid",
    table.border.bottom.style = "solid",
    column_labels.font.weight = "bold",
    column_labels.border.top.color = "black",
    column_labels.border.bottom.color = "black",
    column_labels.border.bottom.width = px(2),
    heading.border.bottom.color = "black",
    heading.border.bottom.width = px(2),
    table_body.hlines.color = "grey",
    table_body.border.bottom.color = "black"
  )
Tabla N°4
Valores atípicos de la variable latitud de accidentes en oleoductos ocurridos en EE.UU (2010-2017)
Outliers Mínimo Máximo
11 63.425 70.261
Autor: Grupo 1

6.Conclusión


La variable Latitud en grados fluctúa entre 21.3 y 70 grados y sus valores giran en torno a 35.85 grados, con una desviación estándar de 15.69, siendo un conjunto de valores homogéneo, cuyos valores se acumulan fuertemente en la parte baja, con la existencia de 11 valores atípicos desde 63.43 hasta 70.26 grados.

Por todo lo anterior, el comportamiento de la variable latitud resulta beneficioso para el análisis espacial y la gestión del riesgo, dado que evidencia un patrón de concentración en el eje norte–sur, facilitando la identificación de las zonas de mayor incidencia y la detección de casos aislados en latitudes extremas, lo cual favorece la planificación preventiva y operativa.