CARGA DE DATOS
#Carga de datos
setwd("~/UNI/ESTADISTICA")
datos <- read.csv("Depositos_Sulfuro.csv", header = TRUE, sep = ";", dec = ".")
#Limpiamos la Variable
# Limpiamos la Variable
latitud <- as.numeric(datos$latdeg)
latitud <- na.omit(latitud)
CARGA DE LIBRERIAS
#Carga de librerias
library(gt)
library(dplyr)
library(knitr)
library(e1071)
TABLA DE DISTRIBUCION DE CANTIDAD POR STURGES
# Calculamos el numero de datos
n <- length(latitud)
# Numero de clases con Sturges
k <- floor(1 + 3.3 * log10(n))
# Min, Max
minimo <- min(latitud)
maximo <- max(latitud)
#Rango
R <- maximo - minimo
# Amplitud
A <- R/k
# Límites inferior (Li) y superior (Ls)
Li <- round(seq(from = minimo, to = maximo-A, by = A), 2)
Ls <- round(seq(from = minimo+A, to = maximo, by = A), 2)
# Marca de clase
MC <- round((Li + Ls)/2, 2)
# Frecuencia Absoluta (ni)
ni <- numeric(length(Li))
for (i in 1:length(Li)) {
ni[i] <- sum(latitud >= Li[i] & latitud < Ls[i])
}
ni[length(Li)] <- sum(latitud >= Li[length(Li)] & latitud <= maximo)
# Frecuencia Relativa (hi)
hi <- (ni / sum(ni)) * 100
# Frecuencias Acumuladas
Niasc <- cumsum(ni)
Nidsc <- rev(cumsum(rev(ni)))
Hiasc <- round(cumsum(hi), 2)
Hidsc <- round(rev(cumsum(rev(hi))), 2)
# TABLA FINAL
TDFlat <- round(data.frame(
Li, Ls, MC, ni, hi , Niasc, Nidsc, Hiasc, Hidsc
),2)
TDFlat
## Li Ls MC ni hi Niasc Nidsc Hiasc Hidsc
## 1 -54.00 -42.45 -48.23 1 0.09 1 1090 0.09 100.00
## 2 -42.45 -30.91 -36.68 25 2.29 26 1089 2.39 99.91
## 3 -30.91 -19.36 -25.13 30 2.75 56 1064 5.14 97.61
## 4 -19.36 -7.82 -13.59 15 1.38 71 1034 6.51 94.86
## 5 -7.82 3.73 -2.04 7 0.64 78 1019 7.16 93.49
## 6 3.73 15.27 9.50 30 2.75 108 1012 9.91 92.84
## 7 15.27 26.82 21.05 68 6.24 176 982 16.15 90.09
## 8 26.82 38.36 32.59 216 19.82 392 914 35.96 83.85
## 9 38.36 49.91 44.13 330 30.28 722 698 66.24 64.04
## 10 49.91 61.45 55.68 245 22.48 967 368 88.72 33.76
## 11 61.45 73.00 67.22 123 11.28 1090 123 100.00 11.28
Fila total de las sumas de ni y hi
# FILA TOTAL
fila_total <- data.frame(
Li = "TOTAL",
Ls = "",
MC = "",
ni = sum(TDFlat$ni),
hi = round(sum(TDFlat$hi),),
Niasc = "",
Nidsc = "",
Hiasc = "",
Hidsc = ""
)
#TABLA FINAL
TDFlat_p <- rbind(TDFlat, fila_total)
TDFlat_p
## Li Ls MC ni hi Niasc Nidsc Hiasc Hidsc
## 1 -54 -42.45 -48.23 1 0.09 1 1090 0.09 100
## 2 -42.45 -30.91 -36.68 25 2.29 26 1089 2.39 99.91
## 3 -30.91 -19.36 -25.13 30 2.75 56 1064 5.14 97.61
## 4 -19.36 -7.82 -13.59 15 1.38 71 1034 6.51 94.86
## 5 -7.82 3.73 -2.04 7 0.64 78 1019 7.16 93.49
## 6 3.73 15.27 9.5 30 2.75 108 1012 9.91 92.84
## 7 15.27 26.82 21.05 68 6.24 176 982 16.15 90.09
## 8 26.82 38.36 32.59 216 19.82 392 914 35.96 83.85
## 9 38.36 49.91 44.13 330 30.28 722 698 66.24 64.04
## 10 49.91 61.45 55.68 245 22.48 967 368 88.72 33.76
## 11 61.45 73 67.22 123 11.28 1090 123 100 11.28
## 12 TOTAL 1090 100.00
TABLA DE DISTRIBUCIÓN DE CANTIDAD POR STURGES FINAL
# TABLA GT
tabla_lat_p <- TDFlat_p %>%
gt() %>%
tab_header(
title = md("*Tabla Nº:1*"),
subtitle = md("Tabla de distribución de cantidad de
latitud en los depósitos masivos de sulfuros")
) %>%
tab_source_note(
source_note = md("Autor: GRUPO 2")
) %>%
tab_options(
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),
row.striping.include_table_body = TRUE,
heading.border.bottom.color = "black",
heading.border.bottom.width = px(2),
table_body.hlines.color = "gray",
table_body.border.bottom.color = "black"
)
tabla_lat_p
| Tabla Nº:1 | ||||||||
| Tabla de distribución de cantidad de latitud en los depósitos masivos de sulfuros | ||||||||
| Li | Ls | MC | ni | hi | Niasc | Nidsc | Hiasc | Hidsc |
|---|---|---|---|---|---|---|---|---|
| -54 | -42.45 | -48.23 | 1 | 0.09 | 1 | 1090 | 0.09 | 100 |
| -42.45 | -30.91 | -36.68 | 25 | 2.29 | 26 | 1089 | 2.39 | 99.91 |
| -30.91 | -19.36 | -25.13 | 30 | 2.75 | 56 | 1064 | 5.14 | 97.61 |
| -19.36 | -7.82 | -13.59 | 15 | 1.38 | 71 | 1034 | 6.51 | 94.86 |
| -7.82 | 3.73 | -2.04 | 7 | 0.64 | 78 | 1019 | 7.16 | 93.49 |
| 3.73 | 15.27 | 9.5 | 30 | 2.75 | 108 | 1012 | 9.91 | 92.84 |
| 15.27 | 26.82 | 21.05 | 68 | 6.24 | 176 | 982 | 16.15 | 90.09 |
| 26.82 | 38.36 | 32.59 | 216 | 19.82 | 392 | 914 | 35.96 | 83.85 |
| 38.36 | 49.91 | 44.13 | 330 | 30.28 | 722 | 698 | 66.24 | 64.04 |
| 49.91 | 61.45 | 55.68 | 245 | 22.48 | 967 | 368 | 88.72 | 33.76 |
| 61.45 | 73 | 67.22 | 123 | 11.28 | 1090 | 123 | 100 | 11.28 |
| TOTAL | 1090 | 100.00 | ||||||
| Autor: GRUPO 2 | ||||||||
DEBIDO A QUE LA TABLA SE PRESENTA CON NUMEROS MUY DIFICILES SE DECIDIO SIMPLIFICAR LA TABLA
HISTOGRAMA DE DISTRIBUCIÓN DE CANTIDAD
histograma_lat<-hist(latitud,
main = "Gráfica Nº1: Distribución cantidad de la latitud
en depositos masivos de sulfuros volcanicos ",
xlab = "Latitud",
ylab = "Cantidad",
col = "gray")
TABLA DE DISTRIBUCION DE CANTIDAD SIMPLIFICADA
#LIMITE INFERIOR SIMPLIFICADA
lis<- histograma_lat$breaks[1:14]
lis
## [1] -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70
#LIMITE SUPERIOR SIMPLIFICADA
lss<-histograma_lat$breaks[2:15]
lss
## [1] -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80
#MARCA DE CLASE
MC_f<-histograma_lat$mids
MC_f
## [1] -55 -45 -35 -25 -15 -5 5 15 25 35 45 55 65 75
# Frecuencia absoluta(ni)
ni_f <-histograma_lat $counts
ni_f
## [1] 1 7 19 29 14 8 17 51 34 256 332 190 131 1
# Frecuencia relativa (hi)
hi_f <- (ni_f/sum(ni_f))*100
hi_f
## [1] 0.09174312 0.64220183 1.74311927 2.66055046 1.28440367 0.73394495
## [7] 1.55963303 4.67889908 3.11926606 23.48623853 30.45871560 17.43119266
## [13] 12.01834862 0.09174312
# Frecuencias Acumuladas
Niasc_f <- cumsum(ni_f)
Nidsc_f <- rev(cumsum(rev(ni_f)))
Hiasc_f <- round(cumsum(hi_f), 2)
Hidsc_f <- round(rev(cumsum(rev(hi_f))), 2)
# TABLA FINAL
TDFlat_f <- round(data.frame(
lis, lss, MC_f, ni_f, hi_f, Niasc_f, Nidsc_f, Hiasc_f, Hidsc_f
),2)
TDFlat_f
## lis lss MC_f ni_f hi_f Niasc_f Nidsc_f Hiasc_f Hidsc_f
## 1 -60 -50 -55 1 0.09 1 1090 0.09 100.00
## 2 -50 -40 -45 7 0.64 8 1089 0.73 99.91
## 3 -40 -30 -35 19 1.74 27 1082 2.48 99.27
## 4 -30 -20 -25 29 2.66 56 1063 5.14 97.52
## 5 -20 -10 -15 14 1.28 70 1034 6.42 94.86
## 6 -10 0 -5 8 0.73 78 1020 7.16 93.58
## 7 0 10 5 17 1.56 95 1012 8.72 92.84
## 8 10 20 15 51 4.68 146 995 13.39 91.28
## 9 20 30 25 34 3.12 180 944 16.51 86.61
## 10 30 40 35 256 23.49 436 910 40.00 83.49
## 11 40 50 45 332 30.46 768 654 70.46 60.00
## 12 50 60 55 190 17.43 958 322 87.89 29.54
## 13 60 70 65 131 12.02 1089 132 99.91 12.11
## 14 70 80 75 1 0.09 1090 1 100.00 0.09
Fila total de las sumas de ni y hi
# FILA TOTAL
fila_total_f <- data.frame(
lis = "TOTAL",
lss = "",
MC_f = "",
ni_f = sum(TDFlat_f$ni_f),
hi_f = round(sum(TDFlat_f$hi_f),),
Niasc_f = "",
Nidsc_f = "",
Hiasc_f = "",
Hidsc_f = ""
)
TDFlat_t <- rbind(TDFlat_f, fila_total_f)
TDFlat_t
## lis lss MC_f ni_f hi_f Niasc_f Nidsc_f Hiasc_f Hidsc_f
## 1 -60 -50 -55 1 0.09 1 1090 0.09 100
## 2 -50 -40 -45 7 0.64 8 1089 0.73 99.91
## 3 -40 -30 -35 19 1.74 27 1082 2.48 99.27
## 4 -30 -20 -25 29 2.66 56 1063 5.14 97.52
## 5 -20 -10 -15 14 1.28 70 1034 6.42 94.86
## 6 -10 0 -5 8 0.73 78 1020 7.16 93.58
## 7 0 10 5 17 1.56 95 1012 8.72 92.84
## 8 10 20 15 51 4.68 146 995 13.39 91.28
## 9 20 30 25 34 3.12 180 944 16.51 86.61
## 10 30 40 35 256 23.49 436 910 40 83.49
## 11 40 50 45 332 30.46 768 654 70.46 60
## 12 50 60 55 190 17.43 958 322 87.89 29.54
## 13 60 70 65 131 12.02 1089 132 99.91 12.11
## 14 70 80 75 1 0.09 1090 1 100 0.09
## 15 TOTAL 1090 100.00
TABLA DE DISTRIBUCION DE CANTIDAD SIMPLIFICADA FINAL
# TABLA DE DISTRIBUCION DE CANTIDAD SIMPLIFICADA FINAL
tabla_lat_f <- TDFlat_t %>%
gt() %>%
tab_header(
title = md("*Tabla Nº:2*"),
subtitle = md("Tabla de distribución de cantidad de
latitud en los depósitos masivos de sulfuros")
) %>%
tab_source_note(
source_note = md("Autor: GRUPO 2")
) %>%
tab_options(
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),
row.striping.include_table_body = TRUE,
heading.border.bottom.color = "black",
heading.border.bottom.width = px(2),
table_body.hlines.color = "gray",
table_body.border.bottom.color = "black"
)
tabla_lat_f
| Tabla Nº:2 | ||||||||
| Tabla de distribución de cantidad de latitud en los depósitos masivos de sulfuros | ||||||||
| lis | lss | MC_f | ni_f | hi_f | Niasc_f | Nidsc_f | Hiasc_f | Hidsc_f |
|---|---|---|---|---|---|---|---|---|
| -60 | -50 | -55 | 1 | 0.09 | 1 | 1090 | 0.09 | 100 |
| -50 | -40 | -45 | 7 | 0.64 | 8 | 1089 | 0.73 | 99.91 |
| -40 | -30 | -35 | 19 | 1.74 | 27 | 1082 | 2.48 | 99.27 |
| -30 | -20 | -25 | 29 | 2.66 | 56 | 1063 | 5.14 | 97.52 |
| -20 | -10 | -15 | 14 | 1.28 | 70 | 1034 | 6.42 | 94.86 |
| -10 | 0 | -5 | 8 | 0.73 | 78 | 1020 | 7.16 | 93.58 |
| 0 | 10 | 5 | 17 | 1.56 | 95 | 1012 | 8.72 | 92.84 |
| 10 | 20 | 15 | 51 | 4.68 | 146 | 995 | 13.39 | 91.28 |
| 20 | 30 | 25 | 34 | 3.12 | 180 | 944 | 16.51 | 86.61 |
| 30 | 40 | 35 | 256 | 23.49 | 436 | 910 | 40 | 83.49 |
| 40 | 50 | 45 | 332 | 30.46 | 768 | 654 | 70.46 | 60 |
| 50 | 60 | 55 | 190 | 17.43 | 958 | 322 | 87.89 | 29.54 |
| 60 | 70 | 65 | 131 | 12.02 | 1089 | 132 | 99.91 | 12.11 |
| 70 | 80 | 75 | 1 | 0.09 | 1090 | 1 | 100 | 0.09 |
| TOTAL | 1090 | 100.00 | ||||||
| Autor: GRUPO 2 | ||||||||
Colores de las barras
# colores de las barras
colores <- gray.colors(length(ni), start = 0.3, end = 0.9)
Histograma de cantidad
hist(
latitud,
main = "Gráfica Nº2: Distribución de cantidad de latitud en depositos masivos
de sulfuros volcanicos ",
xlab = "latitud",
ylab = "Cantidad",
col = colores
)
Histograma de cantidad
hist(
latitud,
main = "Gráfica Nº3: Distribución de cantidad de latitud en depositos masivos
de sulfuros volcanicos",
xlab = "latitud",
ylab = "Cantidad ",
col = colores,
ylim = c(0, 1014)
)
DIAGRAMA DE CAJA
boxplot(
latitud,
horizontal = TRUE,
main = "Gráfica Nº6: Distribución de cantidad de la latitud en depositos
masivos de sulfuros volcanicos",
xlab = "Latitud",
col = colores
)
Convertir columnas que quedaron como character a numéricas
Niasc_f <- as.numeric(TDFlat_f$Niasc_f)
Nidsc_f <- as.numeric(TDFlat_f$Nidsc_f)
Ojivas combinadas Ni
plot(lss, Nidsc_f, type="o",
main="Gráfica Nº7: Ojivas combinadas de cantidad acumulada de la latitud"
, ylab="Cantidad Acumulada", col="blue", xlab="latitud")
lines(lis, Niasc_f, col="black", add=TRUE, type="b")
Ojivas combinadas Hi
plot(lss, Hidsc_f, type="o",
main="Gráfica Nº8: Ojivas combinadas de porcentaje acumulado de la latitud"
, ylab="Porcentaje Acumulado", col="blue", xlab="Latitud)")
lines(lis, Hiasc_f, col="black", add=TRUE, type="b")
Ver los cuartiles
summary(latitud)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -54.00 35.00 47.00 40.14 53.00 73.00
Indicadores Estadisticos
POSICION
#MEDIA ARITMETICA
x<-mean(latitud)
x
## [1] 40.14312
#MEDIANA ARITMETICA
ri<-min(latitud)
rs<-max(latitud)
Me<-median(latitud)
Me
## [1] 47
DISPERSION
#DESVIACIÓN ESTÁNDAR
sd<-sd(latitud)
sd
## [1] 22.0414
#COEFICIENTE DE VARIACIÓN
CV <- ((sd / x) * 100)
CV
## [1] 54.90705
FORMA
#COEFICIENTE DE ASIMETRÍA
As<-skewness(latitud)
As
## [1] -1.810455
#COEFICIENTE DE CURTOSIS
K<-kurtosis(latitud)
K
## [1] 3.446897
TABLA DE INDICADORES ESTADISTICOS
Variable<-c("Latitud")
TablaIndicadores<-data.frame(Variable,ri,rs,round(x,2),Me,round(sd,2), round(CV,2), round(As,2),round(K,2))
colnames(TablaIndicadores)<-c("Variable","minimo","máximo","x","Me","sd","Cv (%)","As","K")
library(knitr)
kable(TablaIndicadores, format = "markdown", caption = "Tabla N°3. Indicadores estadísticos
de la variable latitud en los depositos masivos de sulfuros volcanicos")
| Variable | minimo | máximo | x | Me | sd | Cv (%) | As | K |
|---|---|---|---|---|---|---|---|---|
| Latitud | -54 | 73 | 40.14 | 47 | 22.04 | 54.91 | -1.81 | 3.45 |
TABLA DE OUTLIERS
outliers<-boxplot.stats(latitud)$out
# Contar los valores atípicos
num_outliers <- length(outliers)
num_outliers
## [1] 88
minoutliers<-min(outliers)
minoutliers
## [1] -54
maxoutliers<-max(outliers)
maxoutliers
## [1] 7
TablaOutliers<-data.frame(num_outliers,minoutliers,maxoutliers)
colnames(TablaOutliers)<-c("Outliers","Mínimo","Máximo")
kable(TablaOutliers, format = "markdown", caption = "Tabla N°4: Outliers de la variable
latitud en los depositos masivos de sulfuros volcanicos).")
| Outliers | Mínimo | Máximo |
|---|---|---|
| 88 | -54 | 7 |
CONCLUSIÓN
La variable latitud, medida en grados, fluctúa entre 0 y 73, con valores que se encuentran en torno a la mediana de 48, y una desviación estándar de 13.24, lo que indica un conjunto de datos relativamente homogéneo. La mayor concentración de registros se localiza en la parte media–alta de la variable. Se identifican 22 valores atípicos, los cuales se concentran principalmente entre 0 y 11 grados de latitud. Por todo lo anterior, el comportamiento de la latitud es medianamente beneficioso, ya que la concentración de depósitos en latitudes medias–altas coincide con zonas geológicas ampliamente exploradas y con mayor disponibilidad de información para el análisis minero.