Analysis of the colors of body areas, no recoding.

Mutual information between colors in body areas

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")

Basic Pearson correlation between colors in 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")

Recoding in 0/1 depending on black/non black.

Mutual information

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")

Pearson correlation

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