Difference between revisions of "GGB-correlation-snippet.R"

From Organic Design wiki
(Fixing parameters (untested))
(Get correlation script working)
Line 1: Line 1:
p <- 1000
+
# p (genes) by n (slides) matrix
n <- 10
+
# m=p keeping fdr notation
a.shape  <- parameters[1]
 
a0.shape <- parameters[2]
 
scale    <-  parameters[3]
 
k <- 20
 
  
kcorrelation <- rgamma(2*m1 shape=k, rate=k) # p49 2001 NEWTON paper
+
m <- p  <- 1000
DEscales <- rep(rgamma(m1, shape=a0.shape, rate=scale), each=2)
+
nreps <- 5
 +
 
 +
n  <- nreps * 2
 +
pi0 <- 0.95
 +
 
 +
m1 <- round(m * (1-pi0))
 +
m0 <- p - m1
 +
 
 +
params <- c(2.74886, 1.36546, 4.12844) # "IPTG-a parameters"
 +
k <- 100
 +
 
 +
a.shape  <- params[1]
 +
a0.shape <- params[2]
 +
scale    <- params[3]
 +
 
 +
kcorrelation <- rgamma(2*m1, shape=k, rate=k) # p49 2001 NEWTON paper
 +
DEscales <- rgamma(2*m1, shape=a0.shape, rate=scale)
 
DEscales <- DEscales * kcorrelation
 
DEscales <- DEscales * kcorrelation
  
Line 13: Line 25:
 
EEscales <- rgamma(m0 , shape=a0.shape, rate=scale)
 
EEscales <- rgamma(m0 , shape=a0.shape, rate=scale)
 
EEscales <- EEscales / kcorrelation
 
EEscales <- EEscales / kcorrelation
scales  <- c(rep(DEscales, each=slides), rep(EEscales, each=2*slides))
 
  
X <- rgamma(ngenes*p, a.shape, rate=scales)
+
scales  <- c(rep(DEscales, each=nreps), rep(EEscales, each=2*nreps))     
dim(X) <- c(p, n)
+
X <- rgamma(n* p, a.shape, rate=scales)  
X <- t(X) # Data already on raw scale
+
dim(X) <- c(n,p)
 +
 
 +
X <- t(X)
 +
 
 +
# Graphical check
 +
pairs(log2(X))

Revision as of 23:43, 28 August 2006

  1. p (genes) by n (slides) matrix
  2. m=p keeping fdr notation

m <- p <- 1000 nreps <- 5

n <- nreps * 2 pi0 <- 0.95

m1 <- round(m * (1-pi0)) m0 <- p - m1

params <- c(2.74886, 1.36546, 4.12844) # "IPTG-a parameters" k <- 100

a.shape <- params[1] a0.shape <- params[2] scale <- params[3]

kcorrelation <- rgamma(2*m1, shape=k, rate=k) # p49 2001 NEWTON paper DEscales <- rgamma(2*m1, shape=a0.shape, rate=scale) DEscales <- DEscales * kcorrelation

kcorrelation <- rgamma(m0, shape=k, rate=k) EEscales <- rgamma(m0 , shape=a0.shape, rate=scale) EEscales <- EEscales / kcorrelation

scales <- c(rep(DEscales, each=nreps), rep(EEscales, each=2*nreps)) X <- rgamma(n* p, a.shape, rate=scales) dim(X) <- c(n,p)

X <- t(X)

  1. Graphical check

pairs(log2(X))