knitr::opts_chunk$set(
echo = TRUE,
message = FALSE,
warning = FALSE,
fig.align = "center"
)
datos <- read.csv("C:/Users/USER/Documents/PROYECTO ESTADISTICA/CMDB_Data.csv",
header = TRUE,
sep = ";",
dec = ",",
fileEncoding = "latin1")
# Verificación inicial
str(datos)
## 'data.frame': 1366 obs. of 103 variables:
## $ ï..LAB_ID : chr "C355417" "C360759" "C360762" "C360763" ...
## $ PREVIOUS_LAB_ID1 : chr "" "" "" "" ...
## $ PREVIOUS_LAB_ID2 : chr "" "" "" "" ...
## $ PREVIOUS_LAB_ID3 : chr "" "" "" "" ...
## $ FIELD_ID : chr "RM0001" "RM0027" "RM0030" "RM0031" ...
## $ JOB_ID : chr "MRP11968" "MRP12307" "MRP12307" "MRP12307" ...
## $ PREVIOUS_JOB_ID1 : chr "" "" "" "" ...
## $ PREVIOUS_JOB_ID2 : chr "" "" "" "" ...
## $ PREVIOUS_JOB_ID3 : chr "" "" "" "" ...
## $ SUBMITTER : chr "Rare Metals Task" "Rare Metals Task" "Rare Metals Task" "Rare Metals Task" ...
## $ PROJECT_NAME : chr "Critical and Rare Metals" "Critical and Rare Metals" "Critical and Rare Metals" "Critical and Rare Metals" ...
## $ DATE_SUBMITTED : chr "30/6/2011" "31/8/2011" "31/8/2011" "31/8/2011" ...
## $ COLLECTION : chr "Mackay-Keck Ore Deposits Collection" "Mackay-Stanford Ore Deposits Collection" "Mackay-Stanford Ore Deposits Collection" "Mackay-Stanford Ore Deposits Collection" ...
## $ COLLECTION_ID : chr "PHNC08_39_1183" "OD21441" "OD22811" "OD25716" ...
## $ CONTINENT : chr "North America" "South America" "South America" "Africa" ...
## $ COUNTRY : chr "United States" "Chile" "Chile" "South Africa" ...
## $ STATE_PROVINCE : chr "Nevada" "Antofagasta" "Tarapacá" "Transvaal" ...
## $ COUNTY : chr "Lyon" "El Loa" "El Tamarugal" "" ...
## $ DISTRICT_NAME : chr "Yerington" "Chuquicamata" "Collahuasi/Quebrada Blanca" "" ...
## $ DEPOSIT_NAME : chr "Pumpkin Hollow" "" "" "" ...
## $ MINE_NAME : chr "Pumpkin Hollow" "Chuquicamata mine" "Collahuasi district" "" ...
## $ DISTRICT_NAME_COLLECT: chr "Yerington" "" "" "" ...
## $ DEPOSIT_NAME_COLLECT : chr "" "" "" "" ...
## $ MINE_NAME_COLLECT : chr "Pumpkin Hollow" "Chuquicamata" "Poduosa mine" "Messina Mines Ltd." ...
## $ LOCATE_DESC : chr "" "" "Level 25" "" ...
## $ LATITUDE : num 38.9 -22.3 -21 -24.7 62.7 ...
## $ LONGITUDE : num -119.1 -68.9 -68.7 29.3 29 ...
## $ DATUM : chr "WGS84" "WGS84" "WGS84" "" ...
## $ LATITUDE_COLLECT : num 38.9 22.3 NA NA 62.7 ...
## $ LONGITUDE_COLLECT : num -119.1 -68.9 NA NA 29 ...
## $ DATUM_COLLECT : chr "" "WGS84" "" "" ...
## $ COORDINATES_QUAL : chr "100 m" "Exact" "" "" ...
## $ COORDINATES_SOURCE : chr "1) iTouchMap.com, approx, A. Orkild-Norton; 2) Mineral Resource Deposit Database Deposit ID 10174173, ore body, M. Granitto" "1) Mindat.org, approx, A. Orkild-Norton; 2) Open-File Report 2017-1079 ID 549, mine, M. Granitto" "1) No coordinates; 2) Mineral Resource Deposit Database Deposit ID 10057511, district, M. Granitto" "1) No coordinates; 2) Google Earth Pro, approx ctr of former province of Transvaal, M. Granitto" ...
## $ PRIMARY_CLASS : chr "rock" "rock" "rock" "rock" ...
## $ SYSTEM_TYPE : chr "IOA-IOCG" "Porphyry Cu-Mo-Au" "Porphyry Cu-Mo-Au" "IOA-IOCG" ...
## $ DEPOSIT_TYPE : chr "IOCG" "Supergene Cu" "Porphyry Cu" "IOCG" ...
## $ SAMPLE_DESC : chr "Nearly solid chalcopyrite mixed with small light brown irregular inclusions of unknown mineralogy; clouds of ma"| __truncated__ "Chalcocite-bronchatite-antlerite(?); highly microfractured igneous rock with green copper sulfates coating microfractures" "Bornite-chalcopyrite; mostly massive chalcopyrite with numerous inclusions of micro-chalcopyrite and widely sca"| __truncated__ "Massive chalcopyrite, IOCG in shear zone; mostly massive fine grain cuprite with widely distributed malachite t"| __truncated__ ...
## $ Al_pct_AES_ST : num 0.33 6.65 0.46 0.7 9.48 1.54 5.32 4.34 5.31 7.9 ...
## $ Ca_pct_AES_ST : num 1.1 0.4 -0.1 0.3 8.5 11.4 10.8 2.4 1.1 0.9 ...
## $ Fe_pct_AES_ST : num 42.4 0.25 6.98 27.8 8.92 10.8 14.3 10.8 1.93 3.21 ...
## $ K_pct_AES_ST : num -0.1 6.1 0.2 -0.1 0.4 -0.1 1.6 2.2 1.5 3.9 ...
## $ Mg_pct_AES_ST : num 0.57 0.1 0.01 0.33 7.39 2.15 0.36 1.01 0.85 0.88 ...
## $ Mn_pct_AES_ST : num 0.02 -0.01 -0.01 -0.01 0.04 0.79 0.48 0.01 -0.01 0.02 ...
## $ P_pct_AES_ST : num -0.01 0.01 0.05 0.01 0.06 0.43 0.22 0.05 0.08 0.07 ...
## $ S_pct_AES_ST : num NA NA NA NA NA NA NA NA NA NA ...
## $ Si_pct_AES_ST : num NA NA NA NA NA NA NA NA NA NA ...
## $ Ti_pct_AES_ST : num 0.01 0.11 -0.01 -0.01 0.28 0.24 0.52 0.3 0.29 0.25 ...
## $ F_pct_ISE_Fuse : num NA NA NA NA NA NA NA NA NA NA ...
## $ Ag_ppm_MS_ST : num 58 6 468 16 21 24 92 12 10 -1 ...
## $ As_ppm_MS_ST : num -30 -30 90 -30 50 -30 90 -30 -30 -30 ...
## $ Au_ppm : num NA NA NA NA NA NA NA NA NA NA ...
## $ Au_AM : chr "" "" "" "" ...
## $ B_ppm_AES_ST : int NA NA NA NA NA NA NA NA NA NA ...
## $ Ba_ppm_AES_ST : num -0.5 924 121 174 8100 3.2 251 234 361 995 ...
## $ Be_ppm_AES_ST : int -5 -5 -5 -5 -5 -5 -5 -5 -5 -5 ...
## $ Bi_ppm_MS_ST : num 1.5 3.6 190 0.4 12.5 5 80.8 0.6 11.7 0.7 ...
## $ Cd_ppm_MS_ST : num 3.6 -0.2 0.9 -0.2 5.7 447 9.2 -0.2 -0.2 6.8 ...
## $ Ce_ppm_MS_ST : num 0.4 8.8 16.3 3.5 15.2 104 49.7 28.3 15.8 76.3 ...
## $ Co_ppm_MS_ST : num 209 -0.5 1.3 44.8 4.5 92.2 105 45.5 8 48.6 ...
## $ Cr_ppm_AES_ST : int -10 -10 -10 30 20 20 60 40 20 10 ...
## $ Cs_ppm_MS_ST : num 0.5 1.4 0.2 -0.1 0.8 10.6 0.4 2.8 0.6 5.1 ...
## $ Cu_ppm_AES_ST : num 50000 23300 50000 50000 18600 ...
## $ Dy_ppm_MS_ST : num -0.05 0.32 1.38 0.37 2.65 7.43 5.12 1.56 0.75 4.12 ...
## $ Er_ppm_MS_ST : num -0.05 0.22 0.77 0.23 1.63 3.98 2.89 0.78 0.34 2.17 ...
## $ Eu_ppm_MS_ST : num -0.05 0.14 0.17 0.1 0.42 1.5 0.99 0.66 0.37 1.14 ...
## $ Ga_ppm_MS_ST : num 5 15 6 3 52 19 26 17 22 27 ...
## $ Gd_ppm_MS_ST : num -0.05 0.45 1.5 0.39 2.9 8.29 5.72 2.42 1.12 4.88 ...
## $ Ge_ppm_MS_ST : int -1 5 -1 -1 3 8 8 1 2 2 ...
## $ Hf_ppm_MS_ST : int -1 4 -1 -1 5 13 12 2 3 6 ...
## $ Ho_ppm_MS_ST : num -0.05 0.07 0.25 0.07 0.53 1.49 1.05 0.28 0.13 0.74 ...
## $ In_ppm_MS_ST : num 6.4 -0.2 3.7 0.2 0.5 26.7 5.4 0.4 -0.2 -0.2 ...
## $ La_ppm_MS_ST : num 0.2 4.6 7.2 1.7 5.5 40.8 26.4 13.3 7.7 39.2 ...
## $ Li_ppm_AES_ST : int -10 -10 -10 -10 30 20 20 20 -10 20 ...
## $ Lu_ppm_MS_ST : num -0.05 -0.05 0.08 -0.05 0.22 0.64 0.44 0.11 0.06 0.36 ...
## $ Mo_ppm_MS_ST : num -2 60 3 2 14 6 473 69 3 9 ...
## $ Nb_ppm_MS_ST : num -1 4 -1 -1 9 13 13 1 3 12 ...
## $ Nd_ppm_MS_ST : num 0.2 3.8 9.1 1.7 9.5 41.7 23.5 14.9 8 29.3 ...
## $ Ni_ppm_AES_ST : num 144 6 -5 48 24 26 22 23 13 21 ...
## $ Pb_ppm_MS_ST : num 23 16 188 39 546 6 39 -5 17 17 ...
## $ Pd_ppm_FA_MS : num NA NA NA NA NA NA NA NA NA NA ...
## $ Pr_ppm_MS_ST : num -0.05 1.09 2.21 0.46 2.12 10.9 5.98 3.5 2.06 8.54 ...
## $ Pt_ppm_FA_MS : num NA NA NA NA NA NA NA NA NA NA ...
## $ Rb_ppm_MS_ST : num 1.2 148 7.1 0.7 5.2 3.4 65.8 98.8 31.8 169 ...
## $ Re_ppm_MS_HF : num NA NA NA NA NA NA NA NA NA NA ...
## $ Sb_ppm_MS_ST : num 1.2 2.4 2.9 0.3 8.1 1.2 3.7 0.3 0.3 1.5 ...
## $ Sc_ppm_AES_ST : int -5 -5 -5 -5 11 6 15 10 5 6 ...
## $ Se_ppm_MS_ST : int NA NA NA NA NA NA NA NA NA NA ...
## $ Sm_ppm_MS_ST : num -0.1 0.6 1.6 0.4 2.6 8.1 5.1 2.6 1.5 4.9 ...
## $ Sn_ppm_MS_ST : num 2 3 106 -1 3 19 43 7 1 2 ...
## $ Sr_ppm_AES_ST : num 26.6 114 22.5 38.4 284 5.3 264 149 526 446 ...
## $ Ta_ppm_MS_ST : num -0.5 -0.5 -0.5 -0.5 -0.5 0.9 1.1 -0.5 -0.5 1.1 ...
## $ Tb_ppm_MS_ST : num -0.05 0.07 0.23 -0.05 0.45 1.29 0.86 0.27 0.13 0.73 ...
## $ Te_ppm_MS_ST : num NA NA NA NA NA NA NA NA NA NA ...
## $ Th_ppm_MS_ST : num 0.2 9.7 2.6 0.2 2.6 9.2 37.7 1.8 2.7 13.7 ...
## $ Tl_ppm_MS_ST : num -0.5 0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 0.9 ...
## $ Tm_ppm_MS_ST : num -0.05 -0.05 0.08 -0.05 0.22 0.67 0.47 0.1 -0.05 0.36 ...
## $ U_ppm_MS_ST : num 0.3 1.75 0.63 34.8 31.2 10.6 9.94 1.64 0.69 15.4 ...
## $ V_ppm_AES_ST : int 51 24 -5 493 68 20 40 159 39 61 ...
## $ W_ppm_MS_ST : num -1 28 22 11 8 223 30 83 -1 37 ...
## [list output truncated]
# CARGA DE LIBRERÍAS
library(dplyr)
##
## Adjuntando el paquete: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(knitr)
library(gt)
library(scatterplot3d)
library(MASS) # Necesaria para Estimación robusta
##
## Adjuntando el paquete: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
# 1. Asignación de variables genéricas
VAR_X1 <- as.numeric(datos$La_ppm_MS_ST)
VAR_X2 <- as.numeric(datos$Pr_ppm_MS_ST)
VAR_Y <- as.numeric(datos$Ce_ppm_MS_ST)
TPV_MULT <- data.frame(VAR_X1, VAR_X2, VAR_Y)
# 2. Limpieza inicial de nulos y ceros
TPV_MULT <- na.omit(TPV_MULT)
TPV_MULT <- TPV_MULT[TPV_MULT$VAR_X1 > 0 & TPV_MULT$VAR_X2 > 0 & TPV_MULT$VAR_Y > 0, ]
# -------------------------------------------------------------------
# MÉTODO RIGUROSO: DISTANCIA DE MAHALANOBIS EN 3D
# -------------------------------------------------------------------
set.seed(2345)
estimacion_robusta <- cov.rob(TPV_MULT)
distancias <- mahalanobis(TPV_MULT,
center = estimacion_robusta$center,
cov = estimacion_robusta$cov)
# ATENCIÓN: Los grados de libertad (df) cambian a 3 porque ahora hay 3 variables
umbral_chi2 <- qchisq(0.975, df = 3)
TPV_limpio <- TPV_MULT[distancias <= umbral_chi2, ]
# Filtro final de dominio geológico (opcional, ajusta los valores o coméntalo)
TPV_FILTRADO <- TPV_limpio[TPV_limpio$VAR_X1 < 20 & TPV_limpio$VAR_X2 < 20 & TPV_limpio$VAR_Y < 80, ]
# -------------------------------------------------------------------
# AGRUPACIÓN PARA MAXIMIZAR CORRELACIÓN
# -------------------------------------------------------------------
# Ahora agrupamos Y en función de las combinaciones de X1 y X2
tabla_media <- aggregate(VAR_Y ~ VAR_X1 + VAR_X2,
data = TPV_FILTRADO,
FUN = mean)
# 3. Extracción de vectores limpios para el modelo
x1_media <- tabla_media$VAR_X1
x2_media <- tabla_media$VAR_X2
y_media <- tabla_media$VAR_Y
tabla_media
## VAR_X1 VAR_X2 VAR_Y
## 1 0.2 0.05 0.5500000
## 2 0.3 0.05 0.4600000
## 3 1.4 0.05 0.6000000
## 4 0.2 0.06 0.6000000
## 5 0.3 0.06 0.5000000
## 6 0.5 0.06 0.4000000
## 7 0.6 0.06 0.9000000
## 8 0.2 0.07 0.5000000
## 9 0.3 0.07 0.5500000
## 10 0.4 0.07 0.5500000
## 11 0.8 0.07 0.7000000
## 12 1.7 0.07 0.3000000
## 13 0.1 0.08 0.5000000
## 14 0.2 0.08 0.7000000
## 15 0.3 0.08 0.5000000
## 16 0.4 0.08 0.4000000
## 17 0.2 0.09 0.7500000
## 18 0.3 0.09 0.6500000
## 19 0.4 0.09 0.5000000
## 20 0.6 0.09 0.9000000
## 21 0.2 0.10 0.7000000
## 22 0.3 0.10 0.6000000
## 23 0.4 0.10 0.8666667
## 24 0.5 0.10 0.6666667
## 25 0.6 0.10 1.0000000
## 26 0.3 0.11 0.6000000
## 27 0.4 0.11 0.7000000
## 28 0.5 0.11 0.8500000
## 29 0.2 0.12 0.7000000
## 30 0.3 0.12 0.5500000
## 31 0.4 0.12 0.8000000
## 32 0.5 0.12 0.9500000
## 33 0.6 0.12 1.0000000
## 34 0.9 0.12 0.9000000
## 35 0.4 0.13 1.1000000
## 36 0.5 0.13 1.0000000
## 37 0.6 0.13 1.1000000
## 38 1.1 0.13 0.5000000
## 39 0.3 0.14 1.0000000
## 40 0.4 0.14 0.8000000
## 41 0.6 0.14 0.9000000
## 42 0.8 0.14 1.0750000
## 43 1.5 0.14 0.3000000
## 44 0.3 0.15 0.8000000
## 45 0.6 0.15 1.1666667
## 46 1.2 0.15 1.5000000
## 47 2.1 0.15 1.8000000
## 48 2.4 0.15 1.1000000
## 49 0.2 0.16 0.9000000
## 50 0.4 0.16 0.8000000
## 51 0.5 0.16 1.2000000
## 52 0.7 0.16 1.3000000
## 53 0.3 0.17 0.9000000
## 54 0.4 0.17 1.1000000
## 55 0.5 0.17 1.2000000
## 56 0.7 0.17 1.5000000
## 57 0.8 0.17 1.4000000
## 58 0.9 0.17 1.7000000
## 59 1.2 0.17 1.3000000
## 60 0.2 0.18 1.6000000
## 61 0.5 0.18 0.8000000
## 62 0.6 0.18 1.2000000
## 63 0.8 0.18 0.6000000
## 64 0.9 0.18 1.5000000
## 65 0.6 0.19 1.2000000
## 66 0.7 0.19 1.4500000
## 67 0.8 0.19 2.0000000
## 68 1.0 0.19 1.4000000
## 69 1.1 0.19 1.7000000
## 70 0.6 0.20 1.3000000
## 71 0.7 0.20 1.6000000
## 72 0.8 0.20 1.5000000
## 73 0.9 0.20 1.8000000
## 74 1.1 0.20 2.1000000
## 75 1.3 0.20 2.1000000
## 76 1.4 0.20 2.5000000
## 77 1.7 0.20 2.7000000
## 78 2.1 0.20 2.3000000
## 79 0.5 0.21 1.6000000
## 80 0.6 0.21 1.5000000
## 81 1.0 0.21 1.8000000
## 82 1.3 0.21 2.2000000
## 83 0.8 0.22 1.4000000
## 84 0.9 0.22 1.2000000
## 85 1.0 0.22 1.8000000
## 86 1.3 0.22 1.8000000
## 87 2.2 0.22 1.6000000
## 88 0.7 0.23 1.6000000
## 89 0.8 0.23 1.6000000
## 90 0.9 0.23 2.2000000
## 91 0.7 0.24 1.6500000
## 92 0.8 0.24 1.7500000
## 93 0.9 0.24 1.4000000
## 94 1.0 0.24 2.1000000
## 95 3.2 0.24 2.3000000
## 96 1.2 0.25 2.2000000
## 97 1.5 0.25 1.6000000
## 98 1.7 0.25 2.0000000
## 99 2.6 0.25 3.2000000
## 100 0.6 0.26 1.4000000
## 101 0.8 0.26 1.8000000
## 102 0.9 0.26 2.0000000
## 103 1.0 0.26 2.1000000
## 104 1.2 0.26 2.2000000
## 105 1.3 0.26 2.5500000
## 106 1.4 0.26 2.0000000
## 107 1.5 0.26 2.1000000
## 108 1.0 0.27 2.1000000
## 109 1.1 0.27 2.2000000
## 110 1.2 0.27 2.3000000
## 111 1.3 0.27 2.0500000
## 112 1.6 0.27 2.3000000
## 113 3.5 0.27 2.0000000
## 114 0.8 0.28 1.8000000
## 115 0.9 0.28 2.0000000
## 116 1.1 0.28 2.4000000
## 117 1.3 0.28 1.3000000
## 118 1.5 0.28 2.7000000
## 119 1.6 0.28 2.4000000
## 120 1.0 0.29 2.1000000
## 121 1.1 0.29 2.7000000
## 122 1.2 0.29 0.8000000
## 123 0.5 0.30 1.1000000
## 124 1.2 0.30 2.2000000
## 125 1.7 0.30 2.1000000
## 126 1.8 0.30 2.2000000
## 127 0.6 0.31 1.6000000
## 128 0.7 0.31 2.3000000
## 129 1.0 0.31 2.7000000
## 130 1.4 0.31 2.4000000
## 131 1.5 0.31 1.7000000
## 132 3.0 0.31 2.8000000
## 133 3.3 0.31 3.8000000
## 134 0.7 0.32 1.8000000
## 135 1.5 0.32 2.6000000
## 136 1.6 0.32 1.9000000
## 137 2.7 0.32 2.9000000
## 138 0.4 0.33 2.1000000
## 139 0.8 0.33 2.7000000
## 140 0.9 0.33 2.3000000
## 141 1.1 0.33 1.4000000
## 142 1.3 0.33 2.5500000
## 143 1.5 0.33 2.7000000
## 144 1.8 0.33 3.0500000
## 145 2.1 0.33 3.3000000
## 146 2.2 0.33 1.7000000
## 147 1.0 0.34 2.7000000
## 148 1.6 0.34 2.9000000
## 149 2.5 0.34 2.7000000
## 150 1.1 0.35 2.7000000
## 151 1.3 0.35 2.5000000
## 152 1.4 0.35 2.9000000
## 153 1.5 0.35 2.7500000
## 154 1.7 0.35 1.6000000
## 155 2.7 0.35 2.7000000
## 156 3.8 0.35 2.8000000
## 157 1.0 0.36 3.2000000
## 158 1.8 0.36 3.1000000
## 159 2.3 0.36 1.4000000
## 160 1.1 0.37 2.1000000
## 161 1.5 0.37 2.6000000
## 162 1.7 0.37 3.2000000
## 163 2.4 0.37 3.7000000
## 164 0.5 0.38 1.9000000
## 165 1.2 0.38 2.7000000
## 166 1.3 0.38 2.7000000
## 167 1.4 0.38 3.0000000
## 168 1.8 0.38 3.5000000
## 169 2.0 0.38 3.0000000
## 170 2.2 0.38 2.8000000
## 171 2.4 0.38 2.9000000
## 172 0.9 0.39 1.4000000
## 173 1.1 0.39 2.8000000
## 174 1.5 0.39 3.1000000
## 175 1.6 0.39 3.3000000
## 176 0.8 0.40 1.9000000
## 177 1.6 0.40 3.2000000
## 178 1.7 0.40 3.0000000
## 179 1.8 0.40 3.4000000
## 180 0.8 0.41 2.5000000
## 181 0.9 0.41 2.5000000
## 182 1.6 0.41 2.8000000
## 183 1.7 0.41 3.6000000
## 184 1.8 0.41 3.2000000
## 185 2.6 0.41 3.3000000
## 186 4.3 0.41 3.0000000
## 187 1.6 0.42 3.3000000
## 188 2.4 0.42 2.4000000
## 189 0.6 0.43 2.0000000
## 190 1.3 0.43 2.9000000
## 191 1.5 0.43 3.2000000
## 192 1.9 0.43 3.2000000
## 193 2.9 0.43 4.8000000
## 194 1.2 0.44 3.1000000
## 195 1.4 0.44 3.2000000
## 196 1.9 0.44 3.3000000
## 197 3.4 0.44 4.1000000
## 198 0.6 0.45 2.1000000
## 199 1.0 0.45 2.8500000
## 200 1.1 0.46 2.3000000
## 201 1.7 0.46 3.4500000
## 202 1.9 0.46 3.6000000
## 203 1.4 0.47 4.1000000
## 204 1.7 0.47 3.4000000
## 205 2.8 0.47 4.2000000
## 206 2.0 0.48 4.1000000
## 207 3.1 0.48 4.9000000
## 208 3.8 0.48 5.6000000
## 209 1.7 0.49 3.8000000
## 210 3.1 0.49 2.4000000
## 211 3.2 0.49 2.2000000
## 212 0.7 0.50 2.6000000
## 213 1.8 0.50 3.9000000
## 214 2.2 0.50 4.3000000
## 215 2.3 0.50 3.6000000
## 216 1.3 0.51 3.2000000
## 217 1.8 0.51 3.9000000
## 218 2.0 0.51 2.6000000
## 219 2.7 0.51 3.6000000
## 220 1.1 0.52 3.1000000
## 221 2.0 0.52 4.1000000
## 222 2.1 0.52 4.4000000
## 223 2.3 0.52 3.9000000
## 224 0.8 0.53 2.3000000
## 225 1.0 0.53 2.2000000
## 226 1.7 0.53 3.5000000
## 227 1.8 0.53 3.8000000
## 228 2.1 0.53 4.3000000
## 229 2.2 0.53 4.3000000
## 230 1.7 0.54 3.7000000
## 231 1.9 0.54 2.7000000
## 232 2.6 0.54 4.3000000
## 233 1.5 0.55 3.2500000
## 234 1.9 0.55 4.3000000
## 235 2.2 0.55 4.6000000
## 236 2.5 0.55 4.6000000
## 237 2.7 0.55 5.3000000
## 238 3.0 0.55 3.3000000
## 239 3.1 0.55 4.5000000
## 240 2.2 0.56 4.7000000
## 241 2.7 0.56 4.8500000
## 242 0.8 0.57 2.1000000
## 243 1.2 0.57 3.5000000
## 244 1.3 0.57 3.7000000
## 245 2.0 0.57 4.5000000
## 246 3.5 0.57 5.7000000
## 247 0.9 0.58 2.8000000
## 248 1.7 0.58 3.4500000
## 249 2.7 0.58 4.5000000
## 250 0.7 0.59 3.0000000
## 251 2.0 0.59 4.6000000
## 252 3.2 0.59 5.5000000
## 253 4.1 0.59 7.6000000
## 254 1.9 0.60 4.6000000
## 255 2.0 0.60 4.6000000
## 256 2.5 0.60 2.8000000
## 257 2.6 0.60 5.2000000
## 258 2.2 0.61 4.4000000
## 259 2.4 0.61 4.8000000
## 260 3.1 0.61 4.7000000
## 261 1.8 0.62 4.4000000
## 262 2.7 0.62 4.4000000
## 263 3.0 0.62 3.8000000
## 264 3.5 0.62 5.0500000
## 265 2.0 0.63 4.3000000
## 266 2.6 0.63 5.2000000
## 267 2.8 0.63 4.9000000
## 268 3.4 0.63 4.7000000
## 269 3.6 0.64 6.4000000
## 270 5.7 0.64 5.5000000
## 271 1.9 0.66 4.2000000
## 272 2.4 0.66 3.3000000
## 273 4.0 0.66 4.3000000
## 274 2.0 0.67 4.4000000
## 275 2.6 0.67 5.3000000
## 276 2.8 0.67 3.7000000
## 277 3.3 0.67 6.1000000
## 278 3.4 0.67 5.8000000
## 279 2.7 0.68 4.7000000
## 280 3.6 0.68 6.4000000
## 281 1.3 0.69 3.8000000
## 282 2.6 0.69 6.0000000
## 283 2.9 0.69 5.2000000
## 284 3.9 0.69 4.6000000
## 285 0.7 0.70 2.5000000
## 286 2.0 0.71 3.5000000
## 287 3.1 0.71 6.1000000
## 288 3.9 0.71 3.8000000
## 289 5.9 0.71 6.1000000
## 290 1.8 0.72 5.0000000
## 291 1.9 0.72 4.5000000
## 292 3.3 0.72 6.5000000
## 293 3.4 0.72 6.2000000
## 294 4.0 0.72 5.8000000
## 295 5.0 0.72 7.6000000
## 296 1.6 0.73 4.8000000
## 297 3.0 0.73 6.6000000
## 298 3.2 0.73 5.8000000
## 299 3.6 0.73 4.6000000
## 300 4.0 0.73 5.0000000
## 301 5.0 0.73 7.4000000
## 302 2.8 0.76 5.6000000
## 303 3.3 0.76 6.4000000
## 304 3.9 0.76 7.9000000
## 305 1.9 0.77 3.5000000
## 306 2.3 0.77 4.7000000
## 307 3.3 0.77 7.2500000
## 308 1.9 0.78 5.2000000
## 309 3.9 0.78 7.5000000
## 310 0.4 0.79 2.4000000
## 311 1.9 0.79 4.6000000
## 312 2.6 0.80 6.5000000
## 313 2.8 0.80 7.3000000
## 314 3.2 0.80 7.4000000
## 315 2.7 0.81 5.6000000
## 316 2.9 0.81 5.7000000
## 317 6.1 0.81 8.2000000
## 318 1.8 0.82 4.8000000
## 319 2.4 0.82 4.5000000
## 320 3.4 0.82 6.9000000
## 321 3.5 0.82 8.4000000
## 322 4.2 0.82 5.5000000
## 323 2.4 0.83 6.1000000
## 324 3.1 0.83 6.4000000
## 325 3.7 0.83 6.4000000
## 326 3.0 0.84 6.3000000
## 327 5.8 0.84 9.8000000
## 328 3.1 0.85 7.5000000
## 329 3.3 0.85 6.7000000
## 330 1.8 0.87 5.1000000
## 331 3.7 0.87 6.6000000
## 332 4.2 0.87 7.6000000
## 333 4.5 0.87 7.0000000
## 334 5.5 0.88 8.6000000
## 335 1.7 0.89 5.3000000
## 336 3.6 0.89 5.0000000
## 337 3.7 0.89 6.7000000
## 338 3.8 0.89 7.6000000
## 339 1.6 0.90 5.0000000
## 340 2.7 0.90 6.4000000
## 341 4.0 0.90 7.4000000
## 342 4.0 0.92 7.7000000
## 343 4.3 0.92 7.6000000
## 344 4.4 0.92 7.8000000
## 345 6.8 0.93 10.0000000
## 346 1.6 0.94 6.0000000
## 347 3.9 0.95 8.0000000
## 348 4.4 0.95 7.6000000
## 349 2.0 0.96 6.2000000
## 350 4.3 0.96 8.2000000
## 351 4.4 0.96 7.9000000
## 352 3.3 0.97 7.6000000
## 353 2.7 0.98 6.4000000
## 354 3.5 0.99 7.4000000
## 355 3.7 0.99 7.4000000
## 356 4.5 1.00 8.9000000
## 357 3.4 1.01 6.0000000
## 358 4.3 1.01 6.2000000
## 359 3.6 1.02 7.5000000
## 360 5.8 1.02 8.7000000
## 361 3.9 1.03 8.1000000
## 362 4.5 1.03 8.2000000
## 363 3.2 1.04 7.9000000
## 364 3.3 1.04 7.5000000
## 365 4.8 1.05 9.3000000
## 366 3.6 1.07 8.4000000
## 367 4.4 1.07 10.4000000
## 368 2.7 1.08 5.6000000
## 369 4.0 1.08 8.4000000
## 370 3.1 1.09 7.4000000
## 371 4.6 1.09 8.8000000
## 372 5.5 1.09 10.1000000
## 373 2.3 1.10 6.3000000
## 374 5.5 1.10 9.8000000
## 375 5.9 1.10 9.9000000
## 376 4.1 1.11 8.7000000
## 377 4.5 1.12 8.8000000
## 378 4.6 1.12 8.7000000
## 379 3.6 1.13 6.5000000
## 380 3.7 1.13 9.7000000
## 381 4.9 1.13 10.3000000
## 382 5.2 1.13 9.5000000
## 383 4.1 1.14 9.0000000
## 384 4.9 1.15 10.5500000
## 385 3.9 1.16 8.7000000
## 386 4.7 1.20 9.3000000
## 387 5.2 1.20 11.4000000
## 388 7.8 1.20 11.9000000
## 389 3.4 1.21 9.2000000
## 390 1.9 1.22 6.1000000
## 391 5.9 1.22 10.6000000
## 392 6.2 1.22 11.1000000
## 393 3.4 1.23 8.0000000
## 394 5.6 1.23 10.7000000
## 395 4.5 1.24 8.8000000
## 396 6.2 1.24 11.4000000
## 397 6.1 1.25 9.3000000
## 398 8.9 1.25 12.0000000
## 399 2.4 1.26 7.5000000
## 400 8.6 1.26 12.4000000
## 401 3.6 1.27 11.0000000
## 402 4.2 1.27 10.1000000
## 403 3.9 1.28 6.3000000
## 404 3.6 1.29 8.4000000
## 405 5.5 1.29 10.7000000
## 406 2.5 1.31 6.9000000
## 407 2.5 1.32 7.5000000
## 408 2.9 1.32 8.7000000
## 409 5.6 1.33 13.2000000
## 410 6.6 1.36 13.0000000
## 411 6.9 1.36 12.3000000
## 412 5.2 1.37 12.3000000
## 413 5.6 1.37 11.8000000
## 414 3.0 1.38 10.0000000
## 415 4.1 1.38 9.2000000
## 416 6.5 1.38 12.1000000
## 417 3.4 1.39 9.3000000
## 418 6.1 1.40 10.9000000
## 419 3.9 1.41 9.4000000
## 420 4.2 1.41 9.3000000
## 421 5.1 1.41 11.0000000
## 422 6.0 1.41 11.0000000
## 423 4.4 1.42 9.1000000
## 424 4.0 1.43 9.5000000
## 425 5.3 1.43 11.5000000
## 426 5.0 1.45 11.3000000
## 427 5.1 1.45 11.6000000
## 428 6.3 1.45 12.9000000
## 429 8.6 1.46 13.8000000
## 430 5.5 1.47 12.6000000
## 431 7.6 1.47 12.1000000
## 432 5.7 1.48 11.8000000
## 433 6.5 1.51 13.3000000
## 434 6.1 1.54 10.7000000
## 435 4.1 1.55 10.4000000
## 436 8.2 1.57 13.9000000
## 437 6.6 1.59 10.6000000
## 438 8.4 1.59 14.8000000
## 439 6.7 1.60 12.6000000
## 440 6.8 1.60 10.2000000
## 441 5.8 1.62 11.1000000
## 442 6.1 1.62 11.6000000
## 443 4.4 1.63 10.9000000
## 444 7.0 1.63 13.1000000
## 445 6.8 1.64 13.8000000
## 446 6.8 1.65 16.0000000
## 447 4.9 1.66 11.5000000
## 448 5.6 1.66 12.2000000
## 449 6.9 1.66 13.4000000
## 450 6.8 1.68 13.8000000
## 451 8.7 1.69 16.6000000
## 452 6.5 1.71 13.6000000
## 453 9.6 1.71 16.0000000
## 454 4.1 1.72 11.6000000
## 455 7.2 1.72 13.9000000
## 456 6.5 1.73 14.7000000
## 457 7.3 1.73 15.4000000
## 458 2.8 1.74 10.5000000
## 459 4.5 1.74 11.9000000
## 460 4.6 1.76 12.0000000
## 461 5.2 1.76 12.2000000
## 462 6.8 1.76 14.2000000
## 463 10.4 1.76 15.4000000
## 464 8.4 1.77 15.1000000
## 465 5.1 1.78 12.4000000
## 466 7.9 1.78 15.2000000
## 467 9.4 1.78 16.9000000
## 468 6.1 1.81 13.8000000
## 469 6.3 1.82 14.5000000
## 470 6.7 1.83 14.5000000
## 471 12.1 1.83 17.7000000
## 472 7.9 1.84 15.1000000
## 473 10.3 1.84 19.0000000
## 474 10.6 1.86 15.7000000
## 475 4.9 1.87 14.3000000
## 476 8.5 1.87 15.8000000
## 477 5.1 1.88 14.9000000
## 478 6.9 1.88 15.1000000
## 479 8.3 1.89 16.4000000
## 480 6.9 1.90 14.4000000
## 481 7.1 1.90 17.1000000
## 482 7.7 1.90 15.3000000
## 483 9.3 1.90 16.3000000
## 484 5.8 1.92 13.4000000
## 485 7.2 1.93 15.3000000
## 486 8.1 1.95 14.8000000
## 487 9.1 1.95 17.0000000
## 488 9.0 1.96 14.9000000
## 489 8.1 1.97 16.3000000
## 490 8.4 1.98 16.4000000
## 491 6.1 1.99 15.4000000
## 492 6.3 1.99 14.8000000
## 493 6.9 1.99 17.0000000
## 494 9.0 2.00 17.4000000
## 495 6.5 2.01 15.1000000
## 496 8.1 2.01 16.7000000
## 497 6.1 2.03 14.2000000
## 498 8.6 2.03 17.7000000
## 499 9.1 2.03 18.9000000
## 500 11.3 2.05 17.7000000
## 501 7.7 2.06 15.8000000
## 502 8.2 2.06 16.5000000
## 503 9.2 2.07 14.9000000
## 504 10.2 2.07 17.5000000
## 505 4.4 2.08 15.2000000
## 506 6.1 2.09 13.5000000
## 507 8.6 2.09 16.8000000
## 508 8.1 2.10 18.3000000
## 509 5.5 2.12 15.2000000
## 510 8.3 2.12 15.7000000
## 511 8.5 2.12 16.9000000
## 512 8.9 2.14 18.3000000
## 513 7.8 2.15 17.2000000
## 514 9.8 2.16 19.7000000
## 515 11.9 2.16 21.1000000
## 516 10.8 2.17 19.6000000
## 517 10.9 2.17 18.7000000
## 518 7.2 2.21 16.3000000
## 519 8.9 2.25 16.7000000
## 520 6.9 2.27 17.3000000
## 521 6.9 2.28 16.3000000
## 522 7.6 2.28 18.6000000
## 523 8.4 2.30 17.9000000
## 524 12.0 2.31 19.2000000
## 525 9.0 2.32 19.6000000
## 526 11.0 2.35 19.1000000
## 527 6.9 2.38 16.9000000
## 528 9.6 2.38 18.2000000
## 529 10.1 2.38 19.8000000
## 530 11.0 2.39 21.3000000
## 531 9.3 2.43 18.5000000
## 532 10.0 2.44 18.8000000
## 533 12.9 2.44 22.6000000
## 534 7.2 2.48 18.6000000
## 535 13.2 2.50 20.5000000
## 536 9.1 2.51 20.0000000
## 537 13.9 2.51 24.9000000
## 538 11.7 2.52 22.8000000
## 539 11.2 2.54 21.5000000
## 540 11.3 2.54 22.0000000
## 541 7.8 2.55 17.5000000
## 542 9.5 2.55 19.9000000
## 543 8.2 2.56 16.9000000
## 544 10.7 2.57 19.4000000
## 545 12.7 2.58 20.9000000
## 546 14.2 2.60 22.4000000
## 547 12.7 2.61 24.6000000
## 548 12.2 2.66 22.4000000
## 549 11.8 2.72 20.8000000
## 550 12.8 2.72 24.0000000
## 551 11.5 2.73 21.6000000
## 552 7.0 2.74 18.5000000
## 553 9.6 2.76 21.4000000
## 554 7.3 2.77 20.6000000
## 555 11.2 2.82 22.8000000
## 556 11.5 2.85 24.6000000
## 557 11.6 2.86 24.1000000
## 558 12.6 2.86 26.0000000
## 559 11.8 2.88 25.8000000
## 560 13.6 2.88 23.0000000
## 561 8.5 2.89 22.2000000
## 562 10.7 2.90 23.3000000
## 563 10.2 2.91 22.4000000
## 564 11.2 2.92 22.3000000
## 565 16.5 2.93 28.4000000
## 566 13.0 2.95 26.0000000
## 567 11.8 2.96 23.9000000
## 568 11.3 3.00 22.9000000
## 569 10.3 3.04 24.8000000
## 570 11.1 3.04 23.7000000
## 571 9.1 3.10 23.2000000
## 572 13.8 3.17 27.3000000
## 573 11.2 3.19 23.8000000
## 574 13.5 3.19 24.8000000
## 575 16.7 3.20 27.5000000
## 576 11.1 3.21 24.8000000
## 577 10.8 3.22 22.5000000
## 578 15.4 3.24 28.5000000
## 579 12.7 3.25 25.8000000
## 580 13.6 3.26 27.4000000
## 581 13.6 3.27 28.7000000
## 582 13.8 3.27 26.7000000
## 583 16.0 3.29 28.9000000
## 584 13.5 3.30 28.4000000
## 585 14.5 3.30 29.8000000
## 586 16.2 3.38 30.9000000
## 587 14.4 3.41 28.2000000
## 588 15.5 3.41 29.6000000
## 589 14.6 3.45 28.7000000
## 590 14.1 3.46 27.9000000
## 591 15.1 3.46 29.0000000
## 592 16.3 3.47 31.6000000
## 593 11.6 3.48 24.4000000
## 594 13.3 3.50 28.3000000
## 595 11.6 3.52 25.2000000
## 596 14.4 3.53 27.8000000
## 597 13.7 3.54 27.9000000
## 598 15.9 3.57 30.5000000
## 599 11.4 3.59 26.8000000
## 600 12.1 3.60 25.6000000
## 601 15.8 3.61 32.3000000
## 602 13.9 3.66 30.1000000
## 603 16.6 3.66 33.7000000
## 604 17.6 3.68 31.6000000
## 605 14.3 3.70 31.5000000
## 606 15.1 3.70 29.6000000
## 607 16.4 3.70 31.3000000
## 608 16.3 3.72 30.2000000
## 609 12.1 3.73 27.7000000
## 610 17.2 3.73 33.3000000
## 611 16.3 3.79 31.0000000
## 612 16.2 3.81 30.5000000
## 613 17.9 3.85 31.6000000
## 614 18.4 3.89 34.0000000
## 615 13.5 3.90 30.2000000
## 616 12.8 3.92 28.6000000
## 617 19.1 4.05 36.2000000
## 618 14.9 4.08 32.5000000
## 619 15.9 4.08 30.7000000
## 620 16.7 4.11 33.6000000
## 621 15.9 4.12 34.1000000
## 622 19.4 4.20 36.9000000
## 623 14.6 4.24 32.6000000
## 624 19.6 4.36 36.4000000
## 625 18.3 4.44 36.9000000
## 626 18.8 4.44 37.4000000
## 627 16.8 4.45 33.9000000
## 628 19.4 4.51 39.3000000
## 629 17.3 4.57 36.1000000
## 630 15.9 4.64 36.0000000
## 631 19.3 4.67 38.2000000
## 632 19.0 4.83 38.0000000
## 633 18.8 4.90 40.0000000
## 634 19.2 4.95 39.6000000
## 635 19.1 5.06 39.7000000
# Extraer las variables
x1 <- x1_media
x2 <- x2_media
y <- y_media
# Generar el gráfico 3D base (solo los puntos)
library(scatterplot3d)
scatterplot3d(x1, x2, y,
angle = 60,
pch = 16,
color = "darkblue",
main = "Gráfica N°1: Diagrama de Dispersión 3D\nLantano (La) y Praseodimio (Pr) vs Cerio (Ce)",
xlab = "Concentración de Lantano (ppm)",
ylab = "Concentración de Praseodimio (ppm)",
zlab = "Concentración de Cerio (ppm)")
# Gráfica de comparación
plot3d <- scatterplot3d(x1, x2, y,
angle = 60,
pch = 16,
color = "blue",
main = "Gráfica N°2: Comparación de la realidad con el\nmodelo multivariable lineal",
xlab = "Concentración de Lantano (ppm)",
ylab = "Concentración de Praseodimio (ppm)",
zlab = "Concentración de Cerio (ppm)")
# Cálculo de parámetros
regresion_multiple <- lm(y ~ x1 + x2)
summary(regresion_multiple)
##
## Call:
## lm(formula = y ~ x1 + x2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.9048 -0.3794 0.1208 0.4304 2.6514
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.37353 0.05029 -7.427 3.61e-13 ***
## x1 0.77568 0.02618 29.630 < 2e-16 ***
## x2 5.11968 0.10889 47.016 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8527 on 632 degrees of freedom
## Multiple R-squared: 0.9919, Adjusted R-squared: 0.9919
## F-statistic: 3.879e+04 on 2 and 632 DF, p-value: < 2.2e-16
# Plano
plot3d$plane3d(regresion_multiple, col = "red", lty = "dotted")
4.1 ECUACIÓN DEL MODELO
coeficientes <- coef(regresion_multiple)
a <- round(coeficientes[1], 3)
b <- round(coeficientes[2], 3)
c <- round(coeficientes[3], 3)
# Mostrar ecuación en gráfico
plot(1, type = "n", axes = FALSE, xlab = "", ylab = "")
text(x = 1, y = 1,
labels = paste("Ecuación Múltiple Lineal\n",
"Y = a + bx1 + cx2\n",
"Y =", a, "+", b, "x1 +", c,"x2"),
cex = 1.8,
col = "blue",
font = 2)
5.1 Test de Pearson
r <- cor(y, fitted(regresion_multiple))
r * 100
## [1] 99.59513
5.2 COEFICIENTE DE DETERMINACIÓN
r2 <- r^2
r2 * 100
## [1] 99.1919
5.3 Restricciones
Dado que las variables están expresadas en partes por millón (ppm), el dominio físico del modelo requiere que las concentraciones sean estrictamente no negativas. No obstante, el modelo multivariable lineal puede generar predicciones fuera de dicho rango debido a la combinación matemática de las variables independientes. Por esta razón, la interpretación del modelo se limita estrictamente al rango observado de Lantano (ppm) y Praseodimio (ppm), evitando extrapolaciones fuera del dominio analizado.
Adicionalmente, las predicciones de Cerio (ppm) deben mantener coherencia física, admitiendo únicamente valores mayores o iguales a cero.
\[La, Pr, Ce \geq 0\] \[La \in [La_{min}, La_{max}]\] \[Pr \in [Pr_{min}, Pr_{max}]\] \[Ce_{predicho} \geq 0\]
¿Cuál sería la concentración esperada de Cerio (Ce) si el contenido analizado de Lantano (La) es de 2 ppm y el de Praseodimio (Pr) es de 0.5 ppm?
# 1. Definimos los valores de entrada para las variables independientes
x1_input <- 2
x2_input <- 0.5
# 2. Aplicamos la ecuación del modelo multivariable
Ce_Est <- regresion_multiple$coefficients[1] +
regresion_multiple$coefficients[2] * x1_input +
regresion_multiple$coefficients[3] * x2_input
# Imprimir en consola para verificación
Ce_Est
## (Intercept)
## 3.737674
# 3. Mostrar resultado en gráfico
plot(1, type = "n", axes = FALSE, xlab = "", ylab = "")
resultado_texto <- paste0(
"¿Qué concentración de Cerio (Ce) se espera\n",
"para un contenido de Lantano = ", x1_input, " ppm y Praseodimio = ", x2_input, " ppm?\n\n",
"Cerio estimado = ", round(Ce_Est, 2), " ppm"
)
text(x = 1, y = 1,
labels = resultado_texto,
cex = 1.1,
col = "blue",
font = 2)
El valor de Cerio está influenciado en un alto porcentaje por la combinación de Lantano y Praseodimio, lo que se evidencia en el elevado coeficiente de determinación obtenido. Esto indica que el modelo explica de manera adecuada la variabilidad de este elemento en las muestras analizadas.
Además, el modelo presenta coherencia tanto estadística como geoquímica, ya que las variables utilizadas pertenecen al grupo de los elementos tierras raras (REE) y comparten una fuerte afinidad de fraccionamiento, permitiendo una interpretación consistente del comportamiento del sistema mineralizante.
Por ejemplo, al considerar valores específicos de las variables independientes (como Lantano = 2 ppm y Praseodimio = 0.5 ppm), es posible estimar la concentración esperada de Cerio mediante la ecuación del modelo, lo que demuestra su utilidad como herramienta de análisis y predicción geoquímica.