Carga de la data.

library(readr)
library(kableExtra)
url_link<-"http://halweb.uc3m.es/esp/Personal/personas/agrane/libro/ficheros_datos/capitulo_7/datos_prob_7_3.txt"
mat_X<-read_table2(url_link,col_names = FALSE)

mat_X %>% head() %>% 
  kable(caption ="Matriz de datos" ,align = "l",digits = 6) %>% 
  kable_material_dark(html_font ="courrier")
Matriz de datos
X1 X2 X3 X4 X5 X6 X7 X8
30 41 670 3903 12 94 341 1.2
124 46 410 955 6 57 89 0.5
95 48 370 6 5 26 20 0.1
90 43 680 435 8 20 331 1.6
112 41 100 1293 2 51 22 0.1
73 51 390 6115 4 35 93 0.2

Estimación para la funcion V(x)

library(dplyr)
library(kableExtra)
centrado<-function(x){
  x-mean(x)
}
Xcentrada<-apply(X = mat_X,MARGIN = 2,centrado)
Xcentrada %>% head() %>% 
  kable(caption ="Matriz de Variables centrales",
        align = "l",
        digits = 2) %>% 
  kable_material_dark(html_font = "courrier")
Matriz de Variables centrales
X1 X2 X3 X4 X5 X6 X7 X8
-49.67 -0.67 303.89 1463.5 2.94 -60.17 196.72 0.71
44.33 4.33 43.89 -1484.5 -3.06 -97.17 -55.28 0.01
15.33 6.33 3.89 -2433.5 -4.06 -128.17 -124.28 -0.39
10.33 1.33 313.89 -2004.5 -1.06 -134.17 186.72 1.11
32.33 -0.67 -266.11 -1146.5 -7.06 -103.17 -122.28 -0.39
-6.67 9.33 23.89 3675.5 -5.06 -119.17 -51.28 -0.29

Estimación Manual para la funcion V(x)

n_obs<-nrow(mat_X)
mat_V<-t(Xcentrada)%*%Xcentrada/(n_obs-1) 
mat_V %>% kable(caption ="Estimación de V(X) forma manual:" ,
                align = "l",
                digits = 3) %>% 
  kable_material_dark(html_font = "courrier") 
Estimación de V(X) forma manual:
X1 X2 X3 X4 X5 X6 X7 X8
X1 716.118 45.059 -2689.608 -16082.059 -121.627 -1019.059 -1844.373 -5.151
X2 45.059 46.941 -144.314 2756.706 -24.627 -938.412 -205.255 -0.422
X3 -2689.608 -144.314 36389.869 123889.706 740.817 838.333 17499.379 73.484
X4 -16082.059 2756.706 123889.706 5736372.382 3078.971 6672.441 140343.500 412.794
X5 -121.627 -24.627 740.817 3078.971 51.467 405.578 565.219 1.595
X6 -1019.059 -938.412 838.333 6672.441 405.578 26579.559 3149.775 -2.957
X7 -1844.373 -205.255 17499.379 140343.500 565.219 3149.775 16879.389 64.509
X8 -5.151 -0.422 73.484 412.794 1.595 -2.957 64.509 0.282

Uso de corrplot: Matriz de correlación - circle method

library(corrplot)
library(grDevices)
library(Hmisc)

Mat_R<-rcorr(as.matrix(mat_X))
corrplot(Mat_R$r,
         p.mat = Mat_R$r,
         title="circle method",
         bg= c("#C5E0B3"),
         type="full",
         tl.col="black",
         tl.srt = 10,
         pch.col = "blue",
         insig = "p-value",
         sig.level = -1,
         col = c("#4472c4", "#ED7D31", "#A5A5A5", "#5B9BD5", "#217346"),
         )


Uso de corrplot: Matriz de correlacion - shade method

library(corrplot)
library(grDevices)
library(Hmisc)
Mat_R<-rcorr(as.matrix(mat_X))
corrplot(Mat_R$r,
         p.mat = Mat_R$r,
         title="shade method",
         method="shade",
         type="full",
         order="hclust",
         addrect=2,
         tl.col="black",
         tl.srt = 40,
         pch.col = "blue",
         insig = "p-value",
         sig.level = -1,
         col=c("#4472c4", "#ED7D31", "#A5A5A5", "#5B9BD5", "#217346"))


Uso de corrplot: Matriz de correlacion - lower method

library(corrplot)
library(grDevices)
library(Hmisc)
par(bg = "black")
corrplot(Mat_R$r,
         p.mat = Mat_R$r,
         title="lower method",
         method="ellipse",
         type="lower",
         order="FPC",
         tl.col= c("#217346"),
         tl.srt = 20,
         pch.col = c("#3A3838"),
         insig = "p-value",
         sig.level = -1,
         col = c("#4472c4", "#ED7D31", "#A5A5A5", "#5B9BD5", "#217346")
         
)


prueba con performanceanalitycs

library(PerformanceAnalytics)
chart.Correlation(as.matrix(mat_X),histogram = TRUE,pch=6,method = c("pearson"))