aeongrail
aeongrail

Reputation: 1384

corrplot causing weird error

I have two set matrix defined below:

They contain p values from t-tests between two variables (I know this is bad statistical practice)

I'm trying to use a correlation plot from the corrplot package to plot them

however, when I use the following line:

corrplot(weird, insig = "p-value", p.mat = weird, type = "lower", sig.level = 1-0.95, method = "circle", is.corr = FALSE,  cl.lim=c(0,1), tl.offset=0.4)

The normal matrix displays correctly, yet the weird one doesn't. This has caused me many hours of frustration, and I have narrowed the problem down to the insig="p-value" argument, as the corrplot function works as intended without it.

weird<-structure(c(2.22044604925031e-16, 0.018443376602325, 2.12390642555483e-12, 
2.22044604925031e-16, 0.018443376602325, 2.22044604925031e-16, 
2.22044604925031e-16, 2.22044604925031e-16, 2.12390642555483e-12, 
2.22044604925031e-16, 3.00501193636783e-06, 2.5333487645982e-12, 
2.22044604925031e-16, 2.22044604925031e-16, 2.5333487645982e-12, 
0.0197044105270931), .Dim = c(4L, 4L), .Dimnames = list(NULL, 
    NULL))

normal<-structure(c(0.34190041513821, 0.957047560166067, 0.680056137259229, 
0.00101879090792332, 1.2138613135621e-09, 0.406147270030259, 
0.957047560166067, 0.343145355714736, 0.157301364839312, 0.0223978064844035, 
2.92279774741867e-07, 0.904700589348579, 0.680056137259229, 0.157301364839312, 
0.620933486276745, 0.000609313754058382, 2.10803751235147e-10, 
0.411208816692722, 0.00101879090792332, 0.0223978064844035, 0.000609313754058382, 
8.78613655419196e-05, 9.15187128142626e-12, 0.197743409064612, 
1.2138613135621e-09, 2.92279774741867e-07, 2.10803751235147e-10, 
9.15187128142626e-12, 0.00179242617730144, 0.0159636230788393, 
0.406147270030259, 0.904700589348579, 0.411208816692722, 0.197743409064612, 
0.0159636230788393, 1.5372324857583e-07), .Dim = c(6L, 6L), .Dimnames = list(
    NULL, NULL))

The weird one The weird result

The normal one The normal result

Upvotes: 1

Views: 1560

Answers (1)

aeongrail
aeongrail

Reputation: 1384

Okay, I've worked it out.

There weren't any p-values greater than that required by sig.level all of them were less than 0.05. As soon as I edited one value to be greater than 0.05 it made it work

eg.

weird[1,1] <- 0.1
corrplot(weird)

works

Upvotes: 1

Related Questions