VennDiagram.R

From Organic Design wiki
Revision as of 21:44, 6 August 2007 by Sven (talk | contribs) (Code update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
# This illustrates a problem with missing values
library(limma)

graphics.off()

p <- 100
n <- 3

x <- matrix(0, nr=p,nc=n)
colnames(x) <- LETTERS[1:3]
set.seed(1)
for(i in 1:n) {
  x[,i] <- rbinom(p, 1, 1/10)
}

# Two copies one containing missing information
x.NA <- x

vennDiagram(x)
title("Simulated venn diagram without missing values")

x[4,]
x.NA[4,3] <- NA


X11()
vennDiagram(x.NA)
title("Simulated venn diagram with missing values")

# Printing output from A:B intersection 
vennCounts(x)[7,]
vennCounts(x.NA)[7,]
# Note missing value in row 7 has reduced the venn diagram count
# This removes all information about that observation even though we know that
# there was valid information about A and B in row 7, so that information had
# to of been either a A:B interaction or an A:B:C interaction