CARGA DE DATOS

CARGA DE DATOS

datos <- read.csv("C:\\Users\\joeja\\Desktop\\Proyecto Estadística\\Depositos_sulfuro.csv", 
                  header = TRUE, 
                  sep = ";", 
                  dec = ".")

#VARIABLE NUMERICAS
area <- as.numeric(datos$ore_area) #variable dependiente
ton  <- as.numeric(datos$oreton) #variable independiente

TABLA DE PARES DE VALORES

TPV <- data.frame(
  ton  = as.numeric(ton),
  area = as.numeric(area)
)

#LIMPIEZA
TPV <- na.omit(TPV)
TPV <- TPV[TPV$ton > 0 & TPV$area > 0, ]

#OUTLIERS EN TONELADAS (ton)
Q1_ton  <- quantile(TPV$ton, 0.25)
Q3_ton  <- quantile(TPV$ton, 0.75)
IQR_ton <- Q3_ton - Q1_ton

lim_inf_ton <- Q1_ton - 1.5 * IQR_ton
lim_sup_ton <- Q3_ton + 1.5 * IQR_ton

#OUTLIERS EN AREA (area)
Q1_area  <- quantile(TPV$area, 0.25)
Q3_area  <- quantile(TPV$area, 0.75)
IQR_area <- Q3_area - Q1_area

lim_inf_area <- Q1_area - 1.5 * IQR_area
lim_sup_area <- Q3_area + 1.5 * IQR_area

#TDV FINAL
TPV_limpio <- TPV[
  TPV$ton  >= lim_inf_ton  & TPV$ton  <= lim_sup_ton &
    TPV$area >= lim_inf_area & TPV$area <= lim_sup_area,
]

dim(TPV_limpio)   # pares finales
## [1] 82  2
summary(TPV_limpio)
##       ton              area      
##  Min.   :  1.00   Min.   : 1.00  
##  1st Qu.: 14.25   1st Qu.: 2.00  
##  Median : 37.00   Median : 4.00  
##  Mean   : 95.88   Mean   :11.77  
##  3rd Qu.:124.75   3rd Qu.:12.75  
##  Max.   :592.00   Max.   :75.00
#LÍMITE SUPERIOR (1 Y por cada X)
tabla_sup <- aggregate(ton ~ area,
                       data = TPV_limpio,
                       FUN = max)

tabla_media <- aggregate(ton ~ area,
                         data = TPV_limpio,
                         FUN = mean)

tabla_inf <- aggregate(ton ~ area,
                       data = TPV_limpio,
                       FUN = min)

DIAGRAMA DE DISPERSIÓN

GRÁFICO DE DISPERCIÓN

plot(tabla_inf$ton,
     tabla_inf$area,
     pch = 19,
     col = "blue",
     main = "Diagrama de dispersión de Tonelaje y Área de depósito",
     xlab = "Cantidad del material (Ton)",
     ylab = "Área de depósito mineral(m²)")

y<-tabla_inf$area
x<-tabla_inf$ton

y1<- log(y)
x1<- log(x)

CÁLCULO DE PARÁMETROS

regresion_Potencial<- lm(y1~x1)
regresion_Potencial  
## 
## Call:
## lm(formula = y1 ~ x1)
## 
## Coefficients:
## (Intercept)           x1  
##      1.1327       0.5001
summary(regresion_Potencial)
## 
## Call:
## lm(formula = y1 ~ x1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.62364 -0.39541 -0.05806  0.63913  1.43698 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.13266    0.32789   3.454   0.0019 ** 
## x1           0.50013    0.09285   5.387 1.22e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7929 on 26 degrees of freedom
## Multiple R-squared:  0.5274, Adjusted R-squared:  0.5092 
## F-statistic: 29.01 on 1 and 26 DF,  p-value: 1.215e-05
beta0<-regresion_Potencial$coefficients[1]
beta1<-regresion_Potencial$coefficients[2]

b<-beta1
a<-exp(beta0)

MODELO POTENCIAL

plot(x,y,
     pch = 19,
     col = "blue",
     main = "Comparación del modelo y la realidad del Tonelaje y Área de depósito",
     xlab = "Cantidad del material (Ton)",
     ylab = "Área de depósito mineral(m²)")

curve(a*x^b, from = 0, to = 500, add = TRUE, col = "red")

TEST DE PEARSON

r<-cor(x1,y1)
r*100
## [1] 72.62227

ESTIMACIONES

#Cálculo de Pronosticos
RHEsp <- 3.1*200^0.5 
RHEsp
## [1] 43.84062
plot(1, type = "n", axes = FALSE, xlab = "", ylab = "")
text(x = 1, y = 1,
     labels = "¿Cuánta área se necesitan para 200 Toneladas de material?
     \n R= 43.84m²",
     cex = 1,
     col = "blue",
     font = 6)

#RESTRICCIONES
valorx= exp(0)
valorx
## [1] 1

“Si existe restricciones ya que el modelo solo funciona para valores mayores o iguales a 1”

CONCLUSIONES

Entre el Tonelaje y el Área de depósito existe una relación tipo potencial donde el modelo matemático es y=3.1*x^0.5 siendo “y” el Área de depóstio en (m²) y “x” el Tonelaje en (Ton), donde si existe restricciones ya que el modelo es válido únicamente para valores mayores o iguales a 1. El Área de depósito está influenciado en 72,62% por el Tonelaje y el 27,38% por otros factores. Por ejemplo, cuando hay 200 toneladas de material se espera un área de 43.84062 m².