Created
June 25, 2014 16:00
-
-
Save coppeliaMLA/b0f1798f3749621be5dd to your computer and use it in GitHub Desktop.
Look at the relationship between MI and correlation for binary vars (since it's quicker than doing the maths)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Check the relationship between correlation and mutual information for binary vars | |
store<-NULL | |
for (i in 1:1000){ | |
prob.1<-runif(1) | |
prob.2<-runif(1) | |
x<-rbinom(10000, 1, prob.1) | |
y<-rbinom(10000, 1, prob.2) | |
c<-cor(x,y) | |
m<-mi.empirical(table(x,y)) | |
store<-rbind(store, data.frame(c=c, m=m)) | |
} | |
plot(store) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment