Carga de datos
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 información:" ,align = "c",digits = 6) %>%
kable_material(html_font = "sans-serif")
Matriz de información:
|
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
|
Ejemplo 1
library(corrplot)
library(grDevices)
library(Hmisc)
Mat_R<-rcorr(as.matrix(mat_X))
corrplot(Mat_R$r,
p.mat = Mat_R$r,
type = "full",
tl.col = "black",
tl.srt = 20,
pch.col = "black",
insig = "p-value",
sig.level = -1,
order = "hclust",
addrect = 1,
col = terrain.colors(20),
bg = "gray")

Ejemplo 2
library(corrplot)
library(grDevices)
library(Hmisc)
Mat_R<-rcorr(as.matrix(mat_X))
corrplot(Mat_R$r,
p.mat = Mat_R$r,
type="lower",
tl.col="black",
tl.srt = 25,
pch.col = "black",
insig = "p-value",
sig.level = -1,
method="pie",
order = "hclust",
addrect = 4,
col= cm.colors(150),
bg= "lightblue")

Ejemplo 3
colr <- colorRampPalette(c("#617f00", "lightgreen", "#0095ff", "blue", "#8c00ff",
"pink", "#ff0037", "red", "#8a0606"))
Mat_R<-rcorr(as.matrix(mat_X))
corrplot(Mat_R$r,
p.mat = Mat_R$r,
type="full",
tl.col="black",
tl.srt = 15,
pch.col = "black",
insig = "p-value",
sig.level = -1,
order = "hclust",
method = "circle",
addrect = 3,
col = colr(100))

Ejemplo 4
Mat_R<-rcorr(as.matrix(mat_X))
corrplot(Mat_R$r,
p.mat = Mat_R$r,
type="upper",
tl.col="black",
tl.srt = 15,
order = "hclust",
pch.col = "white",
insig = "p-value",
sig.level = -1,
method = "square",
col = "purple",
bg = "lightpink")

Ejemplo 5
Mat_R<-rcorr(as.matrix(mat_X))
corrplot(Mat_R$r,
p.mat = Mat_R$r,
type="full",
tl.col="black",
tl.srt = 15,
order = "hclust",
pch.col = "white",
insig = "p-value",
sig.level = -1,
method = "ellipse",
col = "blue",
bg = "lightgreen")
