Slda: Shrunken Linear Discriminant Analysis.

Description Usage Arguments Value Author(s) References See Also Examples

Description

‘Slda’ finds the coefficients of a linear discriminant rule based on Fisher and Sun's (2011) estimate and generalizations of Ledoit and Wolf's (2004) optimal shrunken covariance matrix.

Usage

1
2
3
4
5
6
7
## Default S3 method:
Slda(data, grouping, prior = "proportions", StddzData=TRUE, 
VSelfunct = SelectV, Trgt=c("CnstDiag","Idntty","VarDiag"), 
minp=20, ldafun=c("canonical","classification"), ...)

## S3 method for class 'data.frame'
Slda(data, ...)

Arguments

data

Matrix or data frame of observations.

grouping

Factor specifying the class for each observation.

prior

The prior probabilities of class membership. If unspecified, the class proportions for the training set are used. If present, the probabilities should be specified in the order of the factor levels.

StddzData

A boolean flag indicating whether the data should be standardized first (default) or used in their original scales.

VSelfunct

Variable selection function. Either the string “none” (no selection is to be performed) or a function that takes ‘data’ and ‘grouping’ as its first two arguments and returns a list with two components: (i) ‘nvkpt’ - the number of variables to be used in the Discriminant rule; and (ii) ‘vkptInd’ - the indices of the variables to be used in the Discriminant rule. The default is the ‘SelectV’ function that, by default, selects variables by the Expanded HC scheme described in Duarte Silva (2011).

Trgt

A string code with the target type used by the shrunken estimator. The alternatives are “CnstDiag” for a Ledoit-Wolf constant diagonal target, “Idntty” for a p-dimensional identity, and “VarDiag” for a diagonal target of empirical variances.

minp

Minimum number of variables required for the estimation of the target intensity to be considered reliable. If the dimension of Sigma is below pmin, no shrunken estimate is computed and the original sample covariance is employed.

ldafun

Type of discriminant linear functions computed. The alternatives are “canonical” for maximum-discrimination canonical linear functions and “classification” for direct-classification linear functions.

...

Further arguments passed to or from other methods.

Value

If algument ‘ldafun’ is set to “canonical” an object of class ‘Scanlda’, which extends class ‘canldaRes’, with the following components:

prior

The prior probabilities used.

means

The class means.

scaling

A matrix which transforms observations to discriminant functions, normalized so that the within groups covariance matrix is spherical.

svd

The singular values, which give the ratio of the between- and within-group standard deviations on the linear discriminant variables. Their squares are the canonical F-statistics.

vkpt

A vector with the indices of the variables kept in the discriminant rule if the number of variables kept is less than ‘ncol(data)’. NULL otherwise.

nvkpt

The number of variables kept in the discriminant rule if this number is less than‘ncol(data)’. NULL otherwise.

SSig

An object of class ‘ShrnkMat’ with a compact representation of the within groups covariance matrix. ‘ShrnkMat’ objects have specialized methods for matrix inversion, multiplication, and element-wise arithmetic operations.

SSigInv

An object of class ‘ShrnkMatInv’ with a compact representation of the within groups precision (inverse covariance) matrix. ‘ShrnkMatInv’ objects have specialized methods for matrix inversion, multiplication, and element-wise arithmetic operations.

N

The number of observations used.

call

The (matched) function call.

If algument ‘ldafun’ is set to “classification” an object of class ‘Scllda’, which extends class ‘clldaRes’, with the following components:

prior

The prior probabilities used.

means

The class means.

coef

A matrix with the coefficients of the k-1 classification functions.

cnst

A vector with the thresholds (2nd members of linear classification rules) used in classification rules that assume equal priors.

vkpt

A vector with the indices of the variables kept in the discriminant rule if the number of variables kept is less than ‘ncol(data)’. NULL otherwise.

nvkpt

The number of variables kept in the discriminant rule if this number is less than‘ncol(data)’. NULL, otherwise.

SSig

An object of class ‘ShrnkMat’ with a compact representation of the within groups covariance matrix. ‘ShrnkMat’ objects have specialized methods for matrix inversion, multiplication, and element-wise arithmetic operations.

SSigInv

An object of class ‘ShrnkMatInv’ with a compact representation of the within groups precision (inverse covariance) matrix. ‘ShrnkMatInv’ objects have specialized methods for matrix inversion, multiplication, and element-wise arithmetic operations.

N

The number of observations used.

call

The (matched) function call.

Author(s)

A. Pedro Duarte Silva

References

Ledoit, O. and Wolf, M. (2004) “A well-conditioned estimator for large-dimensional covariance matrices.”, Journal of Multivariate Analysis, 88 (2), 365-411.

Fisher, T.J. and Sun, X. (2011) “Improved Stein-type shrinkage estimators for the high-dimensional multivariate normal covariance matrix”, Computational Statistics and Data Analysis, 55 (1), 1909-1918.

Pedro Duarte Silva, A. (2011) “Two Group Classification with High-Dimensional Correlated Data: A Factor Model Approach”, Computational Statistics and Data Analysis, 55 (1), 2975-2990.

See Also

SelectV, ShrnkSigE, ShrnkMat, ShrnkMatInv,

predict.canldaRes, predict.clldaRes, AlonDS

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
29
30
31
32
33
34
# train classifier on Alon's Colon Cancer Data set 
# after a logarithmic transformation 
# (selecting genes by the Expanded HC scheme). 

ldarule <- Slda(log10(AlonDS[,-1]),AlonDS$grouping)     

# show classification rule

print(ldarule)

# get in-sample classification results

predict(ldarule,log10(AlonDS[,-1]),grpcodes=levels(AlonDS$grouping))$class           	       

# compare classifications with true assignments

cat("Original classes:\n")
print(AlonDS[,1])             		 


# Estimate error rates by four-fold cross-validation.
# Note: In cross-validation analysis it is recommended to set 
# the argument 'ldafun' to "classification", in order to speed up 
# computations by avoiding unecessary eigen-decompositions 

## Not run: 

CrosValRes <- DACrossVal(log10(AlonDS[,-1]),AlonDS$grouping,TrainAlg=Slda,
ldafun="classification",kfold=4,CVrep=1)
summary(CrosValRes[,,"Clerr"])


## End(Not run)
         	       

HiDimDA documentation built on May 1, 2019, 10:52 p.m.