The "IndependentLogNormal" Class

Share:

Description

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.

Usage

1
2
3
4
5
6
7
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, ...)

Arguments

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 IndependentLogNormal

n

numeric scalar specifying number of samples to be simulated

...

extra arguments for generic or plotting routines

Objects from the Class

Although objects of the class can be created by a direct call to new, the preferred method is to use the IndependentLogNormal generator function.

Slots

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

Methods

nrow(x)

Returns the number of genes (i.e, the length of the logmu vector).

rand(object, n, ...)

Generates nrow(IndependentLogNormal)*n matrix representing gene expressions of n samples following log normal distribution captured in the object of IndependentLogNormal.

summary(object, ...)

Prints out the number of independent log normal random variables in the object of IndependentLogNormal.

Author(s)

Kevin R. Coombes krc@silicovore.com, Jiexin Zhang jiexinzhang@mdanderson.org, P. Roebuck proebuck@mdanderson.org

References

OOMPA

See Also

Engine, IndependentNormal, MVN

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)