| IndependentNormal-class {Umpire} | R Documentation |
The "IndependentNormal" Class
Description
The IndependentNormal class is a tool used to generate gene
expressions that follow independent normal distribution.
Usage
IndependentNormal(mu,sigma)
## S4 method for signature 'IndependentNormal'
alterMean(object, TRANSFORM, ...)
## S4 method for signature 'IndependentNormal'
alterSD(object, TRANSFORM, ...)
## S4 method for signature 'IndependentNormal'
nrow(x)
## S4 method for signature 'IndependentNormal'
rand(object, n, ...)
## S4 method for signature 'IndependentNormal'
summary(object, ...)
Arguments
mu |
numeric vector specifying the mean expression values |
sigma |
numeric vector specifying the standard deviation of the gene expression values |
object, x |
object of class |
TRANSFORM |
function that takes a vector of mean expression or standard deviation and returns a transformed vector that can be used to alter the appropriate slot of the object. |
n |
numeric scalar specifying number of samples to be simulated |
... |
extra arguments for generic or plotting routines |
Details
Note that we typically work on expression value with its logarithm to some appropriate base. That is, the independent normal should be used on the logarithmic scale in order to construct the engine.
Objects from the Class
Objects can be created by using the IndependentNormal generator
function. The object of class IndependentNormal contains the mean
and standard deviation for the normal distribution
Slots
mu:see corresponding argument above
sigma:see corresponding argument above
Methods
- alterMean(object, TRANSFORM, ...)
Takes an object of class
IndependentNormal, loops over themuslot, alters the mean as defined byTRANSFORMfunction, and returns an object of classIndependentNormalwith alteredmu.- alterSD(object, TRANSFORM, ...)
Takes an object of class
IndependentNormal, loops over thesigmaslot, alters the standard deviation as defined byTRANSFORMfunction, and returns an object of classIndependentNormalwith alteredsigma.- nrow(x)
Returns the number of genes (i.e, the length of the
muvector).- rand(object, n, ...)
Generates
nrow(IndependentNormal)*nmatrix representing gene expressions ofnsamples following the normal distribution captured in the object ofIndependentNormal.- summary(object, ...)
Prints out the number of independent normal random variables in the object of
IndependentNormal.
Author(s)
Kevin R. Coombes krc@silicovore.com, Jiexin Zhang jiexinzhang@mdanderson.org,
See Also
Engine,
IndependentLogNormal,
MVN
Examples
showClass("IndependentNormal")
nGenes <- 20
mu <- rnorm(nGenes, 6, 1)
sigma <- 1/rgamma(nGenes, rate=14, shape=6)
ind <- IndependentNormal(mu, sigma)
nrow(ind)
summary(ind)
if (any(mu - ind@mu)) {
print('means do not match')
} else {
print('means verified')
}
if (any(sigma - ind@sigma)) {
print('standard deviations do not match')
} else {
print('sd verified')
}
x <- rand(ind, 3)
print(dim(x))
print(summary(x))
print(paste("'ind' should be valid:", validObject(ind)))
ind@sigma <- 1:3 # now we break it
print(paste("'ind' should not be valid:", validObject(ind, test=TRUE)))
rm(nGenes, mu, sigma, ind, x)