Description Usage Arguments Value Author(s) See Also Examples
This function build a model from data to predict class in classify
.
1 |
peakMatrix |
Numeric matrix of normalized peak heights with samples in rows and peaks in columns. |
group |
Two-level factor defining the group of every samples in |
filter.p |
Single numeric value, if not |
... |
Further arguments to be passed to |
Returns an S3 object of class fsaModel
.
Sylvain Mareschal
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 29 30 31 32 33 34 35 36 37 | # Underlying truth for pseudo-data (10 genes)
geneNames <- paste("gene", LETTERS[1:10], sep=".")
geneMean <- abs(rnorm(10))
groupShift <- rnorm(10, sd=0.1)
# Generate pseudo-data for 50 samples
mtx <- NULL
for(g in 1:10) {
x <- rnorm(n=50, mean=geneMean[g], sd=0.1)
x[1:25] <- x[1:25] + groupShift[g]
x[26:50] <- x[26:50] - groupShift[g]
mtx <- cbind(mtx, x)
}
colnames(mtx) <- geneNames
rownames(mtx) <- c(
paste("group1", 1:25, sep="."),
paste("group2", 26:50, sep=".")
)
# Train model
group <- c(
rep("group1", 25),
rep("group2", 25)
)
model <- train(mtx, group)
plot(model)
# Compare model to truth
i <- match(geneNames, model$geneNames)
out <- data.frame(
gene = geneNames,
true.M = geneMean,
model.M = model$geneMs[i],
true.shift = groupShift,
model.T = model$geneTs[i]
)
print(out)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.