Description Usage Arguments Details Value Author(s) References See Also Examples
sda
trains a LDA or DDA classifier using James-Stein-type shrinkage estimation.
1 |
Xtrain |
A matrix containing the training data set. Note that the rows correspond to observations and the columns to variables. |
L |
A factor with the class labels of the training samples. |
lambda |
Shrinkage intensity for the correlation matrix. If not specified it is
estimated from the data. |
lambda.var |
Shrinkage intensity for the variances. If not specified it is
estimated from the data. |
lambda.freqs |
Shrinkage intensity for the frequencies. If not specified it is
estimated from the data. |
diagonal |
Chooses between LDA (default, |
verbose |
Print out some info while computing. |
In order to train the LDA or DDA classifier, three separate shrinkage estimators are employed:
class frequencies: the estimator freqs.shrink
from Hausser and Strimmer (2008),
variances: the estimator var.shrink
from Opgen-Rhein and Strimmer (2007),
correlations: the estimator cor.shrink
from Sch\"afer and Strimmer (2005).
Note that the three corresponding regularization parameters are obtained analytically without resorting to computer intensive resampling.
sda
trains the classifier and returns an sda
object
with the following components needed for the subsequent prediction:
regularization |
a vector containing the three estimated shrinkage intensities, |
freqs |
the estimated class frequencies, |
alpha |
vector containing the intercepts used for prediction, |
beta |
matrix containing the coefficients used for prediction. |
Miika Ahdesm\"aki and Korbinian Strimmer (https://strimmerlab.github.io).
Ahdesm\"aki, A., and K. Strimmer. 2010. Feature selection in omics prediction problems using cat scores and false non-discovery rate control. Ann. Appl. Stat. 4: 503-519. <DOI:10.1214/09-AOAS277>
predict.sda
, sda.ranking
,
freqs.shrink
,
var.shrink
,
invcor.shrink
.
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 38 39 40 41 42 43 44 45 46 47 | # load sda library
library("sda")
##########################
# training and test data #
##########################
# data set containing the SRBCT samples
get.srbct = function()
{
data(khan2001)
idx = which( khan2001$y == "non-SRBCT" )
x = khan2001$x[-idx,]
y = factor(khan2001$y[-idx])
descr = khan2001$descr[-idx]
list(x=x, y=y, descr=descr)
}
srbct = get.srbct()
# training data
Xtrain = srbct$x[1:63,]
Ytrain = srbct$y[1:63]
Xtest = srbct$x[64:83,]
Ytest = srbct$y[64:83]
###################################################
# classification with correlation (shrinkage LDA) #
###################################################
sda.fit = sda(Xtrain, Ytrain)
ynew = predict(sda.fit, Xtest)$class # using all 2308 features
sum(ynew != Ytest)
###########################################################
# classification with diagonal covariance (shrinkage DDA) #
###########################################################
sda.fit = sda(Xtrain, Ytrain, diagonal=TRUE)
ynew = predict(sda.fit, Xtest)$class # using all 2308 features
sum(ynew != Ytest)
#################################################################
# for complete example scripts illustrating classification with #
# feature selection visit https://strimmerlab.github.io/software/sda/ #
#################################################################
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.