These functions are used to apply the generic train-and-test mechanism to a classifier that combines principal component analysis (PCA) with logistic regression (LR).
The data matrix, with rows as features ("genes") and columns as the samples to be classified.
A factor, with two levels, classifying the samples. The length must
equal the number of
A list of additional parameters used by the classifier; see Details.
The function used to make predictions on new data, using the
trained classifier. Should always be set to
Another data matrix, with the same number of rows as
A list of additional parameters describing details about the particular classifier; see Details.
Optional extra parameters required by the generic "predict" method.
The input arguments to both
are dictated by the requirements of the general train-and-test
mechanism provided by the
The RPART classifier is similar in spirit to the "supervised principal
components" method implemented in the
superpc package. We
start by performing univariate two-sample t-tests to identify features
that are differentially expressed between two groups of training
samples. We then set a cutoff to select features using a bound
alpha) on the false discovery rate (FDR). If the number of
selected features is smaller than a prespecified goal
minNgenes), then we increase the FDR until we get the desired
number of features. Next, we perform PCA on the selected features
from the trqining data. we retain enough principal components (PCs)
to explain a prespecified fraction of the variance (
We then fit a logistic regression model using these PCs to predict the
binary class of the training data. In order to use this model to make
binary predictions, you must specify a
prior probability that a
sample belongs to the first of the two groups (where the ordering is
determined by the levels of the classification factor,
In order to fit the model to data, the
params argument to the
learnRPART function should be a list containing components
It may also contain a logical value called
controls the amount of information that is output as the algorithm runs.
The result of fitting the model using
learnRPART is a member of
FittedModel-class. In additon to storing the
prediction function (
pfun) and the training data and status,
the FittedModel stores those details about the model that are required
in order to make predictions of the outcome on new data. In this
acse, the details are: the
prior probability, the set of
selected features (
sel, a logical vector), the principal
component decomposition (
spca, an object of the
SamplePCA class), the logistic
regression model (
mmod, of class
glm), the number
of PCs used (
nCompUsed) as well as the number of components
nCompAvail) and the number of gene-features selected
details object is appropriate for
sending as the second argument to the
predictRPART function in
order to make predictions with the model on new data. Note that the
status vector here is the one used for the training data, since
the prediction function only uses the levels of this factor to
make sure that the direction of the predicitons is interpreted
learnRPART function returns an object of the
FittedModel-class, representing a RPART classifier
that has been fitted on a training
predictRPART function returns a factor containing the
predictions of the model when applied to the new data set.
Kevin R. Coombes <email@example.com>
1 2 3 4 5 6 7 8 9 10 11 12 13
# simulate some data data <- matrix(rnorm(100*20), ncol=20) status <- factor(rep(c("A", "B"), each=10)) # set up the parameter list rpart.params <- list(minNgenes=10, alpha=0.10, perVar=0.80, prior=0.5) # learn the model fm <- learnRPART(data, status, rpart.params, predictRPART) # Make predictions on some new simulated data newdata <- matrix(rnorm(100*30), ncol=30) predictRPART(newdata, fm@details, status)
Loading required package: ClassDiscovery Loading required package: cluster Loading required package: oompaBase Loading required package: ClassComparison A B 1 0.7692308 0.2307692 2 0.7692308 0.2307692 3 0.7692308 0.2307692 4 0.7692308 0.2307692 5 0.7692308 0.2307692 6 0.7692308 0.2307692 7 0.7692308 0.2307692 8 0.7692308 0.2307692 9 0.7692308 0.2307692 10 0.0000000 1.0000000 11 0.7692308 0.2307692 12 0.7692308 0.2307692 13 0.0000000 1.0000000 14 0.7692308 0.2307692 15 0.7692308 0.2307692 16 0.7692308 0.2307692 17 0.7692308 0.2307692 18 0.7692308 0.2307692 19 0.7692308 0.2307692 20 0.7692308 0.2307692 21 0.7692308 0.2307692 22 0.7692308 0.2307692 23 0.7692308 0.2307692 24 0.7692308 0.2307692 25 0.7692308 0.2307692 26 0.0000000 1.0000000 27 0.7692308 0.2307692 28 0.7692308 0.2307692 29 0.7692308 0.2307692 30 0.7692308 0.2307692
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.