This cannot tell apart correlation from anticorrelation.
library(infotheo)
library(ggplot2)
library(reshape2)
bodyAreas <- d[,3:26]
names(bodyAreas)<-as.character(c(1:24))
# Remove NAs
bodyAreas<-na.omit(bodyAreas)
qplot(x=Var1, y=Var2, data=melt(mutinformation(bodyAreas)), fill=value, geom="tile") + labs(x="Body areas", y="Body areas")
This is not correct as we are dealing with a categorical variable.
sp<-qplot(x=Var1, y=Var2, data=melt(cor(bodyAreas)), fill=value, geom="tile") + labs(x="Body areas", y="Body areas")
sp+scale_fill_gradient2(midpoint=0, low="blue", high="red", mid="white", space="Lab")
library(infotheo)
bodyAreasBW <- bodyAreas
bodyAreasBW[bodyAreasBW>0]<-1
qplot(x=Var1, y=Var2, data=melt(mutinformation(bodyAreasBW)), fill=value, geom="tile") + labs(x="Body areas", y="Body areas")
Here it is somewhat correct as we have recoded in 0/1.
correlations <- cor(bodyAreasBW)
sp2<- qplot(x=Var1, y=Var2, data=melt(correlations), fill=value, geom="tile") + labs(x="Body areas", y="Body areas")
sp2+scale_fill_gradient2(midpoint=0, low="blue", high="red", mid="white", space="Lab")
Summary of the correlations.
summary(c(correlations))
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -0.1229 0.0185 0.1151 0.2465 0.4144 1.0000