IndependentLogNormal-class {Umpire} | R Documentation |
The IndependentLogNormal
class is a tool used to generate gene
expressions that follow log normal distribution, because the true expression
value follows log normal in our model.
IndependentLogNormal(logmu,logsigma) ## S4 method for signature 'IndependentLogNormal' nrow(x) ## S4 method for signature 'IndependentLogNormal' rand(object, n, ...) ## S4 method for signature 'IndependentLogNormal' summary(object, ...)
logmu |
numeric vector specifying the mean expression values on the logarithmic scale. |
logsigma |
numeric vector specifying the standard deviation of the gene expression values on the logarithmic scale |
object, x |
object of class |
n |
numeric scalar specifying number of samples to be simulated |
... |
extra arguments for generic or plotting routines |
Although objects of the class can be created by a direct call to
new, the preferred method is to use the
IndependentLogNormal
generator function.
logmu
:numeric vector containing the mean expression values on the logarithmic scale
logsigma
:numeric vector containing the standard deviation of the gene expression values on the logarithmic scale
Returns the number of genes (i.e, the length of the
logmu
vector).
Generates nrow(IndependentLogNormal)*n matrix
representing gene expressions of n samples following log normal
distribution captured in the object of IndependentLogNormal
.
Prints out the number of independent log
normal random variables in the object of IndependentLogNormal
.
Kevin R. Coombes krc@silicovore.com, Jiexin Zhang jiexinzhang@mdanderson.org,
Engine
,
IndependentNormal
,
MVN
showClass("IndependentLogNormal") nGenes <- 20 logmu <- rnorm(nGenes, 6, 1) logsigma <- 1/rgamma(nGenes, rate=14, shape=6) ln <- IndependentLogNormal(logmu, logsigma) nrow(ln) summary(ln) if (any(logmu - ln@logmu)) { print('means do not match') } else { print('means verified') } if (any(logsigma - ln@logsigma)) { print('standard deviations do not match') } else { print('sd verified') } x <- rand(ln, 1000) print(dim(x)) print(paste("'ln' should be valid:", validObject(ln))) ln@logsigma <- 1:3 # now we break it print(paste("'ln' should not be valid:", validObject(ln, test=TRUE))) tmp.sd <- sqrt(apply(log(x), 1, var)) plot(tmp.sd, logsigma) tmp.mu <- apply(log(x), 1, mean) plot(tmp.mu, logmu) rm(nGenes, logmu, logsigma, ln, x, tmp.mu, tmp.sd)